From 1d2beee51f38ec4a3eda17ca564755f1711c2f44 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 4 Sep 2018 11:43:07 -0500 Subject: HDFFV-10569 Add unsupported option notes to docs --- config/cmake/scripts/HDF5options.cmake | 17 +++++ release_docs/INSTALL | 112 ++++++++++++++++++--------------- release_docs/INSTALL_CMake.txt | 14 +++++ 3 files changed, 94 insertions(+), 49 deletions(-) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index c5f08ed..3e6aad0 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -67,6 +67,23 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# +### enable parallel builds + +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") +#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF”) + +############################################################################################# +### enable thread-safety builds + +#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON”) +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF") +#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF”) + +############################################################################################# ### disable test program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") diff --git a/release_docs/INSTALL b/release_docs/INSTALL index baad559..5c54698 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -2,11 +2,11 @@ Instructions for the Installation of HDF5 Software ================================================== -This file provides instructions for installing the HDF5 software. +This file provides instructions for installing the HDF5 software. For help with installing, questions can be posted to the HDF Forum or sent to the HDF Helpdesk: - HDF Forum: https://forum.hdfgroup.org/ + HDF Forum: https://forum.hdfgroup.org/ HDF Helpdesk: https://portal.hdfgroup.org/display/support/The+HDF+Help+Desk CONTENTS @@ -52,8 +52,8 @@ CONTENTS 1. Obtaining HDF5 The latest supported public release of HDF5 is available from - https://www.hdfgroup.org/downloads/hdf5/. For Unix and UNIX-like - platforms, it is available in tar format compressed with gzip. + https://www.hdfgroup.org/downloads/hdf5/. For Unix and UNIX-like + platforms, it is available in tar format compressed with gzip. For Microsoft Windows, it is in ZIP format. @@ -77,14 +77,14 @@ CONTENTS $ tar zxf hdf5-X.Y.Z.tar.gz above refers to the configure flags appropriate - to your installation. For example, to install HDF5 with the - Fortran and C++ interfaces and with SZIP compression, the + to your installation. For example, to install HDF5 with the + Fortran and C++ interfaces and with SZIP compression, the configure line might read as follows: - + $ ./configure --prefix=/usr/local/hdf5 --enable-fortran \ --enable-cxx --with-szlib=PATH_TO_SZIP - In this case, PATH_TO_SZIP would be replaced with the path to the + In this case, PATH_TO_SZIP would be replaced with the path to the installed location of the SZIP library. 2.1. Windows @@ -101,7 +101,7 @@ CONTENTS 3. HDF5 dependencies 3.1. Zlib - The HDF5 library includes a predefined compression filter that + The HDF5 library includes a predefined compression filter that uses the "deflate" method for chunked datasets. If zlib-1.1.2 or later is found, HDF5 will use it. Otherwise, HDF5's predefined compression method will degenerate to a no-op; the compression @@ -122,17 +122,17 @@ CONTENTS include the Szip library with the encoder enabled. These can be found here: - https://www.hdfgroup.org/downloads/hdf5/ + https://www.hdfgroup.org/downloads/hdf5/ To configure the HDF5 library with the Szip compression filter, use the '--with-szlib=/PATH_TO_SZIP' flag. For more information, see section 4.3.7, "Specifying other libraries and headers." Please notice that if HDF5 configure cannot find a valid Szip library, - configure will not fail; in this case, the compression filter will + configure will not fail; in this case, the compression filter will not be available to the applications. - To check if Szip compression was successfully configured in, + To check if Szip compression was successfully configured in, check the "I/O filters (external):" line in the configure output, summary section, printed to the standard output. @@ -188,7 +188,7 @@ CONTENTS detects various features of the host system and creates the Makefiles. On most systems it should be sufficient to say: - $ ./configure + $ ./configure Or $ sh configure @@ -218,15 +218,15 @@ CONTENTS before the library and executables are built. HDF5 can be installed into a different location than the prefix - specified at configure time; see section 4.6, "Installing HDF5," + specified at configure time; see section 4.6, "Installing HDF5," for more details. 4.3.2. Using an alternate C compiler By default, configure will look for the C compiler by trying `gcc' and `cc'. However, if the environment variable "CC" is set - then its value is used as the C compiler. For instance, one would - use the following line to specify the native C compiler on a system - that also has the GNU gcc compiler (users of csh and derivatives + then its value is used as the C compiler. For instance, one would + use the following line to specify the native C compiler on a system + that also has the GNU gcc compiler (users of csh and derivatives will need to prefix the commands below with `env'): $ CC=cc ./configure @@ -257,7 +257,7 @@ CONTENTS $ ./configure --enable-fortran $ ./configure --enable-cxx $ ./configure --enable-java - + Configuration will halt if a working Fortran 90 or 95 compiler or C++ compiler is not found. Currently, the Fortran configure tests for these compilers in order: f90, pgf90, f95. To use an @@ -267,7 +267,7 @@ CONTENTS 4.3.5. Specifying other programs - The build system has been tuned for use with GNU make but also + The build system has been tuned for use with GNU make but also works with other versions of make. If the `make' command runs a non-GNU version but a GNU version is available under a different name (perhaps `gmake'), then HDF5 can be configured to use it by @@ -286,8 +286,8 @@ CONTENTS during `make install' (described below) with a BSD-compatible install program detected automatically by configure. If none is found, the shell script bin/install-sh is used. Configure does not - check that the install script actually works; if a bad install is - detected on your system (e.g., on the ASCI blue machine as of + check that the install script actually works; if a bad install is + detected on your system (e.g., on the ASCI blue machine as of March 2, 1999) you have two choices: 1. Copy the bin/install-sh program to your $HOME/bin @@ -310,11 +310,11 @@ CONTENTS LDFLAGS=-L/home/robb/lib \ ./configure - HDF5 uses the zlib library to support the HDF5 deflate - data compression filter. Configure searches the standard places - (plus those specified above with the CPPFLAGS and LDFLAGS variables) - for the zlib headers and library. The search can be disabled by - specifying `--without-zlib' or alternate directories can be specified + HDF5 uses the zlib library to support the HDF5 deflate + data compression filter. Configure searches the standard places + (plus those specified above with the CPPFLAGS and LDFLAGS variables) + for the zlib headers and library. The search can be disabled by + specifying `--without-zlib' or alternate directories can be specified with `--with-zlib=INCDIR,LIBDIR' or through the CPPFLAGS and LDFLAGS variables: @@ -324,8 +324,8 @@ CONTENTS LDFLAGS=-L/usr/unsup/lib \ ./configure - HDF5 includes Szip as a predefined compression method (see 3.2). - To enable Szip compression, the HDF5 library must be configured + HDF5 includes Szip as a predefined compression method (see 3.2). + To enable Szip compression, the HDF5 library must be configured and built using the Szip library: $ ./configure --with-szlib=/Szip_Install_Directory @@ -350,10 +350,10 @@ CONTENTS The library can be compiled to provide symbolic debugging support so it can be debugged with gdb, dbx, ddd, etc., or it can be compiled with various optimizations. To compile for symbolic - debugging (the default for snapshots), say - `--enable-build-mode=production'; to compile with optimizations - (the default for supported public releases), - say `--enable-build-mode=production'. On some systems the + debugging (the default for snapshots), say + `--enable-build-mode=production'; to compile with optimizations + (the default for supported public releases), + say `--enable-build-mode=production'. On some systems the library can also be compiled for profiling with gprof by saying `--enable-production=profile'. @@ -362,13 +362,13 @@ CONTENTS $ ./configure --enable-production=profile #for use with gprof Regardless of whether support for symbolic debugging is enabled, - the library can also perform runtime debugging of certain packages - (such as type conversion execution times and extensive invariant - condition checking). To enable this debugging, supply a - comma-separated list of package names to the `--enable-internal-debug' - switch. + the library can also perform runtime debugging of certain packages + (such as type conversion execution times and extensive invariant + condition checking). To enable this debugging, supply a + comma-separated list of package names to the `--enable-internal-debug' + switch. - Debugging can be disabled by saying `--disable-internal-debug'. + Debugging can be disabled by saying `--disable-internal-debug'. The default debugging level for snapshots is a subset of the available packages; the default for supported releases is no debugging (debugging can incur a significant runtime penalty). @@ -378,10 +378,10 @@ CONTENTS $ ./configure --enable-internal-debug=all #debug all packages $ ./configure --disable-internal-debug #no debugging - HDF5 can also print a trace of all API function calls, their + HDF5 can also print a trace of all API function calls, their arguments, and the return values. To enable or disable the ability to trace the API say `--enable-trace' (the default for - snapthots) or `--disable-trace' (the default for public releases). + snapthots) or `--disable-trace' (the default for public releases). The tracing must also be enabled at runtime to see any output. 4.3.9. Parallel versus serial library @@ -389,25 +389,39 @@ CONTENTS parallelism on a distributed multi-processor system. Read the file INSTALL_parallel for detailed information. + The threadsafe, C++ and Java interfaces are not compatible + with the parallel option. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-threadsafe, --enable-cxx, --enable-java + + 4.3.10. Threadsafe capability The HDF5 library can be configured to be thread-safe (on a very large scale) with the `--enable-threadsafe' flag to the configure script. Some platforms may also require the '-with-pthread=INC,LIB' (or '--with-pthread=DIR') flag to the configure script. - For further information, see: + For further information, see: https://portal.hdfgroup.org/display/knowledge/Questions+about+thread-safety+and+concurrent+access + The high-level, C++, Fortran and Java interfaces are not compatible + with the thread-safety option because the lock is not hoisted + into the higher-level API calls. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-hl, --enable-cxx, --enable-fortran, --enable-java + 4.3.11. Backward compatibility The 1.10 version of the HDF5 library can be configured to operate - identically to the v1.8 library with the + identically to the v1.8 library with the --with-default-api-version=v18 - configure flag, or identically to the v1.6 library with the + configure flag, or identically to the v1.6 library with the --with-default-api-version=v16 configure flag. This allows existing code to be compiled with the - v1.10 library without requiring immediate changes to the application - source code. For additional configuration options and other details, + v1.10 library without requiring immediate changes to the application + source code. For additional configuration options and other details, see "API Compatibility Macros": https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros @@ -487,7 +501,7 @@ CONTENTS $ make install prefix=NEW_DIR - where NEW_DIR is the new directory where you wish to install HDF5. + where NEW_DIR is the new directory where you wish to install HDF5. If you do not use the deploy script, you should run h5redeploy in NEW_DIR/bin directory. This utility will fix the h5cc, h5fc and h5c++ scripts to reflect the new NEW_DIR location. @@ -510,7 +524,7 @@ CONTENTS The configuration information: ./src/H5pubconf.h - + The support programs that are useful are: ./tools/h5ls/h5ls (list file contents) ./tools/h5dump/h5dump (dump file contents) @@ -518,12 +532,12 @@ CONTENTS ./tools/misc/h5debug (low-level file debugging) ./tools/h5import/h5import (imports data to HDF5 file) ./tools/h5diff/h5diff (compares two HDF5 files) - ./tools/gifconv/h52gif (HDF5 to GIF converter) + ./tools/gifconv/h52gif (HDF5 to GIF converter) ./tools/gifconv/gif2h5 (GIF to HDF5 converter) 5. Using the Library - + For information on using HDF5 see the documentation, tutorials and examples found here: diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index ba77ac4..28afc16 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -652,6 +652,20 @@ NOTE: flag is not available on windows and some modern linux systems will ignore the flag. + ---------------- Unsupported Library Options --------------------- + The threadsafe, C++ and Java interfaces are not compatible + with the HDF5_ENABLE_PARALLEL option. + Unless ALLOW_UNSUPPORTED has been specified, + the following options must be disabled: + HDF5_ENABLE_THREADSAFE, HDF5_BUILD_CPP_LIB, HDF5_BUILD_JAVA + + The high-level, C++, Fortran and Java interfaces are not compatible + with the HDF5_ENABLE_THREADSAFE option because the lock is not hoisted + into the higher-level API calls. + Unless ALLOW_UNSUPPORTED has been specified, + the following options must be disabled: + HDF5_BUILD_HL_LIB, HDF5_BUILD_CPP_LIB, HDF5_BUILD_FORTRAN, HDF5_BUILD_JAVA + ======================================================================== VII. User Defined Options for HDF5 Libraries with CMake -- cgit v0.12 From c9771263ae300a65f6f9ae518da766a314002bed Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 5 Sep 2018 16:30:09 -0500 Subject: Minor text corrections --- release_docs/INSTALL_CMake.txt | 4 ++-- release_docs/USING_CMake_Examples.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 28afc16..1d6797c 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -492,7 +492,7 @@ These five steps are described in detail below. Release and build the solution. 3.2.1 The external libraries (zlib and szip) can be configured - to allow building the libraries by downloading from an GIT repository. + to allow building the libraries by downloading from a GIT repository. The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT'; by adding the following configuration option: -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT" @@ -509,7 +509,7 @@ These five steps are described in detail below. adding the following configuration option: -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" - The options to control the SVN URL (config/cmake/cacheinit.cmake + The options to control the TGZ URL (config/cmake/cacheinit.cmake file) are: ZLIB_TGZ_NAME:STRING="zlib_src.ext" SZIP_TGZ_NAME:STRING="szip_src.ext" diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index 6f744d9..d5fae39 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -46,7 +46,7 @@ Default installation process: Copy HDF5_Examples.cmake to this directory. The default source folder is defined as "HDF5Examples". It can be changed with the CTEST_SOURCE_NAME script option. - The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@". + The default installation folder is defined for the platform. It can be changed with the INSTALLDIR script option. (Note: Windows has issues with spaces and paths -The path will need to be set correctly.) -- cgit v0.12 From dfa58496a1f8d667de72a11affe0f5a2e3ae4558 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 17 Sep 2018 16:09:59 -0500 Subject: Update COPYING file with new HDF5 license. --- COPYING | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/COPYING b/COPYING index c668565..560e8c4 100644 --- a/COPYING +++ b/COPYING @@ -3,7 +3,7 @@ HDF5 (Hierarchical Data Format 5) Software Library and Utilities ----------------------------------------------------------------------------- HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright (c) 2006, The HDF Group. +Copyright (c) 2006-2018, The HDF Group. NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities Copyright (c) 1998-2006, The Board of Trustees of the University of Illinois. @@ -21,27 +21,27 @@ provided that the following conditions are met: this list of conditions, and the following disclaimer in the documentation and/or materials provided with the distribution. -3. In addition, redistributions of modified forms of the source or binary - code must carry prominent notices stating that the original code was - changed and the date of the change. - -4. All publications or advertising materials mentioning features or use of - this software are asked, but not required, to acknowledge that it was - developed by The HDF Group and by the National Center for Supercomputing - Applications at the University of Illinois at Urbana-Champaign and - credit the contributors. - -5. Neither the name of The HDF Group, the name of the University, nor the +3. Neither the name of The HDF Group, the name of the University, nor the name of any Contributor may be used to endorse or promote products derived from this software without specific prior written permission from The HDF Group, the University, or the Contributor, respectively. DISCLAIMER: THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS -"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no -event shall The HDF Group or the Contributors be liable for any damages -suffered by the users arising out of the use of this software, even if -advised of the possibility of such damage. +"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO +EVENT SHALL THE HDF GROUP OR THE CONTRIBUTORS BE LIABLE FOR ANY DAMAGES +SUFFERED BY THE USERS ARISING OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +You are under no obligation whatsoever to provide any bug fixes, patches, or +upgrades to the features, functionality or performance of the source code +("Enhancements") to anyone; however, if you choose to make your Enhancements +available either publicly, or directly to The HDF Group, without imposing a +separate written license agreement for such Enhancements, then you hereby +grant the following license: a non-exclusive, royalty-free perpetual license +to install, use, modify, prepare derivative works, incorporate into other +computer software, distribute, and sublicense such enhancements or derivative +works thereof, in binary and source code form. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- @@ -55,9 +55,9 @@ http://support.hdfgroup.org/ftp/HDF5/releases/COPYING_LBNL_HDF5. ----------------------------------------------------------------------------- Contributors: National Center for Supercomputing Applications (NCSA) at -the University of Illinois, Fortner Software, Unidata Program Center (netCDF), -The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler (gzip), -and Digital Equipment Corporation (DEC). +the University of Illinois, Fortner Software, Unidata Program Center +(netCDF), The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler +(gzip), and Digital Equipment Corporation (DEC). ----------------------------------------------------------------------------- @@ -98,8 +98,9 @@ and/or accompanying materials: ----------------------------------------------------------------------------- HDF5 is available with the SZIP compression library but SZIP is not part -of HDF5 and has separate copyright and license terms. See “Szip Compression -in HDF Products” (https://support.hdfgroup.org/doc_resource/SZIP/) for further details. +of HDF5 and has separate copyright and license terms. See SZIP Compression +in HDF Products (www.hdfgroup.org/doc_resource/SZIP/) for further details. ----------------------------------------------------------------------------- + -- cgit v0.12 From 99f743ed1abd9603a9ba903d578349fb4ade8f17 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 5 Sep 2018 16:37:49 -0500 Subject: HDFFV-9059 Allow detect to take a file as an argument --- release_docs/RELEASE.txt | 11 +- src/CMakeLists.txt | 12 +- src/H5detect.c | 707 +++++++++++++++++++++-------------------------- src/H5make_libsettings.c | 254 ++++++++--------- 4 files changed, 468 insertions(+), 516 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 5150349..c8c7d5c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -148,7 +148,7 @@ New Features Java Library: ---------------- - JNI native library dependencies - + The build for the hdf5_java native library used the wrong hdf5 target library for CMake builds. Correcting the hdf5_java library to build with the shared hdf5 library required testing @@ -209,6 +209,15 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Allow H5detect and H5make_libsettings to take a file as an argument. + + Rather than only writing to stdout, add a command argument to name + the file that H5detect and H5make_libsettings will use for output. + Without an argument, stdout is still used, so backwards compatibility + is maintained. + + (ADB - 2018/09/05, HDFFV-9059) + - A bug was discovered in the parallel library where an application would hang if a collective read/write of a chunked dataset occurred when collective metadata reads were enabled and some of the ranks diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c5526f..ee06f06 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -854,7 +854,7 @@ endif () # specific type checks inside #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect @@ -865,12 +865,12 @@ target_link_libraries (H5detect add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c + ARGS ${HDF5_BINARY_DIR}/H5Tinit.c DEPENDS H5detect ) add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings @@ -881,7 +881,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c + ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) @@ -925,14 +925,14 @@ if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c + ARGS ${HDF5_BINARY_DIR}/shared/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared ) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) diff --git a/src/H5detect.c b/src/H5detect.c index 2d33a3d..c2d8ab0 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -45,8 +45,6 @@ static const char *FileHeader = "\n\ * running on a Vax or other machine with mixed * endianness. * - * Modifications: - * *------------------------------------------------------------------------- */ #undef NDEBUG @@ -117,6 +115,8 @@ typedef struct malign_t { unsigned int comp_align; /* alignment for structure */ } malign_t; +FILE *rawoutstream = NULL; + /* global variables types detection code */ H5_GCC_DIAG_OFF(larger-than=) static detected_t d_g[MAXDETECT]; @@ -143,9 +143,9 @@ static void detect_C99_integers32(void); static void detect_C99_integers64(void); static void detect_alignments(void); static unsigned int align_g[] = {1, 2, 4, 8, 16}; -static int align_status_g = 0; /* ALIGNMENT Signal Status */ +static int align_status_g = 0; /* ALIGNMENT Signal Status */ static int sigbus_handler_called_g = 0; /* how many times called */ -static int sigsegv_handler_called_g = 0;/* how many times called */ +static int sigsegv_handler_called_g = 0; /* how many times called */ static int sigill_handler_called_g = 0; /* how many times called */ static int signal_handler_tested_g = 0; /* how many times tested */ #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) @@ -157,16 +157,11 @@ static H5JMP_BUF jbuf_g; /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * * Purpose: Determine the precision and offset. * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, June 18, 1998 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -189,7 +184,8 @@ precision (detected_t *d) /*void*/; d->precision = 8 * (d->size - n); d->offset = 0; - } else if (d->perm[d->size - 1] < 0) { + } + else if (d->perm[d->size - 1] < 0) { /* * Higher addresses are padded. */ @@ -197,14 +193,16 @@ precision (detected_t *d) /*void*/; d->precision = 8 * (d->size - n); d->offset = 8 * n; - } else { + } + else { /* * No padding. */ d->precision = 8 * d->size; d->offset = 0; } - } else { + } + else { /* A floating point */ d->offset = MIN3(d->mpos, d->epos, d->sign); d->precision = d->msize + d->esize + 1; @@ -213,20 +211,16 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * - * DETECT_I is used for types that are larger than one byte, - * DETECT_BYTE is used for types that are exactly one byte. + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 + * Return: void * * Modifications: * @@ -244,7 +238,7 @@ precision (detected_t *d) * * Neil Fortner, 6 Sep 2013 * Split macro into DETECT_I and DETECT_BYTE macros, extracted - * common cod einto DETECT_I_BYTE_CORE. This was done to remove + * common code into DETECT_I_BYTE_CORE. This was done to remove * "will never be executed" warnings. * *------------------------------------------------------------------------- @@ -291,19 +285,15 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_F + * 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. + * 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. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 + * Return: void * *------------------------------------------------------------------------- */ @@ -395,19 +385,13 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_M + * Function: DETECT_M * * Purpose: This macro takes only miscellaneous structures or pointer - * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It + * constructs the names and decides the alignment in structure. * - * Return: void - * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Dec 9, 2002 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -477,19 +461,14 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigsegv_handler + * Function: sigsegv_handler * * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. - * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Modifications: + * Return: Returns via H5LONGJMP to jbuf_g. * *------------------------------------------------------------------------- */ @@ -553,17 +532,14 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Programmer: Raymond Lu - * 28 October 2013 + * Return: Returns via H5LONGJMP to jbuf_g. * *------------------------------------------------------------------------- */ @@ -588,17 +564,11 @@ sigill_handler(int H5_ATTR_UNUSED signo) /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * * Purpose: Prints information about the detected data types. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 14, 1996 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -609,7 +579,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) int i, j; /* Include files */ - printf("\ + fprintf(rawoutstream, "\ /****************/\n\ /* Module Setup */\n\ /****************/\n\ @@ -662,7 +632,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /*********************/\n\ \n\ \n"); - printf("\n\ + fprintf(rawoutstream, "\n\ /*******************/\n\ /* Local Variables */\n\ /*******************/\n\ @@ -670,7 +640,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /* The interface initialization function */ - printf("\n\ + fprintf(rawoutstream, "\n\ \n\ /*-------------------------------------------------------------------------\n\ * Function: H5T__init_native\n\ @@ -713,12 +683,12 @@ H5T__init_native(void)\n\ } /* Print a comment to describe this section of definitions. */ - printf("\n /*\n"); + fprintf(rawoutstream, "\n /*\n"); iprint(d+i); - printf(" */\n"); + fprintf(rawoutstream, " */\n"); /* The part common to fixed and floating types */ - printf("\ + 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\ @@ -728,16 +698,16 @@ H5T__init_native(void)\n\ d[i].size); /*size */ if(byte_order==-1) - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_VAX;\n"); else if(byte_order==0) - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_LE;\n"); else - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_BE;\n"); - printf("\ + 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\ @@ -748,12 +718,13 @@ H5T__init_native(void)\n\ if (0 == d[i].msize) { /* The part unique to fixed point types */ - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n", d[i].sign ? "2" : "NONE"); - } else { + } + else { /* The part unique to floating point types */ - printf("\ + 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\ @@ -772,11 +743,11 @@ H5T__init_native(void)\n\ } /* Atomize the type */ - printf("\ + 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); - printf(" H5T_NATIVE_%s_ALIGN_g = %lu;\n", + fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname, (unsigned long)(d[i].align)); /* Variables for alignment of compound datatype */ @@ -784,28 +755,29 @@ H5T__init_native(void)\n\ !HDstrcmp(d[i].varname, "INT") || !HDstrcmp(d[i].varname, "LONG") || !HDstrcmp(d[i].varname, "LLONG") || !HDstrcmp(d[i].varname, "FLOAT") || !HDstrcmp(d[i].varname, "DOUBLE") || !HDstrcmp(d[i].varname, "LDOUBLE")) { - printf(" H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n", + fprintf(rawoutstream, " H5T_NATIVE_%s_COMP_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) { - printf("\n\ + fprintf(rawoutstream, "\n\ /* Set the native order for this machine */\n\ H5T_native_order_g = H5T_ORDER_%s;\n", "LE"); - } else { - printf("\n\ + } + else { + fprintf(rawoutstream, "\n\ /* Set the native order for this machine */\n\ H5T_native_order_g = H5T_ORDER_%s;\n", "BE"); } /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */ - printf("\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n"); + fprintf(rawoutstream, "\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n"); for(j=0; jsize - 1); i >= pass * 4; --i) { - printf("%4d", d->perm[i]); - if (i > pass * 4) HDfputs(" ", stdout); - if (!i) break; + fprintf(rawoutstream, "%4d", d->perm[i]); + if (i > pass * 4) + HDfputs(" ", stdout); + if (!i) + break; } /* * Print the bit fields */ - printf("\n * "); + 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 && d->msize) { - HDputchar('S'); - } else if (k >= d->epos && k < d->epos + d->esize) { - HDputchar('E'); - } else if (k >= d->mpos && k < d->mpos + d->msize) { - HDputchar('M'); - } else if (d->msize) { - HDputchar('?'); /*unknown floating point bit */ - } else if (d->sign) { - HDputchar('I'); - } else { - HDputchar('U'); + HDfputc('S', rawoutstream); + } + else if (k >= d->epos && k < d->epos + d->esize) { + HDfputc('E', rawoutstream); + } + else if (k >= d->mpos && k < d->mpos + d->msize) { + HDfputc('M', rawoutstream); + } + else if (d->msize) { + HDfputc('?', rawoutstream); /*unknown floating point bit */ + } + else if (d->sign) { + HDfputc('I', rawoutstream); + } + else { + HDfputc('U', rawoutstream); } --k; } - if (i > pass * 4) HDputchar(' '); + if (i > pass * 4) HDfputc(' ', rawoutstream); if (!i) break; } - HDputchar('\n'); + HDfputc('\n', rawoutstream); if (!pass) break; } @@ -939,40 +911,35 @@ iprint(detected_t *d) * Is there an implicit bit in the mantissa. */ if (d->msize) { - printf(" * Implicit bit? %s\n", d->imp ? "yes" : "no"); + fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /* * Alignment */ if (0 == d->align) { - printf(" * Alignment: NOT CALCULATED\n"); - } else if (1 == d->align) { - printf(" * Alignment: none\n"); - } else { - printf(" * Alignment: %lu\n", (unsigned long) (d->align)); + fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n"); + } + else if (1 == d->align) { + fprintf(rawoutstream, " * Alignment: none\n"); + } + else { + fprintf(rawoutstream, " * Alignment: %lu\n", (unsigned long) (d->align)); } } /*------------------------------------------------------------------------- - * Function: byte_cmp + * 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. + * 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. - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 - * - * Modifications: + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. * *------------------------------------------------------------------------- */ @@ -992,15 +959,15 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) /*------------------------------------------------------------------------- - * Function: bit_cmp + * 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. + * 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. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -1033,99 +1000,97 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, /*------------------------------------------------------------------------- - * Function: fix_order + * 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. + * 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. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * This function assumes that the mantissa byte ordering + * implies the total ordering. * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ static void fix_order(int n, int last, int *perm, const char **mesg) { - int i; + 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. + * We have at least three points to consider. */ - if (mesg) *mesg = "Little-endian"; - for (i = 0; i < n; i++) perm[i] = i; + 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 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) - */ - HDassert(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 { + /* + * 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) + */ + HDassert(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); - HDexit(1); + else { + fprintf(stderr, + "Failed to detect byte order of %d-byte floating point.\n", n); + HDexit(1); } } /*------------------------------------------------------------------------- - * Function: imp_bit + * 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. + * 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. + * 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 + * 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: exit(1) - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Failure: exit(1) * * Modifications: * @@ -1162,18 +1127,13 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ /*------------------------------------------------------------------------- - * Function: find_bias + * Function: find_bias * * Purpose: Determines the bias of the exponent. This function should - * be called with _A having a value of `1'. + * be called with _A having a value of `1'. * - * Return: Success: The exponent bias. - * - * Failure: - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Return: Success: The exponent bias. + * Failure: * * Modifications: * @@ -1205,17 +1165,11 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * * Purpose: Prints the C file header for the generated file. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Mar 12 1997 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1224,15 +1178,15 @@ 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; + 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; + int pwd = 1; #endif static const char *month_name[] = { @@ -1281,20 +1235,22 @@ bit.\n"; */ #ifdef H5_HAVE_GETPWUID { - size_t n; - char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); - real_name[n] = '\0'; - } else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); - real_name[sizeof(real_name) - 1] = '\0'; + size_t n; + char *comma; + if ((pwd = HDgetpwuid(HDgetuid()))) { + if ((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } + else { + HDstrncpy(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'; - } } #else real_name[0] = '\0'; @@ -1305,7 +1261,7 @@ bit.\n"; */ #ifdef H5_HAVE_GETHOSTNAME if (HDgethostname(host_name, sizeof(host_name)) < 0) { - host_name[0] = '\0'; + host_name[0] = '\0'; } #else host_name[0] = '\0'; @@ -1314,49 +1270,49 @@ bit.\n"; /* * The file header: warning, copyright notice, build information. */ - printf("/* Generated automatically by H5detect -- do not edit */\n\n\n"); - HDputs(FileHeader); /*the copyright notice--see top of this file */ + fprintf(rawoutstream, "/* Generated automatically by H5detect -- do not edit */\n\n\n"); + HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ - printf(" *\n * Created:\t\t%s %2d, %4d\n", + 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]) { - printf(" *\t\t\t"); - if (real_name[0]) printf("%s <", real_name); + fprintf(rawoutstream, " *\t\t\t"); + if (real_name[0]) + fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, stdout); + if (pwd) HDfputs(pwd->pw_name, rawoutstream); #endif - if (host_name[0]) printf("@%s", host_name); - if (real_name[0]) printf(">"); - HDputchar('\n'); + if (host_name[0]) + fprintf(rawoutstream, "@%s", host_name); + if (real_name[0]) + fprintf(rawoutstream, ">"); + HDfputc('\n', rawoutstream); } - printf(" *\n * Purpose:\t\t"); + fprintf(rawoutstream, " *\n * Purpose:\t\t"); for (s = purpose; *s; s++) { - HDputchar(*s); - if ('\n' == *s && s[1]) printf(" *\t\t\t"); + HDfputc(*s, rawoutstream); + if ('\n' == *s && s[1]) + fprintf(rawoutstream, " *\t\t\t"); } - printf(" *\n * Modifications:\n *\n"); - printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); - printf(" *\tIt was generated by code in `H5detect.c'.\n"); + fprintf(rawoutstream, " *\n * Modifications:\n *\n"); + fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n"); - printf(" *\n *"); - for (i = 0; i < 73; i++) HDputchar('-'); - printf("\n */\n\n"); + fprintf(rawoutstream, " *\n *"); + for (i = 0; i < 73; i++) + HDfputc('-', rawoutstream); + fprintf(rawoutstream, "\n */\n\n"); } /*------------------------------------------------------------------------- - * Function: detect_C89_integers + * Function: detect_C89_integers * * Purpose: Detect C89 integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1375,16 +1331,11 @@ detect_C89_integers(void) /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * * Purpose: Detect C89 floating point types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1397,16 +1348,11 @@ detect_C89_floats(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 + * Function: detect_C99_integers8 * * Purpose: Detect C99 8 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1459,16 +1405,11 @@ detect_C99_integers8(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 + * Function: detect_C99_integers16 * * Purpose: Detect C99 16 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1497,16 +1438,11 @@ detect_C99_integers16(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * * Purpose: Detect C99 32 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1535,16 +1471,11 @@ detect_C99_integers32(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * * Purpose: Detect C99 64 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1586,16 +1517,11 @@ detect_C99_integers64(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers + * Function: detect_C99_integers * * Purpose: Detect C99 integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1612,16 +1538,11 @@ detect_C99_integers(void) /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * * Purpose: Detect C99 floating point types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1643,16 +1564,11 @@ detect_C99_floats(void) /*------------------------------------------------------------------------- - * Function: detect_alignments + * Function: detect_alignments * * Purpose: Detect structure alignments * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1685,61 +1601,57 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) #endif void (*save_handler)(int) = HDsignal(signum, handler); volatile int i, val; - int ntries=5; - volatile int nfailures=0; - volatile int nsuccesses=0; - - for (i=0;i0 || nsuccesses != ntries){ - fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " - "Found %d failures and %d successes\n", - signum, ntries, nfailures, nsuccesses); - return(-1); - }else{ - /* all succeeded */ - return(0); + if (nfailures>0 || nsuccesses != ntries) { + fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " + "Found %d failures and %d successes\n", + signum, ntries, nfailures, nsuccesses); + return(-1); + } + else { + /* all succeeded */ + return(0); } } #endif /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * * Return: Success: exit(0) * - * Failure: exit(1) - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 + * Failure: exit(1) * * Modifications: - * Albert Cheng, 2004/05/20 - * Some compilers, e.g., Intel C v7.0, took a long time to compile + * Some compilers, e.g., Intel C v7.0, took a long time to compile * with optimization when a module routine contains many code lines. * Divide up all those types detections macros into subroutines, both * to avoid the compiler optimization error and cleaner codes. @@ -1747,8 +1659,24 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) *------------------------------------------------------------------------- */ int HDF_NO_UBSAN -main(void) +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 = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + } + } + if (!rawoutstream) + rawoutstream = stdout; #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) #if defined(UAC_NOPRINT) && defined(UAC_SIGBUS) @@ -1760,7 +1688,7 @@ main(void) nvpairs[0] = SSIN_UACPROC; nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { - fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", + fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); } #endif @@ -1803,5 +1731,12 @@ main(void) print_results (nd_g, d_g, na_g, m_g); + if (rawoutstream && rawoutstream != stdout) { + if (HDfclose(rawoutstream)) + fprintf(stderr, "closing rawoutstream"); + else + rawoutstream = NULL; + } + return 0; } diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index 1892806..d803d07 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -27,12 +27,12 @@ static const char *FileHeader = "\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* * - * Created: H5make_libsettings.c - * 17 Mar 2010 - * Quincey Koziol + * Created: H5make_libsettings.c + * 17 Mar 2010 + * Quincey Koziol * - * Purpose: Generate the H5libsettings.c file from the - * libhdf5.settings file. + * Purpose: Generate the H5libsettings.c file from the + * libhdf5.settings file. * *------------------------------------------------------------------------- */ @@ -43,19 +43,18 @@ static const char *FileHeader = "\n\ #define LIBSETTINGSFNAME "libhdf5.settings" - +FILE *rawoutstream = NULL; + + /*------------------------------------------------------------------------- - * Function: insert_libhdf5_settings + * Function: insert_libhdf5_settings * - * Purpose: insert the contents of libhdf5.settings into a file - * represented by flibinfo. - * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not - * defined, i.e., not enabled. + * Purpose: insert the contents of libhdf5.settings into a file + * represented by flibinfo. + * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not + * defined, i.e., not enabled. * - * Return: void - * - * Programmer: Albert Cheng - * Apr 20, 2009 + * Return: void * *------------------------------------------------------------------------- */ @@ -63,9 +62,9 @@ static void insert_libhdf5_settings(FILE *flibinfo) { #ifdef H5_HAVE_EMBEDDED_LIBINFO - FILE *fsettings; /* for files libhdf5.settings */ + FILE *fsettings; /* for files libhdf5.settings */ int inchar; - int bol = 0; /* indicates the beginning of a new line */ + int bol = 0; /* indicates the beginning of a new line */ if(NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) { HDperror(LIBSETTINGSFNAME); @@ -77,33 +76,33 @@ insert_libhdf5_settings(FILE *flibinfo) fprintf(flibinfo, "char H5libhdf5_settings[]=\n"); bol++; while(EOF != (inchar = HDgetc(fsettings))) { - if(bol) { - /* Start a new line */ - fprintf(flibinfo, "\t\""); - bol = 0; - } /* end if */ - if(inchar == '\n') { - /* end of a line */ - fprintf(flibinfo, "\\n\"\n"); - bol++; + if(bol) { + /* Start a new line */ + fprintf(flibinfo, "\t\""); + bol = 0; + } /* end if */ + if(inchar == '\n') { + /* end of a line */ + fprintf(flibinfo, "\\n\"\n"); + bol++; } /* end if */ - else - HDputc(inchar, flibinfo); + else + HDputc(inchar, flibinfo); } /* end while */ if(HDfeof(fsettings)) { - /* wrap up */ - if(!bol) - /* EOF found without a new line */ - fprintf(flibinfo, "\\n\"\n"); - fprintf(flibinfo, ";\n\n"); + /* wrap up */ + if(!bol) + /* EOF found without a new line */ + fprintf(flibinfo, "\\n\"\n"); + fprintf(flibinfo, ";\n\n"); } /* end if */ else { - fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); - HDexit(1); + fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); + HDexit(1); } /* end else */ if(0 != HDfclose(fsettings)) { - HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDperror(LIBSETTINGSFNAME); + HDexit(1); } /* end if */ #else /* print variable definition and an empty string */ @@ -112,18 +111,15 @@ insert_libhdf5_settings(FILE *flibinfo) #endif } /* insert_libhdf5_settings() */ - + /*------------------------------------------------------------------------- - * Function: make_libinfo - * - * Purpose: Create the embedded library information definition. - * This sets up for a potential extension that the declaration - * is printed to a file different from stdout. + * Function: make_libinfo * - * Return: void + * Purpose: Create the embedded library information definition. + * This sets up for a potential extension that the declaration + * is printed to a file different from stdout. * - * Programmer: Albert Cheng - * Sep 15, 2009 + * Return: void * *------------------------------------------------------------------------- */ @@ -131,42 +127,38 @@ static void make_libinfo(void) { /* print variable definition and then the string as a macro. */ - insert_libhdf5_settings(stdout); + insert_libhdf5_settings(rawoutstream); } - + /*------------------------------------------------------------------------- - * Function: print_header - * - * Purpose: Prints the header for the generated file. + * Function: print_header * - * Return: void + * Purpose: Prints the header for the generated file. * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Mar 12 1997 + * 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; + 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; + struct passwd *pwd = NULL; #else - int pwd = 1; + int pwd = 1; #endif - static const char *month_name[] = + static const char *month_name[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - static const char *purpose = "\ + "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 library build configuration\n"; @@ -175,22 +167,22 @@ information about the library build configuration\n"; */ #ifdef H5_HAVE_GETPWUID { - size_t n; - char *comma; + size_t n; + char *comma; - if((pwd = HDgetpwuid(HDgetuid()))) { - if((comma = HDstrchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); - real_name[n] = '\0'; - } /* end if */ + if((pwd = HDgetpwuid(HDgetuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } /* end if */ else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); - real_name[sizeof(real_name) - 1] = '\0'; - } /* end else */ - } /* end if */ + HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + real_name[sizeof(real_name) - 1] = '\0'; + } /* end else */ + } /* end if */ else - real_name[0] = '\0'; + real_name[0] = '\0'; } #else real_name[0] = '\0'; @@ -201,7 +193,7 @@ information about the library build configuration\n"; */ #ifdef H5_HAVE_GETHOSTNAME if(HDgethostname(host_name, sizeof(host_name)) < 0) - host_name[0] = '\0'; + host_name[0] = '\0'; #else host_name[0] = '\0'; #endif @@ -209,53 +201,49 @@ information about the library build configuration\n"; /* * The file header: warning, copyright notice, build information. */ - printf("/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); - HDputs(FileHeader); /*the copyright notice--see top of this file */ + fprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); + HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ - printf(" *\n * Created:\t\t%s %2d, %4d\n", - month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); + 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]) { - printf(" *\t\t\t"); - if(real_name[0]) - printf("%s <", real_name); + fprintf(rawoutstream, " *\t\t\t"); + if(real_name[0]) + fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if(pwd) - HDfputs(pwd->pw_name, stdout); + if(pwd) + HDfputs(pwd->pw_name, rawoutstream); #endif - if(host_name[0]) - printf("@%s", host_name); - if(real_name[0]) - printf(">"); - HDputchar('\n'); + if(host_name[0]) + fprintf(rawoutstream, "@%s", host_name); + if(real_name[0]) + fprintf(rawoutstream, ">"); + HDfputc('\n', rawoutstream); } /* end if */ - printf(" *\n * Purpose:\t\t"); + fprintf(rawoutstream, " *\n * Purpose:\t\t"); for(s = purpose; *s; s++) { - HDputchar(*s); - if('\n' == *s && s[1]) - printf(" *\t\t\t"); + HDfputc(*s, rawoutstream); + if('\n' == *s && s[1]) + fprintf(rawoutstream, " *\t\t\t"); } /* end for */ - printf(" *\n * Modifications:\n *\n"); - printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); - printf(" *\tIt was generated by code in `H5make_libsettings.c'.\n"); + fprintf(rawoutstream, " *\n * Modifications:\n *\n"); + fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + fprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n"); - printf(" *\n *"); + fprintf(rawoutstream, " *\n *"); for(i = 0; i < 73; i++) - HDputchar('-'); - printf("\n */\n\n"); + HDfputc('-', rawoutstream); + fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- - * Function: print_footer - * - * Purpose: Prints the file footer for the generated file. + * Function: print_footer * - * Return: void + * Purpose: Prints the file footer for the generated file. * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 31 2010 + * Return: void * *------------------------------------------------------------------------- */ @@ -265,24 +253,37 @@ print_footer(void) /* nothing */ } - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * - * Return: Success: exit(0) - * - * Failure: exit(1) - * - * Programmer: Albert Cheng - * 2010/4/1 + * Return: Success: exit(0) + * Failure: exit(1) * *------------------------------------------------------------------------- */ int -main(void) +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 = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + } + } + if (!rawoutstream) + rawoutstream = stdout; + print_header(); /* Generate embedded library information variable definition */ @@ -290,5 +291,12 @@ main(void) print_footer(); + if (rawoutstream && rawoutstream != stdout) { + if (HDfclose(rawoutstream)) + fprintf(stderr, "closing rawoutstream"); + else + rawoutstream = NULL; + } + HDexit(0); } -- cgit v0.12 From 595b2d54ed34ee8b8502dbb162a2994f177b4a2c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 18 Sep 2018 12:35:17 -0500 Subject: HDFFV-9059 take file as argument --- src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index a0defad..bc5c09e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -153,7 +153,7 @@ settings_DATA=libhdf5.settings H5Tinit.c: H5detect$(EXEEXT) LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5detect$(EXEEXT) > $@ || \ + $(RUNSERIAL) ./H5detect$(EXEEXT) $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) @@ -165,7 +165,7 @@ H5Tinit.c: H5detect$(EXEEXT) H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@ || \ + $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) -- cgit v0.12 From 6c78869c19a88edfd7b6a2a99a8fb8f5febf0b7a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 18 Sep 2018 13:22:48 -0500 Subject: Fix whitespace and exit status --- src/H5detect.c | 443 ++++++++++++++++++++++------------------------- src/H5make_libsettings.c | 60 +++---- 2 files changed, 227 insertions(+), 276 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index c2d8ab0..aac58de 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -26,11 +26,6 @@ static const char *FileHeader = "\n\ * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* - * - * Created: H5detect.c - * 10 Aug 1997 - * Robb Matzke - * * Purpose: This code was borrowed heavily from the `detect.c' * program in the AIO distribution from Lawrence * Livermore National Laboratory. @@ -44,7 +39,6 @@ static const char *FileHeader = "\n\ * features which aren't available. We're not * running on a Vax or other machine with mixed * endianness. - * *------------------------------------------------------------------------- */ #undef NDEBUG @@ -157,12 +151,11 @@ static H5JMP_BUF jbuf_g; /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * - * Purpose: Determine the precision and offset. - * - * Return: void + * Purpose: Determine the precision and offset. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -211,16 +204,16 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * - * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * Purpose: These macro takes a type like `int' and a base name like + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * - * DETECT_I is used for types that are larger than one byte, - * DETECT_BYTE is used for types that are exactly one byte. + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void + * Return: void * * Modifications: * @@ -285,16 +278,13 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * 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. - * - * Return: void + * 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) { \ @@ -385,14 +375,13 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_M - * - * Purpose: This macro takes only miscellaneous structures or pointer - * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * Function: DETECT_M * - * Return: void + * Purpose: This macro takes only miscellaneous structures or pointer + * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It + * constructs the names and decides the alignment in structure. * + * Return: void *------------------------------------------------------------------------- */ #define DETECT_M(TYPE,VAR,INFO) { \ @@ -422,29 +411,29 @@ precision (detected_t *d) _buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \ if(H5SETJMP(jbuf_g)) _ano++; \ if(_ano < NELMTS(align_g)) { \ - *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ - /* Cray Check: This section helps detect alignment on Cray's */ \ + *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ + /* Cray Check: This section helps detect alignment on Cray's */ \ /* vector machines (like the SV1) which mask off */ \ - /* pointer values when pointing to non-word aligned */ \ - /* locations with pointers that are supposed to be */ \ - /* word aligned. -QAK */ \ - HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ - /*How to handle VAX types?*/ \ - if(INFO.perm[0]) /* Big-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ - else /* Little-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); \ - H5_GCC_DIAG_OFF(float-equal) \ - if(_val!=_val2) \ - H5LONGJMP(jbuf_g, 1); \ - H5_GCC_DIAG_ON(float-equal) \ - /* End Cray Check */ \ - (INFO.align)=align_g[_ano]; \ + /* pointer values when pointing to non-word aligned */ \ + /* locations with pointers that are supposed to be */ \ + /* word aligned. -QAK */ \ + HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ + /*How to handle VAX types?*/ \ + if(INFO.perm[0]) /* Big-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ + else /* Little-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); \ + H5_GCC_DIAG_OFF(float-equal) \ + if(_val!=_val2) \ + H5LONGJMP(jbuf_g, 1); \ + H5_GCC_DIAG_ON(float-equal) \ + /* End Cray Check */ \ + (INFO.align)=align_g[_ano]; \ } else { \ (INFO.align)=0; \ - fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ + fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ } \ HDfree(_buf); \ HDsignal(SIGBUS, _handler); /*restore original handler*/ \ @@ -461,15 +450,14 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigsegv_handler - * - * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Function: sigsegv_handler * - * Return: Returns via H5LONGJMP to jbuf_g. + * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -494,20 +482,14 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigbus_handler + * Function: sigbus_handler * - * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * * Return: Returns via H5LONGJMP to jbuf_g. - * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -532,15 +514,14 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * - * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -564,12 +545,11 @@ sigill_handler(int H5_ATTR_UNUSED signo) /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * - * Purpose: Prints information about the detected data types. - * - * Return: void + * Purpose: Prints information about the detected data types. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -844,12 +824,12 @@ done:\n\ /*------------------------------------------------------------------------- - * Function: iprint - * - * Purpose: Prints information about the fields of a floating point format. + * Function: iprint * - * Return: void + * Purpose: Prints information about the fields of a floating point format. * + * Return: void + *------------------------------------------------------------------------- */ static void @@ -931,16 +911,15 @@ iprint(detected_t *d) /*------------------------------------------------------------------------- - * Function: byte_cmp + * 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. + * 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 @@ -959,15 +938,15 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) /*------------------------------------------------------------------------- - * Function: bit_cmp + * 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. + * 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. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -1000,33 +979,32 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, /*------------------------------------------------------------------------- - * 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. + * Function: fix_order * - * This function assumes that the mantissa byte ordering - * implies the total ordering. + * 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. * - * Return: void + * 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; + int i; if (last > 1) { /* - * We have at least three points to consider. - */ + * We have at least three points to consider. + */ if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { /* - * Little endian. - */ + * Little endian. + */ if (mesg) *mesg = "Little-endian"; for (i = 0; i < n; i++) @@ -1036,8 +1014,8 @@ fix_order(int n, int last, int *perm, const char **mesg) else if (perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { /* - * Big endian. - */ + * Big endian. + */ if (mesg) *mesg = "Big-endian"; for (i = 0; i < n; i++) @@ -1046,11 +1024,11 @@ fix_order(int n, int last, int *perm, const char **mesg) } 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) - */ + * 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) + */ HDassert(0 == n % 2); if (mesg) *mesg = "VAX"; @@ -1062,39 +1040,38 @@ fix_order(int n, int last, int *perm, const char **mesg) } else { fprintf(stderr, - "Failed to detect byte order of %d-byte floating point.\n", n); + "Failed to detect byte order of %d-byte floating point.\n", n); HDexit(1); } } /*------------------------------------------------------------------------- - * Function: imp_bit + * 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. + * 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. + * 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 + * 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: exit(1) * - * Modifications: + * Failure: 1 * - * Robb Matzke, 6 Nov 1996 + * Modifications: * Fixed a bug that occurs with non-implicit architectures. * *------------------------------------------------------------------------- @@ -1127,17 +1104,14 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ /*------------------------------------------------------------------------- - * Function: find_bias + * Function: find_bias * - * Purpose: Determines the bias of the exponent. This function should - * be called with _A having a value of `1'. + * Purpose: Determines the bias of the exponent. This function should + * be called with _A having a value of `1'. * - * Return: Success: The exponent bias. - * Failure: + * Return: The exponent bias. * * Modifications: - * - * Robb Matzke, 6 Nov 1996 * Fixed a bug with non-implicit architectures returning the * wrong exponent bias. * @@ -1165,28 +1139,27 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * - * Purpose: Prints the C file header for the generated file. - * - * Return: void + * 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; + 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; + struct passwd *pwd = NULL; #else - int pwd = 1; + int pwd = 1; #endif static const char *month_name[] = { @@ -1280,7 +1253,7 @@ bit.\n"; if (real_name[0]) fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, rawoutstream); + if (pwd) HDfputs(pwd->pw_name, rawoutstream); #endif if (host_name[0]) fprintf(rawoutstream, "@%s", host_name); @@ -1308,35 +1281,33 @@ bit.\n"; /*------------------------------------------------------------------------- - * Function: detect_C89_integers - * - * Purpose: Detect C89 integer types + * Function: detect_C89_integers * - * Return: void + * Purpose: Detect C89 integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN detect_C89_integers(void) { - DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; - DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; - DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; - DETECT_I(int, INT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; - DETECT_I(long, LONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; + DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; + DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; + DETECT_I(int, INT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; + DETECT_I(long, LONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; } /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * - * Purpose: Detect C89 floating point types - * - * Return: void + * Purpose: Detect C89 floating point types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1348,12 +1319,11 @@ detect_C89_floats(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 - * - * Purpose: Detect C99 8 bit integer types + * Function: detect_C99_integers8 * - * Return: void + * Purpose: Detect C99 8 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1361,56 +1331,55 @@ detect_C99_integers8(void) { #if H5_SIZEOF_INT8_T>0 #if H5_SIZEOF_INT8_T==1 - DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; #else - DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; + DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT8_T>0 #if H5_SIZEOF_UINT8_T==1 - DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; + DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_INT_LEAST8_T>0 #if H5_SIZEOF_INT_LEAST8_T==1 - DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_LEAST8_T>0 #if H5_SIZEOF_UINT_LEAST8_T==1 - DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_INT_FAST8_T>0 #if H5_SIZEOF_INT_FAST8_T==1 - DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #else DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_FAST8_T>0 #if H5_SIZEOF_UINT_FAST8_T==1 - DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #endif #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 - * - * Purpose: Detect C99 16 bit integer types + * Function: detect_C99_integers16 * - * Return: void + * Purpose: Detect C99 16 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1420,30 +1389,29 @@ detect_C99_integers16(void) DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT16_T>0 - DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; + DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST16_T>0 - DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST16_T>0 - DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST16_T>0 - DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST16_T>0 - DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * - * Purpose: Detect C99 32 bit integer types - * - * Return: void + * Purpose: Detect C99 32 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1453,29 +1421,29 @@ detect_C99_integers32(void) DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT32_T>0 - DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; + DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST32_T>0 - DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST32_T>0 - DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST32_T>0 - DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST32_T>0 - DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * - * Purpose: Detect C99 64 bit integer types + * Purpose: Detect C99 64 bit integer types * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -1486,24 +1454,24 @@ detect_C99_integers64(void) DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT64_T>0 - DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; + DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST64_T>0 - DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST64_T>0 - DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST64_T>0 - DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST64_T>0 - DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_LONG_LONG>0 DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; #else /* * This architecture doesn't support an integer type larger than `long' @@ -1511,18 +1479,17 @@ detect_C99_integers64(void) * `long long' is probably equivalent to `long' here anyway. */ DETECT_I(long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers - * - * Purpose: Detect C99 integer types + * Function: detect_C99_integers * - * Return: void + * Purpose: Detect C99 integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1538,12 +1505,11 @@ detect_C99_integers(void) /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * - * Purpose: Detect C99 floating point types - * - * Return: void + * Purpose: Detect C99 floating point types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1564,12 +1530,11 @@ detect_C99_floats(void) /*------------------------------------------------------------------------- - * Function: detect_alignments - * - * Purpose: Detect structure alignments + * Function: detect_alignments * - * Return: void + * Purpose: Detect structure alignments * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1615,11 +1580,11 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) nfailures++; } else { - if (val==signum){ + if (val==signum) { /* return from signum handler. Record a sucess. */ nsuccesses++; } - else{ + else { fprintf(stderr, "Unknown return value (%d) from H5SETJMP", val); nfailures++; } @@ -1629,13 +1594,13 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) HDsignal(signum, save_handler); if (nfailures>0 || nsuccesses != ntries) { fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " - "Found %d failures and %d successes\n", - signum, ntries, nfailures, nsuccesses); - return(-1); + "Found %d failures and %d successes\n", + signum, ntries, nfailures, nsuccesses); + return -1; } else { /* all succeeded */ - return(0); + return 0; } } #endif @@ -1646,12 +1611,10 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) * * Purpose: Main entry point. * - * Return: Success: exit(0) - * - * Failure: exit(1) + * Return: Success: 0 * * Modifications: - * Some compilers, e.g., Intel C v7.0, took a long time to compile + * Some compilers, e.g., Intel C v7.0, took a long time to compile * with optimization when a module routine contains many code lines. * Divide up all those types detections macros into subroutines, both * to avoid the compiler optimization error and cleaner codes. @@ -1738,5 +1701,5 @@ main(int argc, char *argv[]) rawoutstream = NULL; } - return 0; + return EXIT_SUCCESS; } diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index d803d07..d4caabb 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -26,11 +26,6 @@ static const char *FileHeader = "\n\ * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* - * - * Created: H5make_libsettings.c - * 17 Mar 2010 - * Quincey Koziol - * * Purpose: Generate the H5libsettings.c file from the * libhdf5.settings file. * @@ -45,17 +40,15 @@ static const char *FileHeader = "\n\ FILE *rawoutstream = NULL; - /*------------------------------------------------------------------------- - * Function: insert_libhdf5_settings - * - * Purpose: insert the contents of libhdf5.settings into a file - * represented by flibinfo. - * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not - * defined, i.e., not enabled. + * Function: insert_libhdf5_settings * - * Return: void + * Purpose: insert the contents of libhdf5.settings into a file + * represented by flibinfo. + * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not + * defined, i.e., not enabled. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -68,7 +61,7 @@ insert_libhdf5_settings(FILE *flibinfo) if(NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) { HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* print variable definition and the string */ @@ -98,11 +91,11 @@ insert_libhdf5_settings(FILE *flibinfo) } /* end if */ else { fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end else */ if(0 != HDfclose(fsettings)) { HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ #else /* print variable definition and an empty string */ @@ -113,14 +106,13 @@ insert_libhdf5_settings(FILE *flibinfo) /*------------------------------------------------------------------------- - * Function: make_libinfo + * Function: make_libinfo * - * Purpose: Create the embedded library information definition. - * This sets up for a potential extension that the declaration - * is printed to a file different from stdout. - * - * Return: void + * Purpose: Create the embedded library information definition. + * This sets up for a potential extension that the declaration + * is printed to a file different from stdout. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -132,12 +124,11 @@ make_libinfo(void) /*------------------------------------------------------------------------- - * Function: print_header - * - * Purpose: Prints the header for the generated file. + * Function: print_header * - * Return: void + * Purpose: Prints the header for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -239,12 +230,11 @@ information about the library build configuration\n"; /*------------------------------------------------------------------------- - * Function: print_footer + * Function: print_footer * - * Purpose: Prints the file footer for the generated file. - * - * Return: void + * Purpose: Prints the file footer for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -255,13 +245,11 @@ print_footer(void) /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Main entry point. + * Function: main * - * Return: Success: exit(0) - * Failure: exit(1) + * Purpose: Main entry point. * + * Return: Success: 0 *------------------------------------------------------------------------- */ int @@ -298,5 +286,5 @@ main(int argc, char *argv[]) rawoutstream = NULL; } - HDexit(0); + HDexit(EXIT_SUCCESS); } -- cgit v0.12 From 680cf4d946fd10d50e0f7acdc5bc93f91037fb4f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 18 Sep 2018 14:10:14 -0700 Subject: Removed 'VOL' versions of FUNC_ENTER macros as well as empty functions orginally intended to support the full SWMR feature. --- java/test/testfiles/JUnit-TestH5Edefault.txt | 14 +- src/H5A.c | 6 +- src/H5Adeprec.c | 2 +- src/H5Aint.c | 259 +++---------------- src/H5Apkg.h | 7 - src/H5D.c | 8 +- src/H5Dchunk.c | 8 +- src/H5Dint.c | 153 ++--------- src/H5Dio.c | 4 +- src/H5Dpkg.h | 3 - src/H5F.c | 27 +- src/H5Fefc.c | 4 +- src/H5Fint.c | 236 ++--------------- src/H5Fmount.c | 10 +- src/H5Fpkg.h | 7 +- src/H5G.c | 23 +- src/H5Gdeprec.c | 369 +++++---------------------- src/H5Gint.c | 213 +--------------- src/H5Gpkg.h | 5 - src/H5I.c | 40 +-- src/H5L.c | 369 +++------------------------ src/H5O.c | 26 +- src/H5Ocopy.c | 7 +- src/H5Odeprec.c | 13 +- src/H5Oflush.c | 54 +--- src/H5Oint.c | 282 +------------------- src/H5Opkg.h | 11 - src/H5Rint.c | 20 +- src/H5T.c | 4 +- src/H5Tcommit.c | 94 +------ src/H5Z.c | 6 +- src/H5private.h | 50 ---- tools/test/h5dump/errfiles/tall-1.err | 19 +- tools/test/h5dump/errfiles/tall-2A.err | 19 +- tools/test/h5dump/errfiles/tall-2A0.err | 19 +- tools/test/h5dump/errfiles/tall-2B.err | 19 +- tools/test/h5dump/errfiles/tdset-2.err | 11 +- tools/test/h5dump/errfiles/textlink.err | 38 ++- tools/test/h5dump/errfiles/textlinkfar.err | 33 ++- tools/test/h5dump/errfiles/textlinksrc.err | 33 ++- tools/test/h5dump/errfiles/torderlinks1.err | 19 +- tools/test/h5dump/errfiles/torderlinks2.err | 19 +- tools/test/h5dump/errfiles/tperror.err | 11 +- 43 files changed, 418 insertions(+), 2156 deletions(-) diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 62497f9..b39dbef 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -36,25 +36,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file major: File accessibilty minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty - minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class + #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class major: File accessibilty minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID + #002: (file name) line (number) in H5FD_get_class(): can't find object for ID major: Object atom minor: Unable to find atom information (already closed?) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file major: File accessibilty minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty - minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class + #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class major: File accessibilty minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID + #002: (file name) line (number) in H5FD_get_class(): can't find object for ID major: Object atom minor: Unable to find atom information (already closed?) diff --git a/src/H5A.c b/src/H5A.c index 8e64eda..a0408c3 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1133,7 +1133,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Call private attribute rename routine */ - if(H5A__rename(&loc, old_name, new_name) < 0) + if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1379,7 +1379,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Delete the attribute from the location */ - if(H5A__delete(&loc, name) < 0) + if(H5O__attr_remove(loc.oloc, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1563,7 +1563,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ - if((ret_value = H5A__exists(&loc, attr_name)) < 0) + if((ret_value = H5O__attr_exists(loc.oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 9b592b0..99c1c0c 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -340,7 +340,7 @@ H5Aget_num_attrs(hid_t loc_id) } /*lint !e788 All appropriate cases are covered */ /* Look up the # of attributes for the object */ - if((ret_value = H5A__get_num_attrs(loc)) < 0) + if((ret_value = H5O__attr_count(loc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") done: diff --git a/src/H5Aint.c b/src/H5Aint.c index 55560c7..807c67e 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -87,8 +87,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static H5A_t *H5A__create_common(const H5G_loc_t *loc, const char *name, - const H5T_t *type, const H5S_t *space, hid_t acpl_id); static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); @@ -127,7 +125,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); /*------------------------------------------------------------------------- - * Function: H5A__create_common + * Function: H5A__create * * Purpose: This is the guts of creating an attribute. * @@ -138,8 +136,8 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); * *------------------------------------------------------------------------- */ -static H5A_t * -H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, +H5A_t * +H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -148,7 +146,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, htri_t exists; /* Whether attribute exists */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->oloc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) /* Check args */ HDassert(loc); @@ -285,45 +283,6 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* H5A__create_common() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__create - * - * Purpose: Entry point for creating attribute on an object - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Attribute structure on success, NULL on Failure. - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -H5A_t * -H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, - const H5S_t *space, hid_t acpl_id) -{ - H5A_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check args */ - HDassert(loc); - HDassert(name); - HDassert(type); - HDassert(space); - - /* Go do the real work for attaching the attribute to the object */ - if(NULL == (ret_value = H5A__create_common(loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, NULL, "unable to create attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* H5A__create() */ @@ -350,7 +309,7 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -368,8 +327,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr loc_found = TRUE; /* Go do the real work for attaching the attribute to the object */ - if(NULL == (attr = H5A__create_common(&obj_loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") /* Set return value */ ret_value = attr; @@ -384,7 +343,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ @@ -450,10 +409,6 @@ done: * * Purpose: Open an attribute in an object header * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol @@ -467,7 +422,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -490,7 +445,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ @@ -517,7 +472,7 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -554,7 +509,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ @@ -580,7 +535,7 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -618,7 +573,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ @@ -652,7 +607,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -721,7 +676,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__read() */ @@ -756,7 +711,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -835,7 +790,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__write() */ @@ -939,7 +894,7 @@ H5A__get_type(H5A_t *attr) H5T_t *dt = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(attr); @@ -970,7 +925,7 @@ done: if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1192,7 +1147,7 @@ H5A__close_cb(H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(attr); @@ -1203,7 +1158,7 @@ H5A__close_cb(H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ @@ -1355,39 +1310,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__exists - * - * Purpose: Private version of H5Aexists - * - * Note: This routine is needed so that there's a non-API routine for - * detecting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: TRUE/FALSE - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5A__exists(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check if the attribute exists */ - if((ret_value = H5O__attr_exists(loc->oloc, name)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__exists() */ - - -/*------------------------------------------------------------------------- * Function: H5A__exists_by_name * * Purpose: Private version of H5Aexists_by_name @@ -1409,7 +1331,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name) hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1430,7 +1352,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ @@ -2599,39 +2521,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__rename - * - * Purpose: Private version of H5Arename - * - * Note: This routine is needed so that there's a non-API routine for - * renaming attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__rename(const H5G_loc_t *loc, const char *old_name, const char *new_name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute rename routine */ - if(H5O__attr_rename(loc->oloc, old_name, new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__rename() */ - - -/*------------------------------------------------------------------------- * Function: H5A__rename_by_name * * Purpose: Private version of H5Arename_by_name @@ -2654,7 +2543,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2675,44 +2564,9 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5A__get_num_attrs - * - * Purpose: Private version of deprecated H5Aget_num_attrs - * - * Note: This routine is needed so that there's a non-API routine for - * querying the attribute count that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -int -H5A__get_num_attrs(const H5O_loc_t *loc) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Look up the # of attributes for the object */ - if((ret_value = H5O__attr_count(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__get_num_attrs() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*------------------------------------------------------------------------- * Function: H5A__iterate_common @@ -2755,10 +2609,6 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, * * Purpose: Private version of H5Aiterate2 * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2774,7 +2624,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP2; @@ -2785,7 +2635,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -2811,7 +2661,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, hsize_t idx; /* Index of attribute to start iterating at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP; @@ -2829,7 +2679,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, *attr_num = (unsigned)idx; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -2839,10 +2689,6 @@ done: * * Purpose: Private version of H5Aiterate_by_name * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2863,7 +2709,7 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2896,44 +2742,11 @@ done: else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_by_name() */ /*------------------------------------------------------------------------- - * Function: H5A__delete - * - * Purpose: Private version of H5Adelete - * - * Note: This routine is needed so that there's a non-API routine for - * deleting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute delete attribute routine */ - if(H5O__attr_remove(loc->oloc, name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5A__delete_by_name * * Purpose: Private version of H5Adelete_by_name @@ -2955,7 +2768,7 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2976,7 +2789,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ @@ -3003,7 +2816,7 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -3024,6 +2837,6 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_idx() */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index af16b55..0bb6d8f 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -200,13 +200,8 @@ H5_DLL herr_t H5A__close(H5A_t *attr); H5_DLL herr_t H5A__close_cb(H5A_t *attr); H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo); H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr); -H5_DLL herr_t H5A__rename(const H5G_loc_t *loc, const char *old_name, - const char *new_name); H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, const char *new_attr_name); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL int H5A__get_num_attrs(const H5O_loc_t *loc); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ H5_DLL herr_t H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data); H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, @@ -216,12 +211,10 @@ H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -H5_DLL herr_t H5A__delete(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL htri_t H5A__exists(const H5G_loc_t *loc, const char *name); H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf); H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf); diff --git a/src/H5D.c b/src/H5D.c index 61ccb5a..0ea7e4a 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -220,8 +220,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* build and open the new dataset */ - if(NULL == (dset = H5D__create_anon(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) @@ -481,8 +481,8 @@ H5Dget_create_plist(hid_t dset_id) if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") - if((ret_value = H5D__get_create_plist(dataset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") + if((ret_value = H5D_get_create_plist(dataset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4906f3c..16d7530 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -495,7 +495,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -565,7 +565,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, *filters = udata.filter_mask; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__chunk_direct_read() */ @@ -590,7 +590,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage H5D_chunk_ud_t udata; /* User data for querying chunk info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -663,7 +663,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage *storage_size = dset->shared->layout.u.chunk.size; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5D__get_chunk_storage_size */ diff --git a/src/H5Dint.c b/src/H5Dint.c index e8874a2..2d4985e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -58,7 +58,6 @@ static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, 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__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); static herr_t H5D__close_cb(H5D_t *dataset); @@ -299,7 +298,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, H5D_obj_create_t dcrt_info; /* Information for dataset creation */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -330,52 +329,11 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, ret_value = (H5D_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__create_named() */ /*------------------------------------------------------------------------- - * Function: H5D__create_anon - * - * Purpose: Internal routine to create a new anonymous dataset. - * - * Note: This routine is needed so that there's a non-API routine for - * creating datasets that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new dataset object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 9, 2017 - * - *------------------------------------------------------------------------- - */ -H5D_t * -H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, - hid_t dapl_id) -{ - H5D_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(type_id != H5P_DEFAULT); - HDassert(space); - HDassert(dcpl_id != H5P_DEFAULT); - HDassert(dapl_id != H5P_DEFAULT); - - /* Build and open the dataset */ - if(NULL == (ret_value = H5D__create(file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5D__get_space_status * * Purpose: Returns the status of dataspace allocation. @@ -390,7 +348,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) { herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(dset); @@ -423,7 +381,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, &space_allocated) < 0) + if(H5D__get_storage_size(dset, &space_allocated) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") /* Decide on how much of the space is allocated */ @@ -444,7 +402,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) } /* end else */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space_status() */ @@ -1189,7 +1147,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id) hbool_t loc_found = FALSE; /* Location at 'name' found */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -1223,7 +1181,7 @@ done: if(loc_found && H5G_loc_free(&dset_loc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__open_name() */ @@ -1617,7 +1575,7 @@ H5D__close_cb(H5D_t *dataset) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* check args */ HDassert(dataset && dataset->oloc.file && dataset->shared); @@ -1628,7 +1586,7 @@ H5D__close_cb(H5D_t *dataset) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset"); done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__close_cb() */ @@ -2262,7 +2220,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size_real + * Function: H5D__get_storage_size * * Purpose: Determines how much space has been reserved to store the raw * data of a dataset. @@ -2270,8 +2228,8 @@ done: * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ -static herr_t -H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) +herr_t +H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2313,35 +2271,6 @@ H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5D__get_storage_size_real() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__get_storage_size - * - * Purpose: Determines how much space has been reserved to store the raw - * data of a dataset. - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Non-negative on success, negative on failure - *------------------------------------------------------------------------- - */ -herr_t -H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, storage_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5D__get_storage_size() */ @@ -2586,7 +2515,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) unsigned dim_idx; /* Dimension index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset); @@ -2747,7 +2676,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__set_extent() */ @@ -2833,7 +2762,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(dset); @@ -2848,7 +2777,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__flush() */ @@ -2873,7 +2802,7 @@ H5D__format_convert(H5D_t *dataset) hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* Check args */ HDassert(dataset); @@ -2999,7 +2928,7 @@ done: if(newlayout != NULL) newlayout = (H5O_layout_t *)H5MM_xfree(newlayout); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__format_convert() */ @@ -3126,44 +3055,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_create_plist - * - * Purpose: Internal routine to retrieve a dataset's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the dataset creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5D__get_create_plist(const H5D_t *dset) -{ - hid_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(dset); - - /* Retrieve the DCPL */ - if((ret_value = H5D_get_create_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5D_get_create_plist * * Purpose: Private function for H5Dget_create_plist @@ -3422,7 +3313,7 @@ H5D__get_space(const H5D_t *dset) H5S_t *space = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* If the layout is virtual, update the extent */ if(dset->shared->layout.type == H5D_VIRTUAL) @@ -3443,7 +3334,7 @@ done: if(H5S_close(space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space() */ @@ -3508,7 +3399,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset) hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dset); @@ -3536,6 +3427,6 @@ done: if(H5D__virtual_release_source_dset_files(head) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__refresh() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 5fea91f..ed384ca 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -449,7 +449,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* check args */ HDassert(dataset && dataset->oloc.file); @@ -616,7 +616,7 @@ done: if(H5S_close(projected_mem_space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace") - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__read() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index b887b87..1217c48 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -555,8 +555,6 @@ H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id); -H5_DLL H5D_t *H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, - hid_t dcpl_id, hid_t dapl_id); H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id); H5_DLL hid_t H5D__get_space(const H5D_t *dset); H5_DLL hid_t H5D__get_type(const H5D_t *dset); @@ -575,7 +573,6 @@ H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); H5_DLL herr_t H5D__flush_real(H5D_t *dataset); H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id); -H5_DLL hid_t H5D__get_create_plist(const H5D_t *dset); H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags); H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset); diff --git a/src/H5F.c b/src/H5F.c index 01fd7db..65fbc9e 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -440,7 +440,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file. */ - if (NULL == (new_file = H5F__create(filename, flags, fcpl_id, fapl_id))) + if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ @@ -505,7 +505,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the file */ - if(NULL == (new_file = H5F__open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") /* Get an atom for the file */ @@ -621,15 +621,22 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) * to be flushed. */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { - hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ + hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Flush the file */ - if(H5F__flush(f, scope) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + /* Flush other files, depending on scope */ + if(H5F_SCOPE_GLOBAL == 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") + } /* 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") } /* end if */ done: @@ -796,9 +803,9 @@ H5Fget_freespace(hid_t file_id) if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Get the free space in the file */ - if(H5F__get_freespace(file, &tot_space) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + /* Go get the actual amount of free space in the file */ + if(H5MF_get_freespace(file, &tot_space, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file") ret_value = (hssize_t)tot_space; @@ -1273,7 +1280,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") /* Get the free-space section information in the file */ - if((ret_value = H5F__get_free_sections(file, type, nsects, sect_info)) < 0) + if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") done: diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 07bb644..a394071 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -481,7 +481,7 @@ H5F__efc_release(H5F_efc_t *efc) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(efc); @@ -491,7 +491,7 @@ H5F__efc_release(H5F_efc_t *efc) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_efc_release() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index abc638a..432cd8e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -795,7 +795,7 @@ H5F__is_hdf5(const char *name) haddr_t sig_addr; /* Addess of hdf5 file signature */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Open the file at the virtual file layer */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) @@ -812,7 +812,7 @@ done: if(H5FD_close(file) < 0 && ret_value >= 0) HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__is_hdf5() */ @@ -1333,78 +1333,6 @@ H5F__dest(H5F_t *f, hbool_t flush) /*------------------------------------------------------------------------- - * Function: H5F__create - * - * Purpose: Internal routine to create a file. - * - * Note: This routine is needed so that there's a non-API routine for - * creating files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Create a new file or truncate an existing file. */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__create() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__open - * - * Purpose: Internal routine to open a file. - * - * Note: This routine is needed so that there's a non-API routine for - * opening files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Open the file */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__open() */ - - -/*------------------------------------------------------------------------- * Function: H5F_open * * Purpose: Opens (or creates) a file. This function understands the @@ -1926,7 +1854,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /*------------------------------------------------------------------------- - * Function: H5F__flush_real + * Function: H5F__flush * * Purpose: Flushes cached data. * @@ -1934,7 +1862,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) *------------------------------------------------------------------------- */ herr_t -H5F__flush_real(H5F_t *f) +H5F__flush(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1954,49 +1882,6 @@ H5F__flush_real(H5F_t *f) HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__flush_real() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__flush - * - * Purpose: Internal routine to flush a file. - * - * Note: This routine is needed so that there's a non-API routine for - * flushing files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5F__flush(H5F_t *f, H5F_scope_t scope) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Flush other files, depending on scope */ - if(H5F_SCOPE_GLOBAL == 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") - } /* end if */ - else - /* Call the flush routine, for this file */ - if(H5F__flush_real(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5F__flush() */ @@ -2005,10 +1890,6 @@ done: * * Purpose: Internal routine to close a file. * - * Note: This routine is needed so that there's a non-API routine for - * closing files that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol @@ -2022,7 +1903,7 @@ H5F__close(hid_t file_id) H5F_t *f; /* File pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* 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. @@ -2037,7 +1918,7 @@ H5F__close(hid_t file_id) if((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ID ref count") if(nref == 1) - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } /* end if */ @@ -2047,7 +1928,7 @@ H5F__close(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "decrementing file ID failed") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close() */ @@ -2073,7 +1954,7 @@ H5F__close_cb(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -2105,7 +1986,7 @@ H5F__close_cb(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close_cb() */ @@ -2780,7 +2661,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(f); @@ -2808,7 +2689,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) * * QAK - April, 2018 */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Set the new bounds */ @@ -2822,45 +2703,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_freespace - * - * Purpose: Private version of H5Fget_freespace - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: SUCCEED - * Failure: FAIL - *------------------------------------------------------------------------- - */ -herr_t -H5F__get_freespace(H5F_t *f, hsize_t *tot_space) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(f, tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_freespace() */ - - -/*------------------------------------------------------------------------- * Function: H5F__get_file_image * * Purpose: Private version of H5Fget_file_image * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Bytes copied / number of bytes needed. * Failure: negative value *------------------------------------------------------------------------- @@ -2872,7 +2718,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) haddr_t eoa; /* End of file address */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ if(!file || !file->shared || !file->shared->lf) @@ -2959,7 +2805,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_file_image() */ @@ -2968,9 +2814,6 @@ done: * * Purpose: Private version of H5Fget_info * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -2980,7 +2823,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3009,7 +2852,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) finfo->free.version = HDF5_FREESPACE_VERSION; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_info() */ @@ -3098,39 +2941,6 @@ H5F_set_retries(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F__get_free_sections - * - * Purpose: Private version of H5Fget_free_sections - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative - *------------------------------------------------------------------------- - */ -ssize_t -H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, - H5F_sect_info_t *sect_info) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if((ret_value = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space sections for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_free_sections() */ - - -/*------------------------------------------------------------------------- * Function: H5F_object_flush_cb * * Purpose: To invoke the callback function for object flush that is set @@ -3426,9 +3236,6 @@ done: * set up flush dependency/proxy even for file opened without * SWMR to resolve issues with opened objects. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3448,7 +3255,7 @@ H5F__start_swmr_write(H5F_t *f) hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3481,7 +3288,7 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension") /* Flush data buffers */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information") /* Get the # of opened named datatypes and attributes */ @@ -3617,7 +3424,7 @@ done: if(obj_paths) H5MM_xfree(obj_paths); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__start_swmr_write() */ @@ -3626,9 +3433,6 @@ done: * * Purpose: Private version of H5Fformat_convert * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3639,7 +3443,7 @@ H5F__format_convert(H5F_t *f) hbool_t mark_dirty = FALSE; /* Whether to mark the file's superblock dirty */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3682,6 +3486,6 @@ H5F__format_convert(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 4cd1edf..b04bd3a 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -112,7 +112,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED H5G_loc_t root_loc; /* Group location of root of file to mount */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -240,7 +240,7 @@ done: } } - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__mount() */ @@ -277,7 +277,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name) int child_idx; /* Index of child in parent's mtab */ herr_t ret_value = SUCCEED; /*return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -390,7 +390,7 @@ done: if(mp_loc_setup) H5G_loc_free(&mp_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__unmount() */ @@ -651,7 +651,7 @@ H5F_flush_mounts_recurse(H5F_t *f) nerrors++; /* Call the "real" flush routine, for this file */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) 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 */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2ab41de..2e8a793 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -396,16 +396,11 @@ H5FL_EXTERN(H5F_file_t); /* General routines */ H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); -H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL H5F_t *H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL herr_t H5F__flush(H5F_t *f, H5F_scope_t scope); -H5_DLL herr_t H5F__flush_real(H5F_t *f); +H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name); H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); -H5_DLL herr_t H5F__get_freespace(H5F_t *f, hsize_t *tot_space); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); -H5_DLL ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); diff --git a/src/H5G.c b/src/H5G.c index fa065fa..cbf3a8e 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -400,10 +400,10 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_anon(loc.oloc->file, &gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: /* Release the group's object header, if it was created */ @@ -509,10 +509,11 @@ H5Gget_create_plist(hid_t group_id) /* Check args */ if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") - if((ret_value = H5G__get_create_plist(group)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") + /* Retrieve the GCPL */ + if((ret_value = H5G_get_create_plist(group)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: FUNC_LEAVE_API(ret_value) @@ -554,7 +555,7 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the group's information */ - if(H5G__get_info(&loc, grp_info/*out*/) < 0) + if(H5G__obj_info(loc.oloc, grp_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -722,9 +723,9 @@ H5Gflush(hid_t group_id) if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Flush group's metadata to file */ - if(H5G__flush(grp, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + /* Flush metadata to file */ + if(H5O_flush_common(&grp->oloc, group_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") done: FUNC_LEAVE_API(ret_value) @@ -761,7 +762,7 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call private function to refresh group object */ - if((H5G__refresh(grp, group_id)) < 0) + if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index f6c6d8f..57bbcd9 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -76,24 +76,11 @@ static herr_t H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name, hid_t lcpl_id); static herr_t H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id); -static herr_t H5G__unlink(H5G_loc_t *loc, const char *name); -static herr_t H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/); -static herr_t H5G__set_comment(const H5G_loc_t *loc, const char *name, - const char *comment); -static int H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize); -static herr_t H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data); -static herr_t H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info); static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); -static ssize_t H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size); static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -197,9 +184,9 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Check arguments */ 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") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") /* Check if we need to create a non-standard GCPL */ if(size_hint > 0) { @@ -238,7 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") done: if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) @@ -321,9 +308,9 @@ 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) @@ -357,9 +344,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* 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) @@ -393,7 +380,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, H5G_loc_t new_loc; /* Information about new link's group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { @@ -441,7 +428,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__link() */ @@ -531,7 +518,7 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) @@ -553,10 +540,10 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 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_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__move() */ @@ -578,16 +565,16 @@ H5Gunlink(hid_t loc_id, const char *name) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_SYM, 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") - /* Call internal routine */ - if(H5G__unlink(&loc, name) < 0) + /* Call H5L routine... */ + if(H5L_delete(&loc, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: @@ -596,37 +583,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__unlink - * - * Purpose: Internal version of H5Gunlink. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__unlink(H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call H5L routine... */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__unlink() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_linkval * * Purpose: Retrieve's a soft link's data. The new API is @@ -645,53 +601,21 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") 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") - /* Call internal routine */ - if(H5G__get_linkval(&loc, name, size, buf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_linkval() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__get_linkval - * - * Purpose: Internal version of H5Gget_linkval. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - /* Call the link routine which provides this capability */ - if(H5L_get_val(loc, name, buf, size) < 0) + if(H5L_get_val(&loc, name, buf, size) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_linkval() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_linkval() */ /*------------------------------------------------------------------------- @@ -721,17 +645,17 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) H5TRACE3("e", "i*s*s", loc_id, name, comment); 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") 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") - /* Call internal routine */ - if(H5G__set_comment(&loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") + /* Call the common routine which provides this capability */ + if(H5G_loc_set_comment(&loc, name, comment) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: FUNC_LEAVE_API(ret_value) @@ -739,37 +663,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__set_comment - * - * Purpose: Internal version of H5Gset_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__set_comment(const H5G_loc_t *loc, const char *name, const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__set_comment() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_comment * * Purpose: Return at most BUFSIZE characters of the comment for the @@ -802,19 +695,19 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); 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") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(bufsize > 0 && !buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer 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") - /* Call internal routine */ - if((ret_value = H5G__get_comment(&loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") + /* Call the common routine which provides this capability */ + if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: FUNC_LEAVE_API(ret_value) @@ -822,38 +715,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_comment - * - * Purpose: Internal version of H5Gget_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static int -H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if((ret_value = (int)H5G_loc_get_comment(loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_comment() */ - - -/*------------------------------------------------------------------------- * Function: H5Giterate * * Purpose: Iterates over the entries of a group. The LOC_ID and NAME @@ -905,8 +766,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; - /* Call private function. */ - if((ret_value = H5G__iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) + /* Call the common routine which provides this capability */ + if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ @@ -919,39 +780,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__iterate - * - * Purpose: Internal version of H5Giterate. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if((ret_value = H5G_iterate(loc_id, name, idx_type, order, idx, last_lnk, lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__iterate() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_num_objs * * Purpose: Returns the number of objects in the group. It iterates @@ -970,22 +798,27 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ - H5G_info_t grp_info; /* Group information */ - herr_t ret_value = SUCCEED; + H5G_loc_t loc; /* Location of object */ + H5G_info_t grp_info; /* Group information */ + H5O_type_t obj_type; /* Type of object at location */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") if(!num_objs) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") - /* Call the internal routine */ - if(H5G__get_num_objs(loc.oloc, &grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") + /* Retrieve information about the group */ + if(H5G__obj_info(loc.oloc, &grp_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") /* Set the number of objects [sic: links] in the group */ *num_objs = grp_info.nlinks; @@ -996,44 +829,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_num_objs - * - * Purpose: Internal version of H5Gget_num_objs. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info) -{ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - - /* Retrieve information about the group */ - if(H5G__obj_info(oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_num_objs() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_objinfo * * Purpose: Returns information about an object. If FOLLOW_LINK is @@ -1062,13 +857,13 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") /* Get info */ if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") done: FUNC_LEAVE_API(ret_value) @@ -1177,7 +972,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_trav_goi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(loc); @@ -1220,7 +1015,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_objinfo() */ @@ -1250,62 +1045,28 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5G_loc_t loc; /* Object location */ - ssize_t ret_value; + H5G_loc_t loc; /* Object location */ + H5O_type_t obj_type; /* Type of object at location */ + ssize_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") - - /* Call internal function */ - if((ret_value = H5G__get_objname_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objname_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__get_objname_by_idx - * - * Purpose: Internal version of H5Gget_objname_by_idx. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size) -{ - H5O_type_t obj_type; /* Type of object at location */ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") /* Call common routine */ - if((ret_value = H5G_obj_get_name_by_idx(oloc, idx_type, order, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_objname_by_idx() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objname_by_idx() */ /*------------------------------------------------------------------------- @@ -1334,11 +1095,11 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") /* Call internal function*/ if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") done: FUNC_LEAVE_API(ret_value) @@ -1368,7 +1129,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) H5O_type_t obj_type; /* Type of object at location */ H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - FUNC_ENTER_STATIC_VOL_TAG(oloc->addr) + FUNC_ENTER_STATIC_TAG(oloc->addr) /* Sanity check */ HDassert(oloc); @@ -1401,7 +1162,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) } /* end else */ done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5G__obj_get_type_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 3b5de44..8fd7514 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -134,7 +134,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, H5G_obj_create_t gcrt_info; /* Information for group creation */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -161,48 +161,11 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, ret_value = (H5G_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__create_named() */ /*------------------------------------------------------------------------- - * Function: H5G__create_anon - * - * Purpose: Internal routine to create a new anonymous group. - * - * Note: This routine is needed so that there's a non-API routine for - * creating groups that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new group object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info) -{ - H5G_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(gcrt_info); - - /* Create the new group & get its ID */ - if(NULL == (ret_value = H5G__create(file, gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "unable to create group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5G__create * * Purpose: Creates a new empty group with the specified name. The name @@ -302,7 +265,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) H5O_type_t obj_type; /* Type of object at location */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -336,7 +299,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__open_name() */ @@ -502,7 +465,7 @@ H5G__close_cb(H5G_t *grp) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(grp && grp->shared); @@ -513,7 +476,7 @@ H5G__close_cb(H5G_t *grp) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__close_cb() */ @@ -1239,44 +1202,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_create_plist - * - * Purpose: Internal routine to retrieve a group's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the group creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: H5I_INVALID_HID - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5G__get_create_plist(const H5G_t *grp) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(grp); - - /* Retrieve the GCPL */ - if((ret_value = H5G_get_create_plist(grp)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5G_get_create_plist * * Purpose: Private function for H5Gget_create_plist @@ -1372,51 +1297,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_info - * - * Purpose: Internal routine to retrieve the info for a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(grp_info); - - /* Retrieve the group's information */ - if(H5G__obj_info(loc->oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5G__get_info_by_name * * Purpose: Internal routine to retrieve the info for a group, by name. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1432,7 +1317,7 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1457,7 +1342,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_name() */ @@ -1466,11 +1351,7 @@ done: * * Purpose: Internal routine to retrieve the info for a group, by index. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1487,7 +1368,7 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1512,76 +1393,6 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5G__flush - * - * Purpose: Internal routine to flushes a group to disk. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__flush(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Flush metadata to file */ - if(H5O_flush_common(&grp->oloc, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__flush */ - - -/*------------------------------------------------------------------------- - * Function: H5G__refresh - * - * Purpose: Internal routine to refresh a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__refresh(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Call private function to refresh group object */ - if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__refresh */ - diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index f0a9aea..b89777d 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -331,16 +331,11 @@ H5FL_EXTERN(H5G_shared_t); H5_DLL H5G_t *H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id); -H5_DLL H5G_t *H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__open_name(const H5G_loc_t *loc, const char *name); -H5_DLL hid_t H5G__get_create_plist(const H5G_t *grp); -H5_DLL herr_t H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info); -H5_DLL herr_t H5G__flush(H5G_t *grp, hid_t group_id); -H5_DLL herr_t H5G__refresh(H5G_t *grp, hid_t group_id); H5_DLL herr_t H5G__close_cb(H5G_t *grp); /* diff --git a/src/H5I.c b/src/H5I.c index 4df7b7e..3cf592d 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -128,7 +128,6 @@ static int H5I__inc_type_ref(H5I_type_t type); static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); -static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size); #ifdef H5I_DEBUG_OUTPUT static int H5I__debug_cb(void *_item, void *_key, void *_udata); static herr_t H5I__debug(H5I_type_t type); @@ -2021,8 +2020,8 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - /* Call internal routine to retrieve object's name */ - if((ret_value = H5I__get_name(&loc, name, size)) < 0) + /* Retrieve object's name */ + if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: @@ -2031,41 +2030,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_name - * - * Purpose: Internal routine to retrieve the name for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: The length of the name - * Failure: -1 - * - * Programmer: Quincey Koziol - * January 9, 2018 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - - /* Retrieve object's name */ - if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5I__get_name() */ - - -/*------------------------------------------------------------------------- * Function: H5Iget_file_id * * Purpose: The public version of H5I_get_file_id(), obtains the file diff --git a/src/H5L.c b/src/H5L.c index b26a8c4..6967812 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -102,16 +102,10 @@ static herr_t H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); -static herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); -static herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id); static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size); static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, - void *buf/*out*/, size_t size); static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -121,7 +115,6 @@ static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__delete(const H5G_loc_t *loc, const char *name); static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -133,8 +126,6 @@ static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id); static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -145,8 +136,6 @@ static htri_t H5L__exists(const H5G_loc_t *loc, const char *name); static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_info(const H5G_loc_t *loc, const char *name, - H5L_info_t *linfo/*out*/); static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -162,10 +151,6 @@ static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name static herr_t H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data); -static herr_t H5L__visit(hid_t grp_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, - void *op_data); - /*********************/ /* Package Variables */ @@ -338,8 +323,8 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, dst_loc_p = src_loc_p; /* Move the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -400,8 +385,8 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, dst_loc_p = src_loc_p; /* Copy the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -451,8 +436,8 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ - if(H5L__create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -516,8 +501,8 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ - if(H5L__create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -617,8 +602,8 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Unlink */ - if(H5L__delete(&loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + if(H5L_delete(&loc, name) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -670,7 +655,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Delete the link */ if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 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_API(ret_value) @@ -717,8 +702,8 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link value */ - if(H5L__get_val(&loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) + if(H5L_get_val(&loc, name, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: FUNC_LEAVE_API(ret_value) @@ -854,8 +839,8 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link information */ - if(H5L__get_info(&loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + if(H5L_get_info(&loc, name, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -904,7 +889,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Get the link information */ if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 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) @@ -1087,7 +1072,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, /* Get the link information */ if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") done: FUNC_LEAVE_API(ret_value) @@ -1135,7 +1120,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, /* Iterate over the links */ if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 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) @@ -1191,7 +1176,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, /* Iterate over the links */ if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 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) @@ -1248,8 +1233,8 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal routine */ - if((ret_value = H5L__visit(grp_id, ".", idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1309,8 +1294,8 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ - if((ret_value = H5L__visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1895,45 +1880,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_hard - * - * Purpose: Internal routine to create a hard link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(cur_loc); - HDassert(cur_name); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_hard(cur_loc, cur_name, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_hard() */ - - -/*------------------------------------------------------------------------- * Function: H5L_create_soft * * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. @@ -1982,44 +1928,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_soft - * - * Purpose: Internal routine to create a soft link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(target_path); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_soft(target_path, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_soft() */ - - -/*------------------------------------------------------------------------- * Function: H5L__create_ud * * Purpose: Creates a user-defined link. See H5Lcreate_ud for @@ -2039,7 +1947,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); @@ -2073,7 +1981,7 @@ done: /* Free the link's udata buffer if it's been allocated */ H5MM_xfree(lnk.u.ud.udata); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__create_ud() */ @@ -2216,42 +2124,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_val - * - * Purpose: Internal routine to query a link value - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link value */ - if(H5L_get_val(loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_val() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_val_by_idx_cb * * Purpose: Callback for retrieving a link's value according to an @@ -2308,9 +2180,6 @@ done: * Purpose: Internal routine to query a link value according to the * index within a group * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2326,7 +2195,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -2344,7 +2213,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n) done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_val_by_idx() */ @@ -2439,42 +2308,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__delete - * - * Purpose: Internal routine to delete a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Delete the link */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link: %s", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5L__delete_by_idx_cb * * Purpose: Callback for removing a link according to an index's order. @@ -2519,9 +2352,6 @@ done: * Purpose: Internal routine to delete a link according to its index * within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2537,7 +2367,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -2553,8 +2383,8 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2864,45 +2694,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__move - * - * Purpose: Internal routine to move / copy a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__move(const H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, - const char *dst_name, hbool_t copy_flag, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(src_loc); - HDassert(src_name); - HDassert(dst_loc); - HDassert(dst_name); - - /* Move the link */ - if(H5L_move(src_loc, src_name, dst_loc, dst_name, copy_flag, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__move() */ - - -/*------------------------------------------------------------------------- * Function: H5L__exists_final_cb * * Purpose: Callback for checking whether a link exists, as the final @@ -3083,7 +2874,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -3098,7 +2889,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) ret_value = (htri_t)udata.exists; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5L__exists() */ @@ -3173,42 +2964,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_info - * - * Purpose: Internal routine to retrieve link info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link information */ - if(H5L_get_info(loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info for: '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_info_by_idx_cb * * Purpose: Callback for retrieving a link's metadata according to an @@ -3265,9 +3020,6 @@ done: * Purpose: Internal routine to retrieve link info according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3283,7 +3035,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -3298,10 +3050,10 @@ 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_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_info_by_idx() */ @@ -3351,9 +3103,6 @@ done: * Purpose: Internal routine to retrieve link name according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3370,7 +3119,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -3392,7 +3141,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, ret_value = udata.name_len; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_name_by_idx() */ @@ -3401,9 +3150,6 @@ done: * * Purpose: Internal routine to iterate over links * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3421,7 +3167,7 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, hsize_t idx; /* Internal location to hold index */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(group_name); @@ -3444,48 +3190,11 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, *idx_p = last_lnk; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__iterate() */ /*------------------------------------------------------------------------- - * Function: H5L__visit - * - * Purpose: Internal routine to visit links - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__visit(hid_t grp_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(group_name); - HDassert(op); - - /* Call internal group visitation routine */ - if((ret_value = H5G_visit(grp_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__visit() */ - - -/*------------------------------------------------------------------------- * Function: H5L__link_copy_file * * Purpose: Copy a link and the object it points to from one file to diff --git a/src/H5O.c b/src/H5O.c index 9b832f1..25c3d83 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -116,7 +116,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the object */ - if((ret_value = H5O__open_name(&loc, name)) < 0) + if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -292,9 +292,9 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, 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") - /* Create a link to the object */ - if(H5O__create_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") + /* Link to the object */ + if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -339,7 +339,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ - if(H5O__link(oloc, 1) < 0) + if(H5O_link(oloc, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -385,7 +385,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ - if(H5O__link(oloc, -1) < 0) + if(H5O_link(oloc, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -426,7 +426,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Check if the object exists */ - if((ret_value = H5O__exists_by_name(&loc, name)) < 0) + if((ret_value = H5G_loc_exists(&loc, name)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -467,7 +467,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -515,7 +515,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, name, oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -612,7 +612,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, ".", comment) < 0) + if(H5G_loc_set_comment(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -658,7 +658,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, name, comment) < 0) + if(H5G_loc_set_comment(&loc, name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -696,7 +696,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, ".", comment/*out*/, bufsize)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") done: @@ -741,7 +741,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, name, comment/*out*/, bufsize)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name) done: diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2e628f4..b57eaf6 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -242,9 +242,6 @@ done: * * Purpose: Internal routine to copy an object * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -265,7 +262,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, hbool_t obj_open = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -322,7 +319,7 @@ done: if(obj_open && H5O_close(&src_oloc, NULL) < 0) HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__copy() */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 876579d..c73529e 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -31,9 +31,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Opkg.h" /* Object headers */ /****************/ @@ -100,8 +101,8 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: FUNC_LEAVE_API(ret_value) @@ -140,7 +141,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5G_loc_info(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: diff --git a/src/H5Oflush.c b/src/H5Oflush.c index e8e077e..d8c9530 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -49,7 +49,6 @@ static herr_t H5O__flush(hid_t obj_id); static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag); static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc); -static herr_t H5O__refresh(hid_t obj_id); /*************/ @@ -133,9 +132,6 @@ done: * * Purpose: Internal routine to flush an object * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -152,7 +148,7 @@ H5O__flush(hid_t obj_id) const H5O_obj_class_t *obj_class; /* Class of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check args */ if(NULL == (oloc = H5O_get_loc(obj_id))) @@ -175,7 +171,7 @@ H5O__flush(hid_t obj_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__flush() */ @@ -235,17 +231,22 @@ done: herr_t H5Orefresh(hid_t oid) { - herr_t ret_value = SUCCEED; /* Return value */ + H5O_loc_t *oloc; /* object location */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", oid); + /* Check args */ + if(NULL == (oloc = H5O_get_loc(oid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") + /* Set up collective metadata if appropriate */ if(H5CX_set_loc(oid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ - if(H5O__refresh(oid) < 0) + if(H5O_refresh_metadata(oid, *oloc) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: @@ -460,40 +461,3 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5O_refresh_metadata_reopen() */ - -/*------------------------------------------------------------------------- - * Function: H5O__refresh - * - * Purpose: Internal routine to refresh an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 29, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5O__refresh(hid_t obj_id) -{ - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") - - /* Private function */ - if(H5O_refresh_metadata(obj_id, *oloc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__refresh() */ - diff --git a/src/H5Oint.c b/src/H5Oint.c index 2752a25..49d7835 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -565,49 +565,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__open_name - * - * Purpose: Internal routine to open an object by name - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5O__open_name(const H5G_loc_t *loc, const char *name) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name); - - /* Open the object */ - if((ret_value = H5O_open_name(loc, name, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__open_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O__open_by_idx * * Purpose: Internal routine to open an object by index within group * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -626,7 +587,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -651,7 +612,7 @@ done: if(H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_idx() */ @@ -660,9 +621,6 @@ done: * * Purpose: Internal routine to open an object by its address * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -679,7 +637,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) H5O_loc_t obj_oloc; /* Opened object object location */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -697,7 +655,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_addr() */ @@ -739,44 +697,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__create_link - * - * Purpose: Internal routine to create a link from a group to an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(new_loc); - HDassert(new_name && *new_name); - HDassert(obj_loc); - - /* Link to the object */ - if(H5L_link(new_loc, new_name, obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__create_link() */ - - -/*------------------------------------------------------------------------- * Function: H5O_close * * Purpose: Closes an object header that was previously open. @@ -1004,41 +924,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__link - * - * Purpose: Internal routine to change the refcount for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__link(const H5O_loc_t *oloc, int adjust) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(oloc); - - /* Change the object's refcount */ - if(H5O_link(oloc, adjust) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__link() */ - - -/*------------------------------------------------------------------------- * Function: H5O_protect * * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> @@ -2051,42 +1936,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__exists_by_name - * - * Purpose: Internal routine to check if an object exists - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5O__exists_by_name(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Check if the object exists */ - if((ret_value = H5G_loc_exists(loc, name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__exists_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_hdr_info * * Purpose: Retrieve the object header information for an object @@ -2342,52 +2191,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__get_info_by_name - * - * Purpose: Internal routine to retrieve an object's info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Note: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(oinfo); - - /* Retrieve the object's information */ - if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_info_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O__get_info_by_idx * * Purpose: Internal routine to retrieve an object's info according to * an index within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). * * Note: Add a parameter "fields" to indicate selection of object info. * @@ -2409,7 +2217,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id hbool_t loc_found = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -2435,85 +2243,11 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__get_info_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O__set_comment_by_name - * - * Purpose: Internal routine to set an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* (Re)set the object's comment */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__set_comment_by_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5O__get_comment_by_name - * - * Purpose: Internal routine to retrieve an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -ssize_t -H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize) -{ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(loc, name, comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_comment_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_create_plist * * Purpose: Retrieve the object creation properties for an object @@ -2893,7 +2627,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hid_t obj_id = (-1); /* ID of object */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Portably initialize user data struct to zeros */ HDmemset(&udata, 0, sizeof(udata)); @@ -2981,7 +2715,7 @@ done: if(udata.visited) H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 616f96b..19d90c5 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -555,25 +555,14 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ -H5_DLL hid_t H5O__open_name(const H5G_loc_t *loc, const char *name); H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr); H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); -H5_DLL herr_t H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id); H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); -H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust); -H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name); -H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, - H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment); -H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize); H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); diff --git a/src/H5Rint.c b/src/H5Rint.c index acf6b56..d2f315b 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -230,7 +230,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, hbool_t obj_found = FALSE; /* Object location found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(loc); @@ -335,7 +335,7 @@ done: if (obj_found) H5G_loc_free(&obj_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__create() */ @@ -381,7 +381,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, H5O_type_t obj_type; /* Type of object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); @@ -504,7 +504,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, } /* end switch */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__dereference() */ @@ -538,7 +538,7 @@ H5R__get_region(H5F_t *file, const void *_ref) uint8_t *buf = NULL; /* Buffer to store serialized selection in */ H5S_t *ret_value; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(file); @@ -573,7 +573,7 @@ done: if(buf) H5MM_xfree(buf); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_region() */ @@ -607,7 +607,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, unsigned rc; /* Reference count of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(file); HDassert(_ref); @@ -662,7 +662,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_obj_type() */ @@ -701,7 +701,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, H5O_loc_t oloc; /* Object location describing object for reference */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -763,6 +763,6 @@ done: if (file_id > 0 && H5I_dec_ref(file_id) < 0) HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_name() */ diff --git a/src/H5T.c b/src/H5T.c index fa97506..76b0663 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -3714,7 +3714,7 @@ H5T__close_cb(H5T_t *dt) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* check args */ HDassert(dt && dt->shared); @@ -3724,7 +3724,7 @@ H5T__close_cb(H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype"); done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__close_cb() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 1719f8f..649bd2e 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -59,8 +59,6 @@ static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); static hid_t H5T__get_create_plist(const H5T_t *type); static H5T_t *H5T__open_oid(const H5G_loc_t *loc); -static herr_t H5T__flush(H5T_t *dt, hid_t type_id); -static herr_t H5T__refresh(H5T_t *dt, hid_t type_id); /*********************/ @@ -165,7 +163,7 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, H5T_state_t old_state; /* The state of the datatype before H5T__commit. */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); @@ -219,7 +217,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__commit_named() */ @@ -296,7 +294,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) H5O_loc_t *oloc; /* Object location for datatype */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(file); @@ -318,7 +316,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5T__commit_anon() */ @@ -667,8 +665,8 @@ H5Tflush(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Flush metadata for named datatype */ - if(H5T__flush(dt, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + if(H5O_flush_common(&dt->oloc, type_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") done: FUNC_LEAVE_API(ret_value) @@ -707,7 +705,7 @@ H5Trefresh(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call private function to refresh datatype object */ - if((H5T__refresh(dt, type_id)) < 0) + if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") done: @@ -742,7 +740,7 @@ H5T__get_create_plist(const H5T_t *type) hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ hid_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity check */ HDassert(type); @@ -770,7 +768,7 @@ done: if(H5I_dec_app_ref(new_tcpl_id) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_create_plist() */ @@ -798,7 +796,7 @@ H5T__open_name(const H5G_loc_t *loc, const char *name) hbool_t obj_found = FALSE; /* Object at 'name' found */ H5T_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -836,7 +834,7 @@ done: if(H5G_loc_free(&type_loc) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__open_name() */ @@ -1040,73 +1038,3 @@ H5T_update_shared(H5T_t *dt) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5T_update_shared() */ - -/*------------------------------------------------------------------------- - * Function: H5T__flush - * - * Purpose: Internal routine to flushes a named datatype to disk. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__flush(H5T_t *dt, hid_t type_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Sanity check */ - HDassert(dt); - - /* To flush metadata and invoke flush callback if there is */ - if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__flush */ - - -/*------------------------------------------------------------------------- - * Function: H5T__refresh - * - * Purpose: Internal routine to refresh a named datatype. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__refresh(H5T_t *dt, hid_t type_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Sanity check */ - HDassert(dt); - - /* Call private function to refresh datatype object */ - if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__refresh */ - diff --git a/src/H5Z.c b/src/H5Z.c index f68fbce..14b0400 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -387,9 +387,9 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_object_t object; /* Object to pass to callbacks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE - HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX); + HDassert(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++) @@ -434,7 +434,7 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_table_used_g--; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__unregister() */ diff --git a/src/H5private.h b/src/H5private.h index 8974e46..196d001 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2199,12 +2199,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all package-level functions that are VOL entry-points */ -#define FUNC_ENTER_PACKAGE_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2221,29 +2215,12 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_PACKAGE - * macro when the function needs to set up a metadata tag and is also a - * VOL entry-point. */ -#define FUNC_ENTER_PACKAGE_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC { \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all "normal" staticly-scoped functions that are VOL entry-points */ -#define FUNC_ENTER_STATIC_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2266,17 +2243,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_STATIC - * macro when the function needs to set up a metadata tag and is a VOL - * entry-point. */ -#define FUNC_ENTER_STATIC_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /*------------------------------------------------------------------------- * Purpose: Register function exit for code profiling. This should be @@ -2331,13 +2297,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -#define FUNC_LEAVE_NOAPI_VOL(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - #define FUNC_LEAVE_NOAPI_VOID \ ; \ } /*end scope from end of FUNC_ENTER*/ \ @@ -2365,15 +2324,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -/* Use this macro when exiting a VOL entry-point function that set up a metadata tag */ -#define FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5AC_tag(prev_tag, NULL); \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - /****************************************/ /* Revisions to FUNC_ENTER/LEAVE Macros */ diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index d00a92b..e61966f 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'dset3' - major: Links - minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "dset3" diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 99e8530..4a5f545 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -2,61 +2,55 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' major: File accessibilty minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index a888ba9..1f9241a 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #007: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #008: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #009: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #010: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index a888ba9..1f9241a 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #007: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #008: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #009: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #010: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index 22b4318..648906b 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index 22b4318..648906b 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index 55aeb4a..733b652 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'bogus' - major: Links - minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "bogus" -- cgit v0.12 From deaa1db8521f155ab990a79cc52675ee82a76608 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 18 Sep 2018 17:31:40 -0500 Subject: HDFFV-10332 Use pre-generated files --- release_docs/RELEASE.txt | 7 ++- src/CMakeLists.txt | 109 ++++++++++++++++++++++++++++------------------- 2 files changed, 70 insertions(+), 46 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c8c7d5c..6aa7a70 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -84,7 +84,12 @@ New Features Library: -------- - - + - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. + + Rather than always running H5detect and generating H5Tinit.c and + H5make_libsettings.c, supply a location for those files. + + (ADB - 2018/09/18, HDFFV-10332) Parallel Library: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee06f06..1cd0a10 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -853,38 +853,50 @@ endif () # Setup the H5detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) -TARGET_C_PROPERTIES (H5detect STATIC) -target_link_libraries (H5detect - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> - INTERFACE $<$:"-O0"> -) +option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) +if (HDF5_USE_PREGEN) + set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR}) +else () + set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR}) +endif () -add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/H5Tinit.c - DEPENDS H5detect -) +if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) + add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) + target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) + TARGET_C_PROPERTIES (H5detect STATIC) + target_link_libraries (H5detect + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> + ) -add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) -TARGET_C_PROPERTIES (H5make_libsettings STATIC) -target_link_libraries (H5make_libsettings - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> - INTERFACE $<$:"-O0"> -) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) +endif () -add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} -) +if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) + add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) + target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) + TARGET_C_PROPERTIES (H5make_libsettings STATIC) + target_link_libraries (H5make_libsettings + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> + ) + + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) +endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" #all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" @@ -893,7 +905,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- -set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) +set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} @@ -922,21 +934,28 @@ set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared - ) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} - ) - set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + ) + endif () + + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + endif () + + set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -- cgit v0.12 From eb78fd88325d58a95c026129f1e2b4c7c50f621a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 18 Sep 2018 22:57:37 -0700 Subject: Develop normalization with vol_integration. Mostly peripheral things like the tools and wrappers, with just enough core library code to support that. --- MANIFEST | 2 +- bin/make_err | 8 +- c++/src/Makefile.am | 10 +- c++/test/tattr.cpp | 8 +- fortran/test/tH5F.F90 | 2 - hl/tools/h5watch/swmr_check_compat_vfd.c | 2 +- src/H5.c | 20 +- src/H5E.c | 543 +++++++++++++------------- src/H5Edeprec.c | 138 +++---- src/H5Eint.c | 348 ++++++++--------- src/H5Epkg.h | 20 +- src/H5FDpkg.h | 2 +- src/H5FDtest.c | 6 +- src/H5private.h | 3 +- src/H5system.c | 10 +- test/accum.c | 39 +- test/accum_swmr_reader.c | 10 +- test/dsets.c | 101 +++-- test/flush1.c | 2 +- test/flush2.c | 2 +- test/flushrefresh.c | 107 ++--- test/links.c | 16 +- test/swmr.c | 162 ++++---- test/swmr_check_compat_vfd.c | 2 +- tools/src/h5format_convert/h5format_convert.c | 164 ++++---- tools/src/h5jam/h5jam.c | 30 +- tools/src/misc/h5debug.c | 2 +- tools/test/h5diff/h5diffgentest.c | 164 ++++---- tools/test/h5jam/tellub.c | 182 ++++----- tools/test/h5repack/h5repack.sh.in | 1 + tools/test/h5stat/testh5stat.sh.in | 1 - 31 files changed, 1033 insertions(+), 1074 deletions(-) diff --git a/MANIFEST b/MANIFEST index f011e94..117c531 100644 --- a/MANIFEST +++ b/MANIFEST @@ -526,8 +526,8 @@ ./src/H5CS.c ./src/H5CSprivate.h ./src/H5CX.c -./src/H5CXprivate.h ./src/H5CXmodule.h +./src/H5CXprivate.h ./src/H5D.c ./src/H5Dbtree.c ./src/H5Dbtree2.c diff --git a/bin/make_err b/bin/make_err index bfe8861..623c1b6 100755 --- a/bin/make_err +++ b/bin/make_err @@ -244,8 +244,8 @@ sub create_init ($) { print HEADER "/* Major error codes */\n"; print HEADER "/*********************/\n\n"; foreach $name (keys %major) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; - print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n"; @@ -260,8 +260,8 @@ sub create_init ($) { # Iterate over all the minor errors in each section for $name ( @{$section_list{$sect_name}}) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; - print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n"; diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 949325a..eb50209 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -32,15 +32,15 @@ bin_SCRIPTS=h5c++ # Source files for the library libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp \ - H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ - H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ - H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ + H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ + H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ H5DcreatProp.cpp H5Location.cpp H5AbstractDs.cpp \ H5Attribute.cpp H5Object.cpp H5OcreatProp.cpp \ - H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ + H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp \ - H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ + H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ H5File.cpp # HDF5 C++ library depends on HDF5 Library. diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index bdf6d80..4734755 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1712,7 +1712,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, // Close property list dcpl.close(); - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable // Add attributes, until just before converting to dense storage char attr_name[NAME_BUF_SIZE]; @@ -1727,7 +1727,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, attr.write(PredType::NATIVE_UINT, &attr_num); } // end for - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable { // Add one more attribute, to push into "dense" storage @@ -1815,8 +1815,8 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, ds_space.close(); // Check on dataset's attribute storage status. - // NOTE: Wrappers not available yet (H5O_is_attr_empty_test - // and H5O_is_attr_dense_test) + // NOTE: Wrappers not available yet (H5O__is_attr_empty_test + // and H5O__is_attr_dense_test) // Close dataset dataset.close(); diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index 72920f2..ee386dd 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -30,8 +30,6 @@ ! access the dataset from the second file as a member of a group ! in the first file. - - MODULE TH5F CONTAINS diff --git a/hl/tools/h5watch/swmr_check_compat_vfd.c b/hl/tools/h5watch/swmr_check_compat_vfd.c index 7d11a73..26f76cb 100644 --- a/hl/tools/h5watch/swmr_check_compat_vfd.c +++ b/hl/tools/h5watch/swmr_check_compat_vfd.c @@ -48,7 +48,7 @@ main(void) driver = HDgetenv("HDF5_DRIVER"); - if(H5FD_supports_swmr_test(driver)) + if(H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; else return EXIT_FAILURE; diff --git a/src/H5.c b/src/H5.c index 1b13fea..32af55b 100644 --- a/src/H5.c +++ b/src/H5.c @@ -262,7 +262,7 @@ H5_term_library(void) /* Don't do anything if the library is already closed */ if(!(H5_INIT_GLOBAL)) - goto done; + goto done; /* Indicate that the library is being shut down */ H5_TERM_GLOBAL = TRUE; @@ -379,18 +379,18 @@ H5_term_library(void) * 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; + int mpi_initialized; + int mpi_finalized; + int mpe_code; - MPI_Initialized(&mpi_initialized); - MPI_Finalized(&mpi_finalized); + 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 */ + 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 diff --git a/src/H5E.c b/src/H5E.c index eecf6e7..170133e 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -49,11 +49,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Epkg.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -78,18 +79,17 @@ /* Local Prototypes */ /********************/ /* Static function declarations */ -static herr_t H5E_set_default_auto(H5E_t *stk); -static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name, - const char *version); -static herr_t H5E_unregister_class(H5E_cls_t *cls); -static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size); -static int H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); -static herr_t H5E_close_msg(H5E_msg_t *err); -static H5E_msg_t *H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); -static H5E_t *H5E_get_current_stack(void); -static herr_t H5E_set_current_stack(H5E_t *estack); -static herr_t H5E_close_stack(H5E_t *err_stack); -static ssize_t H5E_get_num(const H5E_t *err_stack); +static herr_t H5E__set_default_auto(H5E_t *stk); +static H5E_cls_t *H5E__register_class(const char *cls_name, const char *lib_name, const char *version); +static herr_t H5E__unregister_class(H5E_cls_t *cls); +static ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size); +static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); +static herr_t H5E__close_msg(H5E_msg_t *err); +static H5E_msg_t *H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); +static H5E_t *H5E__get_current_stack(void); +static herr_t H5E__set_current_stack(H5E_t *estack); +static herr_t H5E__close_stack(H5E_t *err_stack); +static ssize_t H5E__get_num(const H5E_t *err_stack); /*********************/ @@ -123,7 +123,7 @@ static const H5I_class_t H5I_ERRCLS_CLS[1] = {{ H5I_ERROR_CLASS, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_unregister_class /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__unregister_class /* Callback routine for closing objects of this class */ }}; /* Error message ID class */ @@ -131,7 +131,7 @@ static const H5I_class_t H5I_ERRMSG_CLS[1] = {{ H5I_ERROR_MSG, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_close_msg /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */ }}; /* Error stack ID class */ @@ -139,19 +139,17 @@ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ H5I_ERROR_STACK, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_close_stack /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__close_stack /* Callback routine for closing objects of this class */ }}; /*------------------------------------------------------------------------- - * Function: H5E_init + * Function: H5E_init * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, June 29, 2004 @@ -176,7 +174,7 @@ done: * * Purpose: Initialize interface-specific information * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -207,13 +205,13 @@ H5E__init_package(void) #ifndef H5_HAVE_THREADSAFE H5E_stack_g[0].nused = 0; - H5E_set_default_auto(H5E_stack_g); + H5E__set_default_auto(H5E_stack_g); #endif /* H5_HAVE_THREADSAFE */ /* Allocate the HDF5 error class */ HDassert(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))) + 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") 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") @@ -227,14 +225,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_term_package + * Function: H5E_term_package * - * Purpose: Terminates the H5E interface + * Purpose: Terminates the H5E interface * - * Return: Success: Positive if anything is done that might - * affect other interfaces; zero otherwise. + * Return: Success: Positive if anything is done that might + * affect other interfaces; zero otherwise. * - * Failure: Negative. + * Failure: Negative * * Programmer: Raymond Lu * Tuesday, July 22, 2003 @@ -262,8 +260,8 @@ H5E_term_package(void) (void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE); /* Clear all the error classes */ - if(ncls > 0) { - (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); + if(ncls > 0) { + (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); /* Reset the HDF5 error class, if its been closed */ if(H5I_nmembers(H5I_ERROR_CLASS) == 0) @@ -271,8 +269,8 @@ H5E_term_package(void) } /* end if */ /* Clear all the error messages */ - if(nmsg > 0) { - (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); + if(nmsg > 0) { + (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); /* Reset the HDF5 error messages, if they've been closed */ if(H5I_nmembers(H5I_ERROR_MSG) == 0) { @@ -282,17 +280,17 @@ H5E_term_package(void) } /* end if */ n++; /*H5I*/ - } /* end if */ + } /* end if */ else { - /* Destroy the error class, message, and stack id groups */ - n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); + /* Destroy the error class, message, and stack id groups */ + n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); - /* Mark closed */ + /* Mark closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; - } /* end else */ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) @@ -300,12 +298,12 @@ H5E_term_package(void) /*-------------------------------------------------------------------------- - * Function: H5E_set_default_auto + * Function: H5E__set_default_auto * * Purpose: Initialize "automatic" error stack reporting info to library * default * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -313,9 +311,9 @@ H5E_term_package(void) *-------------------------------------------------------------------------- */ static herr_t -H5E_set_default_auto(H5E_t *stk) +H5E__set_default_auto(H5E_t *stk) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifndef H5_NO_DEPRECATED_SYMBOLS #ifdef H5_USE_16_API_DEFAULT @@ -334,19 +332,19 @@ H5E_set_default_auto(H5E_t *stk) stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_default_auto() */ +} /* end H5E__set_default_auto() */ #ifdef H5_HAVE_THREADSAFE /*------------------------------------------------------------------------- - * Function: H5E_get_stack + * Function: H5E__get_stack * - * Purpose: Support function for H5E_get_my_stack() to initialize and + * Purpose: Support function for H5E__get_my_stack() to initialize and * acquire per-thread error stack. * - * Return: Success: error stack (H5E_t *) + * Return: Success: Pointer to an error stack struct (H5E_t *) * - * Failure: NULL + * Failure: NULL * * Programmer: Chee Wai LEE * April 24, 2000 @@ -354,11 +352,11 @@ H5E_set_default_auto(H5E_t *stk) *------------------------------------------------------------------------- */ H5E_t * -H5E_get_stack(void) +H5E__get_stack(void) { H5E_t *estack = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR estack = (H5E_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g); @@ -377,7 +375,7 @@ H5E_get_stack(void) /* Set the thread-specific info */ estack->nused = 0; - H5E_set_default_auto(estack); + H5E__set_default_auto(estack); /* (It's not necessary to release this in this API, it is * released by the "key destructor" set up in the H5TS @@ -388,16 +386,16 @@ H5E_get_stack(void) /* Set return value */ FUNC_LEAVE_NOAPI(estack) -} /* end H5E_get_stack() */ +} /* end H5E__get_stack() */ #endif /* H5_HAVE_THREADSAFE */ /*------------------------------------------------------------------------- - * Function: H5E_free_class + * Function: H5E_free_class * - * Purpose: Private function to free an error class. + * Purpose: Private function to free an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, January 22, 2009 @@ -423,11 +421,12 @@ H5E_free_class(H5E_cls_t *cls) /*------------------------------------------------------------------------- - * Function: H5Eregister_class + * Function: H5Eregister_class * - * Purpose: Registers an error class. + * Purpose: Registers an error class. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: An ID for the error class + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -438,22 +437,22 @@ hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version) { H5E_cls_t *cls; /* Pointer to error class */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*s*s*s", cls_name, lib_name, version); /* Check arguments */ if(cls_name == NULL || lib_name == NULL || version == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "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, FAIL, "can't create error class") + 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") /* 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, FAIL, "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) @@ -461,11 +460,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_register_class + * Function: H5E__register_class * - * Purpose: Private function to register an error class. + * Purpose: Private function to register an error class. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: Pointer to an error class struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -473,12 +473,12 @@ done: *------------------------------------------------------------------------- */ static H5E_cls_t * -H5E_register_class(const char *cls_name, const char *lib_name, const char *version) +H5E__register_class(const char *cls_name, const char *lib_name, const char *version) { H5E_cls_t *cls = NULL; /* Pointer to error class */ H5E_cls_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls_name); @@ -506,15 +506,15 @@ done: HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_register_class() */ +} /* end H5E__register_class() */ /*------------------------------------------------------------------------- - * Function: H5Eunregister_class + * Function: H5Eunregister_class * - * Purpose: Closes an error class. + * Purpose: Closes an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -546,11 +546,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_unregister_class + * Function: H5E__unregister_class * - * Purpose: Private function to close an error class. + * Purpose: Private function to close an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -558,17 +558,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_unregister_class(H5E_cls_t *cls) +H5E__unregister_class(H5E_cls_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(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) + 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") /* Free error class structure */ @@ -577,16 +577,16 @@ H5E_unregister_class(H5E_cls_t *cls) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_unregister_class() */ +} /* end H5E__unregister_class() */ /*------------------------------------------------------------------------- - * Function: H5Eget_class_name + * Function: H5Eget_class_name * - * Purpose: Retrieves error class name. + * Purpose: Retrieves error class name. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Name length (zero means no name) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -597,18 +597,18 @@ ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size) { H5E_cls_t *cls; /* Pointer to error class */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", class_id, name, 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, FAIL, "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, FAIL, "can't get error 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") done: FUNC_LEAVE_API(ret_value) @@ -616,12 +616,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_class_name + * Function: H5E__get_class_name * - * Purpose: Private function to retrieve error class name. + * Purpose: Private function to retrieve error class name. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Name length (zero means no name) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -629,11 +629,11 @@ done: *------------------------------------------------------------------------- */ static ssize_t -H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) +H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) { - ssize_t len = 0; /* Length of error class's name */ + ssize_t len = -1; /* Length of error class's name */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(cls); @@ -650,16 +650,17 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) /* Return the full length */ FUNC_LEAVE_NOAPI(len) -} /* end H5E_get_class_name() */ +} /* end H5E__get_class_name() */ /*------------------------------------------------------------------------- - * Function: H5E_close_msg_cb + * Function: H5E__close_msg_cb * * Purpose: H5I_iterate callback function to close error messages in the * error class. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: H5_ITER_CONT (0) + * Failure: H5_ITER_ERROR (-1) * * Programmer: Raymond Lu * July 14, 2003 @@ -667,36 +668,36 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) *------------------------------------------------------------------------- */ static int -H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) +H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) { H5E_msg_t *err_msg = (H5E_msg_t*)obj_ptr; H5E_cls_t *cls = (H5E_cls_t*)udata; - herr_t ret_value = SUCCEED; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(err_msg); /* Close the message if it is in the class being closed */ if(err_msg->cls == cls) { - if(H5E_close_msg(err_msg) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, FAIL, "unable to close error message") + if(H5E__close_msg(err_msg) < 0) + 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, FAIL, "unable to remove error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_close_msg_cb() */ +} /* end H5E__close_msg_cb() */ /*------------------------------------------------------------------------- - * Function: H5Eclose_msg + * Function: H5Eclose_msg * - * Purpose: Closes a major or minor error. + * Purpose: Closes a major or minor error. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -725,11 +726,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_close_msg + * Function: H5E__close_msg * - * Purpose: Private function to close an error messge. + * Purpose: Private function to close an error messge. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -737,9 +738,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_close_msg(H5E_msg_t *err) +H5E__close_msg(H5E_msg_t *err) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err); @@ -750,15 +751,16 @@ H5E_close_msg(H5E_msg_t *err) err = H5FL_FREE(H5E_msg_t, err); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_close_msg() */ +} /* end H5E__close_msg() */ /*------------------------------------------------------------------------- - * Function: H5Ecreate_msg + * Function: H5Ecreate_msg * - * Purpose: Creates a major or minor error, returns an ID. + * Purpose: Creates a major or minor error, returns an ID. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: An error ID + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -770,39 +772,40 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str) { H5E_cls_t *cls; /* Pointer to error class */ H5E_msg_t *msg; /* Pointer to new error message */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iEt*s", class_id, msg_type, msg_str); /* Check arguments */ if(msg_type != H5E_MAJOR && msg_type != H5E_MINOR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "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, FAIL, "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, FAIL, "not a 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, FAIL, "can't create error message") + 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") /* 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, FAIL, "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) } /* end H5Ecreate_msg() */ /*------------------------------------------------------------------------- - * Function: H5E_create_msg + * Function: H5E__create_msg * - * Purpose: Private function to create a major or minor error. + * Purpose: Private function to create a major or minor error. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: Pointer to a message struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -810,12 +813,12 @@ done: *------------------------------------------------------------------------- */ static H5E_msg_t * -H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) +H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) { H5E_msg_t *msg = NULL; /* Pointer to new error message */ H5E_msg_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls); @@ -837,20 +840,20 @@ 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) < 0) + if(msg && H5E__close_msg(msg) < 0) HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_create_msg() */ +} /* end H5E__create_msg() */ /*------------------------------------------------------------------------- - * Function: H5Eget_msg + * Function: H5Eget_msg * - * Purpose: Retrieves an error message. + * Purpose: Retrieves an error message. * - * Return: Non-negative for message length if succeeds(zero means no message); - * otherwise returns negative value. + * Return: Success: Message length (zero means no message) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -861,18 +864,18 @@ ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size) { H5E_msg_t *msg; /* Pointer to error message */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size); /* Get the message object */ if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "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, FAIL, "can't get error message 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") done: FUNC_LEAVE_API(ret_value) @@ -880,11 +883,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ecreate_stack + * Function: H5Ecreate_stack * - * Purpose: Creates a new, empty, error stack. + * Purpose: Creates a new, empty, error stack. * - * Return: Non-negative value as stack ID on success/Negative on failure + * Return: Success: An error stack ID + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -895,21 +899,21 @@ hid_t H5Ecreate_stack(void) { H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE0("i",""); /* Allocate a new error stack */ if(NULL == (stk = H5FL_CALLOC(H5E_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "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); + 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, FAIL, "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) @@ -917,12 +921,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_current_stack + * Function: H5Eget_current_stack * - * Purpose: Registers current error stack, returns object handle for it, + * Purpose: Registers current error stack, returns object handle for it, * clears it. * - * Return: Non-negative value as stack ID on success/Negative on failure + * Return: Success: An error stack ID + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -933,19 +938,19 @@ hid_t H5Eget_current_stack(void) { H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(FAIL) + FUNC_ENTER_API_NOCLEAR(H5I_INVALID_HID) H5TRACE0("i",""); /* Get the current stack */ - if(NULL == (stk = H5E_get_current_stack())) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error stack") + if(NULL == (stk = H5E__get_current_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, FAIL, "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) @@ -953,11 +958,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_current_stack + * Function: H5E__get_current_stack * - * Purpose: Private function to register an error stack. + * Purpose: Private function to register an error stack. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: Pointer to an error class struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -965,17 +971,17 @@ done: *------------------------------------------------------------------------- */ static H5E_t * -H5E_get_current_stack(void) +H5E__get_current_stack(void) { H5E_t *current_stack; /* Pointer to the current error stack */ H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */ unsigned u; /* Local index variable */ H5E_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* 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 */ + 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") /* Allocate a new error stack */ @@ -1026,24 +1032,19 @@ done: estack_copy = H5FL_FREE(H5E_t, estack_copy); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_get_current_stack() */ +} /* end H5E__get_current_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eset_current_stack + * Function: H5Eset_current_stack * - * Purpose: Replaces current stack with specified stack. This closes the - * stack ID also. + * Purpose: Replaces current stack with specified stack. This closes the + * stack ID also. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 15, 2003 - * - * Modification: - * Raymond Lu - * 7 September 2010 - * Also closes the stack to avoid potential problem (bug 1799) * *------------------------------------------------------------------------- */ @@ -1061,7 +1062,7 @@ H5Eset_current_stack(hid_t err_stack) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Set the current error stack */ - if(H5E_set_current_stack(estack) < 0) + if(H5E__set_current_stack(estack) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack") /* @@ -1078,11 +1079,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_set_current_stack + * Function: H5E__set_current_stack * - * Purpose: Private function to replace an error stack. + * Purpose: Private function to replace an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1090,19 +1091,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_set_current_stack(H5E_t *estack) +H5E__set_current_stack(H5E_t *estack) { H5E_t *current_stack; /* Default error stack */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(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 */ + 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") /* Empty current error stack */ @@ -1138,15 +1139,15 @@ H5E_set_current_stack(H5E_t *estack) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_set_current_stack() */ +} /* end H5E__set_current_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eclose_stack + * Function: H5Eclose_stack * - * Purpose: Closes an error stack. + * Purpose: Closes an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -1180,11 +1181,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_close_stack + * Function: H5E__close_stack * - * Purpose: Private function to close an error stack. + * Purpose: Private function to close an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -1192,9 +1193,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_close_stack(H5E_t *estack) +H5E__close_stack(H5E_t *estack) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(estack); @@ -1206,15 +1207,16 @@ H5E_close_stack(H5E_t *estack) estack = H5FL_FREE(H5E_t, estack); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_close_stack() */ +} /* end H5E__close_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eget_num + * Function: H5Eget_num * - * Purpose: Retrieves the number of error message. + * Purpose: Retrieves the number of error messages. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: The number of errors + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1228,13 +1230,13 @@ H5Eget_num(hid_t error_stack_id) ssize_t ret_value; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(FAIL) + FUNC_ENTER_API_NOCLEAR((-1)) H5TRACE1("Zs", "i", error_stack_id); /* Need to check for errors */ 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, FAIL, "can't get current 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, (-1), "can't get current error stack") } /* end if */ else { /* Only clear the error stack if it's not the default stack */ @@ -1242,12 +1244,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, FAIL, "not a 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, FAIL, "can't get number of errors") + if((ret_value = H5E__get_num(estack)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors") done: FUNC_LEAVE_API(ret_value) @@ -1255,11 +1257,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_num + * Function: H5E__get_num * - * Purpose: Private function to retrieve number of errors in error stack. + * Purpose: Private function to retrieve number of errors in error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: The number of errors + * Failure: -1 (can't fail at this time) * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1267,22 +1270,22 @@ done: *------------------------------------------------------------------------- */ static ssize_t -H5E_get_num(const H5E_t *estack) +H5E__get_num(const H5E_t *estack) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(estack); FUNC_LEAVE_NOAPI((ssize_t)estack->nused) -} /* end H5E_get_num() */ +} /* end H5E__get_num() */ /*------------------------------------------------------------------------- - * Function: H5Epop + * Function: H5Epop * - * Purpose: Deletes some error messages from the top of error stack. + * Purpose: Deletes some error messages from the top of error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 16, 2003 @@ -1301,7 +1304,7 @@ H5Epop(hid_t err_stack, size_t count) /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + 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") } /* end if */ else { @@ -1318,7 +1321,7 @@ H5Epop(hid_t err_stack, size_t count) count = estack->nused; /* Pop the errors off the stack */ - if(H5E_pop(estack, count) < 0) + if(H5E__pop(estack, count) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't pop errors from stack") done: @@ -1327,22 +1330,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Epush2 + * Function: H5Epush2 * - * Purpose: Pushes a new error record onto error stack for the current - * thread. The error has major and minor IDs MAJ_ID and - * MIN_ID, the name of a function where the error was detected, - * the name of the file where the error was detected, the - * line within that file, and an error description string. The - * function name, file name, and error description strings must - * be statically allocated. + * Purpose: Pushes a new error record onto error stack for the current + * thread. The error has major and minor IDs MAJ_ID and + * MIN_ID, the name of a function where the error was detected, + * the name of the file where the error was detected, the + * line within that file, and an error description string. The + * function name, file name, and error description strings must + * be statically allocated. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, October 18, 1999 * - * Notes: Basically a new public API wrapper around the H5E__push_stack + * Notes: Basically a new public API wrapper around the H5E__push_stack * function. * *------------------------------------------------------------------------- @@ -1435,11 +1438,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eclear2 + * Function: H5Eclear2 * - * Purpose: Clears the error stack for the specified error stack. + * Purpose: Clears the error stack for the specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -1477,14 +1480,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eprint2 + * Function: H5Eprint2 * - * Purpose: Prints the error stack in some default way. This is just a - * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there - * own more specific error handlers. + * Purpose: Prints the error stack in some default way. This is just a + * convenience function for H5Ewalk() with a function that + * prints error messages. Users are encouraged to write there + * own more specific error handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1503,7 +1506,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + 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") } /* end if */ else { @@ -1515,7 +1518,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) } /* end else */ /* Print error stack */ - if(H5E_print(estack, stream, FALSE) < 0) + if(H5E__print(estack, stream, FALSE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: @@ -1524,12 +1527,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ewalk2 + * Function: H5Ewalk2 * - * Purpose: Walks the error stack for the current thread and calls some - * function for each error along the way. + * Purpose: Walks the error stack for the current thread and calls some + * function for each error along the way. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1549,7 +1552,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + 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") } /* end if */ else { @@ -1563,7 +1566,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Walk the error stack */ op.vers = 2; op.u.func2 = stack_func; - if(H5E_walk(estack, direction, &op, client_data) < 0) + if(H5E__walk(estack, direction, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: @@ -1572,23 +1575,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_auto2 + * Function: H5Eget_auto2 * - * Purpose: Returns the current settings for the automatic error stack - * traversal function and its data for specific error stack. - * Either (or both) arguments may be null in which case the - * value is not returned. + * Purpose: Returns the current settings for the automatic error stack + * traversal function and its data for specific error stack. + * Either (or both) arguments may be null in which case the + * value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Saturday, February 28, 1998 * - * Modification:Raymond Lu - * 4 October 2010 - * If the printing function isn't the default H5Eprint1 or 2, - * and H5Eset_auto1 has been called to set the old style - * printing function, a call to H5Eget_auto2 should fail. *------------------------------------------------------------------------- */ herr_t @@ -1602,7 +1600,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) H5TRACE3("e", "i*x**x", estack_id, func, 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 */ + 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") } /* end if */ else @@ -1610,7 +1608,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &op, client_data) < 0) + if(H5E__get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1628,28 +1626,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eset_auto2 + * Function: H5Eset_auto2 * - * Purpose: Turns on or off automatic printing of errors for certain + * Purpose: Turns on or off automatic printing of errors for certain * 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. * - * The default values before this function is called are - * H5Eprint2() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint2() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 * - * Modification:Raymond Lu - * 4 October 2010 - * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -1664,7 +1659,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) H5TRACE3("e", "ix*x", estack_id, func, 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 */ + 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") } /* end if */ else @@ -1673,7 +1668,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) #ifndef H5_NO_DEPRECATED_SYMBOLS /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &op, NULL) < 0) + if(H5E__get_auto(estack, &op, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Set the automatic error reporting information */ @@ -1688,7 +1683,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) /* Set the automatic error reporting function */ op.func2 = func; - if(H5E_set_auto(estack, &op, client_data) < 0) + if(H5E__set_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: @@ -1697,14 +1692,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eauto_is_v2 + * Function: H5Eauto_is_v2 * - * Purpose: Determines if the error auto reporting function for an + * Purpose: Determines if the error auto reporting function for an * error stack conforms to the H5E_auto_stack_t typedef * or the H5E_auto_t typedef. The IS_STACK parameter is set * to 1 for the first case and 0 for the latter case. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, September 8, 2004 @@ -1721,7 +1716,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) H5TRACE2("e", "i*Iu", estack_id, 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 */ + 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") } /* end if */ else diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index fc3eb9c..603d448 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -35,11 +35,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Epkg.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -80,12 +80,12 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Eget_major + * Function: H5Eget_major * - * Purpose: Retrieves a major error message. + * Purpose: Retrieves a major error message. * - * Return: Returns message if succeeds. - * otherwise returns NULL. + * Return: Success: Pointer to the message + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -106,21 +106,21 @@ 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") + 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") 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++; msg_str = (char *)H5MM_malloc((size_t)size); /* 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") + 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") ret_value = msg_str; @@ -133,12 +133,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_minor + * Function: H5Eget_minor * - * Purpose: Retrieves a minor error message. + * Purpose: Retrieves a minor error message. * - * Return: Returns message if succeeds. - * otherwise returns NULL. + * Return: Success: Pointer to the message + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -159,21 +159,21 @@ 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") + 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") 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++; msg_str = (char *)H5MM_malloc((size_t)size); /* 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") + 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") ret_value = msg_str; @@ -186,19 +186,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Epush1 + * Function: H5Epush1 * - * Purpose: This function definition is for backward compatibility only. + * Purpose: This function definition is for backward compatibility only. * It doesn't have error stack and error class as parameters. * The old definition of major and minor is casted as HID_T * in H5Epublic.h * - * Notes: Basically a public API wrapper around the H5E_push2 + * Notes: Basically a public API wrapper around the H5E_push2 * function. For backward compatibility, it maintains the * same parameter as the old function, in contrary to * H5Epush2. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sep 16, 2003 @@ -225,12 +225,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eclear1 + * Function: H5Eclear1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Clears the error stack for the specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -256,15 +256,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eprint1 + * Function: H5Eprint1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Prints the error stack in some default way. This is just a - * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there - * own more specific error handlers. + * convenience function for H5Ewalk() with a function that + * prints error messages. Users are encouraged to write there + * own more specific error handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 @@ -281,11 +281,11 @@ H5Eprint1(FILE *stream) FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + 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") /* Print error stack */ - if(H5E_print(estack, stream, TRUE) < 0) + if(H5E__print(estack, stream, TRUE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: @@ -294,13 +294,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ewalk1 + * Function: H5Ewalk1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Walks the error stack for the current thread and calls some - * function for each error along the way. + * function for each error along the way. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 @@ -318,13 +318,13 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + 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") /* Walk the error stack */ walk_op.vers = 1; walk_op.u.func1 = func; - if(H5E_walk(estack, direction, &walk_op, client_data) < 0) + if(H5E__walk(estack, direction, &walk_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: @@ -333,24 +333,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_auto1 + * Function: H5Eget_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Returns the current settings for the automatic error stack - * traversal function and its data for specific error stack. - * Either (or both) arguments may be null in which case the - * value is not returned. + * traversal function and its data for specific error stack. + * Either (or both) arguments may be null in which case the + * value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 * - * Modification:Raymond Lu - * 4 October 2010 - * If the printing function isn't the default H5Eprint1 or 2, - * and H5Eset_auto2 has been called to set the new style - * printing function, a call to H5Eget_auto1 should fail. *------------------------------------------------------------------------- */ herr_t @@ -364,11 +359,11 @@ H5Eget_auto1(H5E_auto1_t *func, void **client_data) H5TRACE2("e", "*x**x", func, client_data); /* Retrieve default error stack */ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + 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") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &auto_op, client_data) < 0) + if(H5E__get_auto(estack, &auto_op, client_data) < 0) 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 */ @@ -384,29 +379,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eset_auto1 + * Function: H5Eset_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Turns on or off automatic printing of errors for certain * 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. * - * The default values before this function is called are - * H5Eprint1() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint1() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 * - * Modification:Raymond Lu - * 4 October 2010 - * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -420,11 +412,11 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) FUNC_ENTER_API_NOCLEAR(FAIL) H5TRACE2("e", "x*x", func, client_data); - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + 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") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &auto_op, NULL) < 0) + if(H5E__get_auto(estack, &auto_op, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Set the automatic error reporting information */ @@ -435,7 +427,7 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) auto_op.is_default = TRUE; auto_op.func1 = func; - if(H5E_set_auto(estack, &auto_op, client_data) < 0) + if(H5E__set_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: diff --git a/src/H5Eint.c b/src/H5Eint.c index 15953af..540c9b1 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -32,11 +32,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Epkg.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -64,12 +64,12 @@ typedef struct H5E_print_t { /* Local Prototypes */ /********************/ #ifndef H5_NO_DEPRECATED_SYMBOLS -static herr_t H5E_walk1_cb(int n, H5E_error1_t *err_desc, +static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -static herr_t H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, +static herr_t H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); -static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries); +static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries); /*********************/ @@ -108,18 +108,18 @@ hid_t H5E_ERR_CLS_g = FAIL; * variables used for MPI error reporting */ char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; -int H5E_mpi_error_str_len; +int H5E_mpi_error_str_len; #endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- - * Function: H5E_get_msg + * Function: H5E__get_msg * - * Purpose: Private function to retrieve an error message. + * Purpose: Private function to retrieve an error message. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Message length (zero means no message) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -127,11 +127,11 @@ int H5E_mpi_error_str_len; *------------------------------------------------------------------------- */ ssize_t -H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) +H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) { ssize_t len = -1; /* Length of error message */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(msg); @@ -152,37 +152,37 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) /* Set the return value to the full length of the message */ FUNC_LEAVE_NOAPI(len) -} /* end H5E_get_msg() */ +} /* end H5E__get_msg() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5E_walk1_cb + * Function: H5E__walk1_cb * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * This is a default error stack traversal callback function - * that prints error messages to the specified output stream. - * This function is for backward compatibility with v1.6. - * It is not meant to be called directly but rather as an - * argument to the H5Ewalk() function. This function is called - * also by H5Eprint(). Application writers are encouraged to - * use this function as a model for their own error stack - * walking functions. + * that prints error messages to the specified output stream. + * This function is for backward compatibility with v1.6. + * It is not meant to be called directly but rather as an + * argument to the H5Ewalk() function. This function is called + * also by H5Eprint(). Application writers are encouraged to + * use this function as a model for their own error stack + * walking functions. * - * N is a counter for how many times this function has been - * called for this particular traversal of the stack. It always - * begins at zero for the first error on the stack (either the - * top or bottom error, or even both, depending on the traversal - * direction and the size of the stack). + * N is a counter for how many times this function has been + * called for this particular traversal of the stack. It always + * begins at zero for the first error on the stack (either the + * top or bottom error, or even both, depending on the traversal + * direction and the size of the stack). * - * ERR_DESC is an error description. It contains all the - * information about a particular error. + * ERR_DESC is an error description. It contains all the + * information about a particular error. * - * CLIENT_DATA is the same pointer that was passed as the - * CLIENT_DATA argument of H5Ewalk(). It is expected to be a - * file pointer (or stderr if null). + * CLIENT_DATA is the same pointer that was passed as the + * CLIENT_DATA argument of H5Ewalk(). It is expected to be a + * file pointer (or stderr if null). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 11, 2006 @@ -190,7 +190,7 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) *------------------------------------------------------------------------- */ static herr_t -H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) +H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -202,7 +202,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err_desc); @@ -239,7 +239,7 @@ 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; - fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + 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)")); @@ -249,22 +249,22 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) { int mpi_rank, mpi_initialized, mpi_finalized; - MPI_Initialized(&mpi_initialized); + MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); if(mpi_initialized && !mpi_finalized) { - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - fprintf(stream, "MPI-process %d", mpi_rank); - } /* end if */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + HDfprintf(stream, "MPI-process %d", mpi_rank); + } /* end if */ else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); + HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); #endif - fprintf(stream, ":\n"); + HDfprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -272,44 +272,44 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) have_desc=0; /* Print error message */ - fprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", + 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 : "")); - fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk1_cb() */ +} /* end H5E__walk1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- - * Function: H5E_walk2_cb + * Function: H5E__walk2_cb * - * Purpose: This is a default error stack traversal callback function - * that prints error messages to the specified output stream. - * It is not meant to be called directly but rather as an - * argument to the H5Ewalk2() function. This function is - * called also by H5Eprint2(). Application writers are - * encouraged to use this function as a model for their own - * error stack walking functions. + * Purpose: This is a default error stack traversal callback function + * that prints error messages to the specified output stream. + * It is not meant to be called directly but rather as an + * argument to the H5Ewalk2() function. This function is + * called also by H5Eprint2(). Application writers are + * encouraged to use this function as a model for their own + * error stack walking functions. * - * N is a counter for how many times this function has been - * called for this particular traversal of the stack. It always - * begins at zero for the first error on the stack (either the - * top or bottom error, or even both, depending on the traversal - * direction and the size of the stack). + * N is a counter for how many times this function has been + * called for this particular traversal of the stack. It always + * begins at zero for the first error on the stack (either the + * top or bottom error, or even both, depending on the traversal + * direction and the size of the stack). * - * ERR_DESC is an error description. It contains all the - * information about a particular error. + * ERR_DESC is an error description. It contains all the + * information about a particular error. * - * CLIENT_DATA is the same pointer that was passed as the - * CLIENT_DATA argument of H5Ewalk(). It is expected to be a - * file pointer (or stderr if null). + * CLIENT_DATA is the same pointer that was passed as the + * CLIENT_DATA argument of H5Ewalk(). It is expected to be a + * file pointer (or stderr if null). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -317,7 +317,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) +H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -329,7 +329,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err_desc); @@ -371,7 +371,7 @@ 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; - fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + 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)")); @@ -381,22 +381,22 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) { int mpi_rank, mpi_initialized, mpi_finalized; - MPI_Initialized(&mpi_initialized); + MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); if(mpi_initialized && !mpi_finalized) { - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - fprintf(stream, "MPI-process %d", mpi_rank); - } /* end if */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + HDfprintf(stream, "MPI-process %d", mpi_rank); + } /* end if */ else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); + HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); #endif - fprintf(stream, ":\n"); + HDfprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -404,28 +404,28 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) have_desc = 0; /* Print error message */ - fprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", + 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 : "")); - fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk2_cb() */ +} /* end H5E__walk2_cb() */ /*------------------------------------------------------------------------- - * Function: H5E_print + * Function: H5E__print * - * Purpose: Private function to print the error stack in some default + * Purpose: Private function to print the error stack in some default * way. This is just a convenience function for H5Ewalk() and * H5Ewalk2() with a function that prints error messages. * Users are encouraged to write there own more specific error * handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -433,13 +433,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) +H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) { H5E_print_t eprint; /* Callback information to pass to H5E_walk() */ H5E_walk_op_t walk_op; /* Error stack walking callback */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); @@ -457,8 +457,8 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) if(bk_compatible) { #ifndef H5_NO_DEPRECATED_SYMBOLS walk_op.vers = 1; - walk_op.u.func1 = H5E_walk1_cb; - if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) + 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") #else /* H5_NO_DEPRECATED_SYMBOLS */ HDassert(0 && "version 1 error stack print without deprecated symbols!"); @@ -466,40 +466,40 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) } /* 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) + 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") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_print() */ +} /* end H5E__print() */ /*------------------------------------------------------------------------- - * Function: H5E_walk + * Function: H5E__walk * - * Purpose: Private function for H5Ewalk. + * Purpose: Private function for H5Ewalk. * Walks the error stack, calling the specified function for - * each error on the stack. The DIRECTION argument determines - * whether the stack is walked from the inside out or the - * outside in. The value H5E_WALK_UPWARD means begin with the - * most specific error and end at the API; H5E_WALK_DOWNWARD - * means to start at the API and end at the inner-most function - * where the error was first detected. - * - * The function pointed to by STACK_FUNC will be called for - * each error record in the error stack. It's arguments will - * include an index number (beginning at zero regardless of - * stack traversal direction), an error stack entry, and the - * CLIENT_DATA pointer passed to H5E_print. - * - * The function FUNC is also provided for backward compatibility. - * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be - * compatible with older library. If BK_COMPATIBLE is FALSE, - * STACK_FUNC is used. - * - * Return: Non-negative on success/Negative on failure + * each error on the stack. The DIRECTION argument determines + * whether the stack is walked from the inside out or the + * outside in. The value H5E_WALK_UPWARD means begin with the + * most specific error and end at the API; H5E_WALK_DOWNWARD + * means to start at the API and end at the inner-most function + * where the error was first detected. + * + * The function pointed to by STACK_FUNC will be called for + * each error record in the error stack. It's arguments will + * include an index number (beginning at zero regardless of + * stack traversal direction), an error stack entry, and the + * CLIENT_DATA pointer passed to H5E_print. + * + * The function FUNC is also provided for backward compatibility. + * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be + * compatible with older library. If BK_COMPATIBLE is FALSE, + * STACK_FUNC is used. + * + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -507,14 +507,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, +H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data) { int i; /* Local index variable */ herr_t status; /* Status from callback function */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); @@ -587,18 +587,18 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk() */ +} /* end H5E__walk() */ /*------------------------------------------------------------------------- - * Function: H5E_get_auto + * Function: H5E__get_auto * - * Purpose: Private function to return the current settings for the + * Purpose: Private function to return the current settings for the * automatic error stack traversal function and its data * for specific error stack. Either (or both) arguments may * be null in which case the value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * July 18, 2003 @@ -606,9 +606,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) +H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(estack); @@ -619,26 +619,26 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) *client_data = estack->auto_data; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_get_auto2() */ +} /* end H5E__get_auto() */ /*------------------------------------------------------------------------- - * Function: H5E_set_auto + * Function: H5E__set_auto * - * Purpose: Private function to turn on or off automatic printing of + * Purpose: Private function to turn on or off automatic printing of * errors for certain 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. * - * The default values before this function is called are - * H5Eprint2() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint2() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -646,9 +646,9 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) *------------------------------------------------------------------------- */ herr_t -H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) +H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(estack); @@ -657,15 +657,15 @@ H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) estack->auto_data = client_data; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_auto() */ +} /* end H5E__set_auto() */ /*------------------------------------------------------------------------- - * Function: H5E_printf_stack + * Function: H5E_printf_stack * - * Purpose: Printf-like wrapper around H5E__push_stack. + * Purpose: Printf-like wrapper around H5E__push_stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, August 12, 2008 @@ -758,19 +758,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5E__push_stack + * Function: H5E__push_stack * - * Purpose: Pushes a new error record onto error stack for the current - * thread. The error has major and minor IDs MAJ_ID and - * MIN_ID, the name of a function where the error was detected, - * the name of the file where the error was detected, the - * line within that file, and an error description string. The - * function name, file name, and error description strings must - * be statically allocated (the FUNC_ENTER() macro takes care of - * the function name and file name automatically, but the - * programmer is responsible for the description string). + * Purpose: Pushes a new error record onto error stack for the current + * thread. The error has major and minor IDs MAJ_ID and + * MIN_ID, the name of a function where the error was detected, + * the name of the file where the error was detected, the + * line within that file, and an error description string. The + * function name, file name, and error description strings must + * be statically allocated (the FUNC_ENTER() macro takes care of + * the function name and file name automatically, but the + * programmer is responsible for the description string). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -799,7 +799,7 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line /* 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 */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_DONE(FAIL) /* @@ -845,12 +845,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_clear_entries + * Function: H5E__clear_entries * - * Purpose: Private function to clear the error stack entries for the + * Purpose: Private function to clear the error stack entries for the * specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, August 6, 2003 @@ -858,13 +858,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_clear_entries(H5E_t *estack, size_t nentries) +H5E__clear_entries(H5E_t *estack, size_t nentries) { H5E_error2_t *error; /* Pointer to error stack entry to clear */ unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(estack); @@ -897,16 +897,16 @@ H5E_clear_entries(H5E_t *estack, size_t nentries) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_clear_entries() */ +} /* end H5E__clear_entries() */ /*------------------------------------------------------------------------- - * Function: H5E_clear_stack + * Function: H5E_clear_stack * - * Purpose: Private function to clear the error stack for the + * Purpose: Private function to clear the error stack for the * specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -922,13 +922,13 @@ H5E_clear_stack(H5E_t *estack) /* 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 */ + 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") /* Empty the error stack */ HDassert(estack); if(estack->nused) - if(H5E_clear_entries(estack, estack->nused) < 0) + if(H5E__clear_entries(estack, estack->nused) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") done: @@ -937,12 +937,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_pop + * Function: H5E__pop * - * Purpose: Private function to delete some error messages from the top + * Purpose: Private function to delete some error messages from the top * of error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 16, 2003 @@ -950,33 +950,33 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_pop(H5E_t *estack, size_t count) +H5E__pop(H5E_t *estack, size_t count) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); HDassert(estack->nused >= count); /* Remove the entries from the error stack */ - if(H5E_clear_entries(estack, count) < 0) + if(H5E__clear_entries(estack, count) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't remove errors from stack") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_pop() */ +} /* end H5E__pop() */ /*------------------------------------------------------------------------- - * Function: H5E_dump_api_stack + * Function: H5E_dump_api_stack * - * Purpose: Private function to dump the error stack during an error in + * Purpose: Private function to dump the error stack during an error in * an API function if a callback function is defined for the * current error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, August 6, 2003 @@ -992,7 +992,7 @@ H5E_dump_api_stack(hbool_t is_api) /* Only dump the error stack during an API call */ if(is_api) { - H5E_t *estack = H5E_get_my_stack(); + H5E_t *estack = H5E__get_my_stack(); HDassert(estack); diff --git a/src/H5Epkg.h b/src/H5Epkg.h index fcde1ca..ac98496 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -49,15 +49,15 @@ * each thread individually. The association of stacks to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E_get_my_stack() must be preceeded + * In order for this macro to work, H5E__get_my_stack() must be preceeded * by "H5E_t *estack =". */ -#define H5E_get_my_stack() H5E_get_stack() +#define H5E__get_my_stack() H5E__get_stack() #else /* H5_HAVE_THREADSAFE */ /* * The current error stack. */ -#define H5E_get_my_stack() (H5E_stack_g + 0) +#define H5E__get_my_stack() (H5E_stack_g + 0) #endif /* H5_HAVE_THREADSAFE */ @@ -132,20 +132,20 @@ H5_DLLVAR H5E_t H5E_stack_g[1]; /******************************/ H5_DLL herr_t H5E__term_deprec_interface(void); #ifdef H5_HAVE_THREADSAFE -H5_DLL H5E_t *H5E_get_stack(void); +H5_DLL H5E_t *H5E__get_stack(void); #endif /* H5_HAVE_THREADSAFE */ H5_DLL herr_t H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); -H5_DLL ssize_t H5E_get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, +H5_DLL ssize_t H5E__get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size); -H5_DLL herr_t H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compat); -H5_DLL herr_t H5E_walk(const H5E_t *estack, H5E_direction_t direction, +H5_DLL herr_t H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compat); +H5_DLL herr_t H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data); -H5_DLL herr_t H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, +H5_DLL herr_t H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data); -H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, +H5_DLL herr_t H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data); -H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count); +H5_DLL herr_t H5E__pop(H5E_t *err_stack, size_t count); #endif /* _H5Epkg_H */ diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index 6f47efb..e51050e 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -57,7 +57,7 @@ H5_DLL herr_t H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, /* Testing functions */ #ifdef H5FD_TESTING -H5_DLL hbool_t H5FD_supports_swmr_test(const char *vfd_name); +H5_DLL hbool_t H5FD__supports_swmr_test(const char *vfd_name); #endif /* H5FD_TESTING */ #endif /* _H5FDpkg_H */ diff --git a/src/H5FDtest.c b/src/H5FDtest.c index f528dfb..080223c 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -71,7 +71,7 @@ /*------------------------------------------------------------------------- - * Function: H5FD_supports_swmr_test() + * Function: H5FD__supports_swmr_test() * * Purpose: Determines if a VFD supports SWMR. * @@ -98,7 +98,7 @@ *------------------------------------------------------------------------- */ hbool_t -H5FD_supports_swmr_test(const char *vfd_name) +H5FD__supports_swmr_test(const char *vfd_name) { hbool_t ret_value = FALSE; @@ -112,5 +112,5 @@ H5FD_supports_swmr_test(const char *vfd_name) FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_supports_swmr_test() */ +} /* end H5FD__supports_swmr_test() */ diff --git a/src/H5private.h b/src/H5private.h index 196d001..2dff0f0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1992,7 +1992,6 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ H5_DLL herr_t H5CX_push(void); H5_DLL herr_t H5CX_pop(void); - #ifndef NDEBUG #define FUNC_ENTER_CHECK_NAME(asrt) \ { \ @@ -2031,7 +2030,7 @@ H5_DLL herr_t H5CX_pop(void); /* Local variables for API routines */ #define FUNC_ENTER_API_VARS \ MPE_LOG_VARS \ - H5TRACE_DECL \ + H5TRACE_DECL #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ diff --git a/src/H5system.c b/src/H5system.c index 186d8fa..2d29650 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -294,13 +294,13 @@ HDfprintf(FILE *stream, const char *fmt, ...) unsigned short x = (unsigned short)va_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!*modifier) { - unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occurring */ + unsigned int x = va_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!HDstrcmp(modifier, "l")) { - unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occurring */ + unsigned long x = va_arg(ap, unsigned long); n = fprintf(stream, format_templ, x); } else { - uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occurring */ + uint64_t x = va_arg(ap, uint64_t); n = fprintf(stream, format_templ, x); } break; @@ -333,7 +333,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'a': { - haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occurring */ + haddr_t x = va_arg(ap, haddr_t); if(H5F_addr_defined(x)) { len = 0; @@ -387,7 +387,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 's': case 'p': { - char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occurring */ + char *x = va_arg(ap, char*); n = fprintf(stream, format_templ, x); } break; diff --git a/test/accum.c b/test/accum.c index 19006b6..91786a9 100644 --- a/test/accum.c +++ b/test/accum.c @@ -1846,11 +1846,11 @@ test_swmr_write_big(hbool_t newest_format) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if (!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } /* File access property list */ if((fapl = h5_fileaccess()) < 0) @@ -1863,7 +1863,8 @@ test_swmr_write_big(hbool_t newest_format) if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { /* non-latest-format */ + } + else { /* non-latest-format */ if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } /* end if */ @@ -1951,10 +1952,11 @@ test_swmr_write_big(hbool_t newest_format) if((pid = HDfork()) < 0) { HDperror("fork"); FAIL_STACK_ERROR; - } else if(0 == pid) { /* Child process */ + } + else if(0 == pid) { /* Child process */ /* Run the reader */ status = HDexecv(SWMR_READER, new_argv); - printf("errno from execv = %s\n", strerror(errno)); + HDprintf("errno from execv = %s\n", strerror(errno)); FAIL_STACK_ERROR; } /* end if */ @@ -2030,18 +2032,19 @@ accum_printf(const H5F_t *f) { H5F_meta_accum_t * accum = &f->shared->accum; - printf("\n"); - printf("Current contents of accumulator:\n"); - if (accum->alloc_size == 0) { - printf("=====================================================\n"); - printf(" No accumulator allocated.\n"); - printf("=====================================================\n"); - } else { - printf("=====================================================\n"); - printf(" accumulator allocated size == %zu\n", accum->alloc_size); - printf(" accumulated data size == %zu\n", accum->size); + HDprintf("\n"); + HDprintf("Current contents of accumulator:\n"); + if(accum->alloc_size == 0) { + HDprintf("=====================================================\n"); + HDprintf(" No accumulator allocated.\n"); + HDprintf("=====================================================\n"); + } + else { + HDprintf("=====================================================\n"); + HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size); + HDprintf(" accumulated data size == %zu\n", accum->size); HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); if(accum->dirty) { HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); @@ -2049,8 +2052,8 @@ accum_printf(const H5F_t *f) } /* end if */ HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size)); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); } - printf("\n\n"); + HDprintf("\n\n"); } /* accum_printf() */ diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 5bda46a..cf2616e 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -56,9 +56,8 @@ main(void) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if(!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; - } /* Initialize buffers */ for(u = 0; u < 1024; u++) { @@ -101,8 +100,11 @@ main(void) return EXIT_SUCCESS; -error: - H5Fclose(fid); +error: + H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Fclose(fid); + } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); diff --git a/test/dsets.c b/test/dsets.c index d23f438..faf2ad7 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -27,7 +27,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5Pprivate.h" @@ -2517,8 +2516,7 @@ error: * * Purpose: Tests library behavior when filter is missing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -2543,7 +2541,7 @@ test_missing_filter(hid_t file) /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ @@ -2555,31 +2553,31 @@ test_missing_filter(hid_t file) /* (Use private routine, to avoid range checking on filter ID) */ if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ /* Create dcpl with deflate filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Pset_deflate(dcpl, 9) < 0) { H5_FAILED(); - printf(" Line %d: Can't set deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't set deflate filter\n",__LINE__); goto error; } /* end if */ @@ -2587,47 +2585,47 @@ test_missing_filter(hid_t file) ret=H5Pall_filters_avail(dcpl); if(ret<0) { H5_FAILED(); - printf(" Line %d: Can't check filter availability\n",__LINE__); + HDprintf(" Line %d: Can't check filter availability\n",__LINE__); goto error; } /* end if */ if(ret!=FALSE) { H5_FAILED(); - printf(" Line %d: Filter shouldn't be available\n",__LINE__); + HDprintf(" Line %d: Filter shouldn't be available\n",__LINE__); goto error; } /* end if */ /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if(0 == (dset_size = H5Dget_storage_size(dsid))) { H5_FAILED(); - printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ @@ -2635,14 +2633,14 @@ test_missing_filter(hid_t file) /* (i.e. the deflation filter we asked for was silently ignored) */ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -2652,10 +2650,10 @@ test_missing_filter(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -2664,21 +2662,21 @@ test_missing_filter(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -2688,14 +2686,14 @@ test_missing_filter(hid_t file) /* Open existing file */ if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open existing deflated file\n", __LINE__); + HDprintf(" Line %d: Can't open existing deflated file\n", __LINE__); goto error; } /* end if */ /* Open dataset */ if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ @@ -2705,21 +2703,21 @@ test_missing_filter(hid_t file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Should not be able to read dataset data\n", __LINE__); + HDprintf(" Line %d: Should not be able to read dataset data\n", __LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n", __LINE__); + HDprintf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Close existing file */ if(H5Fclose(fid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ @@ -2727,21 +2725,21 @@ test_missing_filter(hid_t file) /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ #ifdef H5_HAVE_FILTER_DEFLATE /* Register deflate filter (use internal function to avoid range checks) */ if(H5Z_register(H5Z_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -2751,13 +2749,13 @@ test_missing_filter(hid_t file) api_ctx_pushed = FALSE; PASSED(); - return 0; + return SUCCEED; error: if(api_ctx_pushed) H5CX_pop(); - return -1; -} + return FAIL; +} /* end test_missing_filter() */ /*------------------------------------------------------------------------- @@ -8301,25 +8299,25 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over using SWMR access to write */ for(swmr = 0; swmr <= 1; swmr++) { - int compress; /* Whether chunks should be compressed */ + int compress; /* Whether chunks should be compressed */ /* SWMR is now supported with/without latest format: */ - /* (1) write+latest-format (2) SWMR-write+non-latest-format */ + /* (1) write+latest-format (2) SWMR-write+non-latest-format */ /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(swmr && !H5FD_supports_swmr_test(env_h5_driver)) + if(swmr && !H5FD__supports_swmr_test(env_h5_driver)) continue; #ifdef H5_HAVE_FILTER_DEFLATE /* Loop over compressing chunks */ for(compress = 0; compress <= 1; compress++) #else - /* Loop over without compression */ + /* Loop over without compression */ for(compress = 0; compress <= 0; compress++) #endif /* H5_HAVE_FILTER_DEFLATE */ - { + { H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ @@ -10412,11 +10410,11 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) @@ -10428,7 +10426,8 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Create file with write+latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { + } + else { /* Create file with SWMR-write+non-latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -10661,11 +10660,11 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10781,11 +10780,11 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10901,11 +10900,11 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -12904,7 +12903,7 @@ error: #define SRC_DSET "src_dset" #define V_DSET "v_dset" static herr_t -test_versionbounds() +test_versionbounds(void) { hid_t fapl = -1; hid_t srcfile = -1; /* Files with source dsets */ diff --git a/test/flush1.c b/test/flush1.c index bdbd731..fefa8d0 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -209,7 +209,7 @@ main(void) /* Check if the current VFD supports SWMR */ driver = HDgetenv("HDF5_DRIVER"); - vfd_supports_swmr = H5FD_supports_swmr_test(driver); + vfd_supports_swmr = H5FD__supports_swmr_test(driver); /*************************************************/ /* NOTE: Not closing the file ID is intentional! */ diff --git a/test/flush2.c b/test/flush2.c index 9fdf6c1..6e8aee7 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -258,7 +258,7 @@ main(void) /* Check if the current VFD supports SWMR */ driver = HDgetenv("HDF5_DRIVER"); - vfd_supports_swmr = H5FD_supports_swmr_test(driver); + vfd_supports_swmr = H5FD__supports_swmr_test(driver); /* TEST 1 */ /* Check the case where the file was flushed */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 4196d85..42b5e43 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -130,7 +130,7 @@ herr_t end_verification(void); * it will time out waiting for a signal from the test script * which will never come. * - * Return: 0 on Success, 1 on Failure + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * July 1, 2010 @@ -155,7 +155,7 @@ int main(int argc, const char *argv[]) /* Determine driver being used */ envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL || H5FD_supports_swmr_test(envval)) { + if(envval == NULL || H5FD__supports_swmr_test(envval)) { if(test_flush() != SUCCEED) TEST_ERROR; if(test_refresh() != SUCCEED) TEST_ERROR; } /* end if */ @@ -166,23 +166,26 @@ int main(int argc, const char *argv[]) if(end_verification() < 0) TEST_ERROR; if(end_verification() < 0) TEST_ERROR; } /* end else */ - } else if(argc == 3) { + } + else if(argc == 3) { /* Two arguments supplied. Pass them to flush verification routine. */ if(flush_verification(argv[1], argv[2]) != 0) PROCESS_ERROR; - } else if(argc == 2) { + } + else if(argc == 2) { /* One argument supplied. Pass it to refresh verification routine. */ if(refresh_verification(argv[1]) != 0) PROCESS_ERROR; - } else { + } + else { /* Illegal number of arguments supplied. Error. */ HDfprintf(stderr, "Error. %d is an Invalid number of arguments to main().\n", argc); PROCESS_ERROR } /* end if */ - return SUCCEED; + return EXIT_SUCCESS; error: /* Return */ - return FAIL; + return EXIT_FAILURE; } /* main */ @@ -1027,55 +1030,57 @@ herr_t refresh_verification(const char * obj_pathname) * test cases is easy). */ do { - if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { - if(H5Drefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { - if(H5Grefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { - if(H5Trefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || + if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { + if(H5Drefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { + if(H5Grefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { + if(H5Trefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || (HDstrcmp(obj_pathname, T3) == 0)) { - if(H5Orefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else { - HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); - PROCESS_ERROR; - } /* end else */ - - /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - - /* Confirm following (first 4) attributes are the same: */ - /* Confirm following (last 4) attributes are different */ - if( (flushed_oinfo.addr == refreshed_oinfo.addr) && - (flushed_oinfo.type == refreshed_oinfo.type) && - (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && - (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && - (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && - (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && - (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && - (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { - ok = TRUE; - break; - } - if(tries == sleep_tries) - HDsleep(1); + if(H5Orefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else { + HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); + PROCESS_ERROR; + } /* end else */ + + /* Get object info. This should now accurately reflect the refreshed object on disk. */ + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) + PROCESS_ERROR; + + /* Confirm following (first 4) attributes are the same: */ + /* Confirm following (last 4) attributes are different */ + if( (flushed_oinfo.addr == refreshed_oinfo.addr) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && + (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && + (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && + (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { + ok = TRUE; + break; + } + + if(tries == sleep_tries) + HDsleep(1); } while(--tries); - + if(!ok) { - printf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, - (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); - printf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, - (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); - PROCESS_ERROR; + HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, + (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); + HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, + (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); + PROCESS_ERROR; } - + /* Close objects */ if(H5Oclose(oid) < 0) PROCESS_ERROR; if(H5Fclose(fid) < 0) PROCESS_ERROR; diff --git a/test/links.c b/test/links.c index fb2c75a..786aa8f 100644 --- a/test/links.c +++ b/test/links.c @@ -4052,7 +4052,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo if(H5Fclose(file1) < 0) TEST_ERROR /* Only run this part with VFDs that support SWMR */ - if(H5FD_supports_swmr_test(env_h5_drvr)) { + if(H5FD__supports_swmr_test(env_h5_drvr)) { /* Reopen file1, with read-write and SWMR-write access */ /* Only supported under the latest file format */ @@ -8354,9 +8354,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* Fill the query buffer */ @@ -9004,9 +9004,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) gid = H5Oopen(fid, "soft5", plist); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through lesser soft link */ @@ -15003,7 +15003,7 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; } /* end for */ /* These tests assume that external links are a form of UD links, diff --git a/test/swmr.c b/test/swmr.c index 0b352e2..b7e54e7 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6484,106 +6484,106 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) if(childpid == 0) { /* Child process */ hid_t child_fid1 = -1; /* File ID */ hid_t child_fid2 = -1; /* File ID */ - hid_t child_did1 = -1, child_did2 = -1; - hid_t child_sid = -1; - hsize_t tdims[1]; - int rbuf[2] = {0, 0}; - int child_notify = 0; + hid_t child_did1 = -1, child_did2 = -1; + hid_t child_sid = -1; + hsize_t tdims[1]; + int rbuf[2] = {0, 0}; + int child_notify = 0; - /* Close unused write end for out_pdf */ - if(HDclose(out_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - /* close unused read end for in_pdf */ - if(HDclose(in_pdf[0]) < 0) - HDexit(EXIT_FAILURE); + /* close unused read end for in_pdf */ + if(HDclose(in_pdf[0]) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 1) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } - /* Open the file 2 times */ - if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + /* Open the file 2 times */ + if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - /* Open the dataset 2 times */ - if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); - if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); + /* Open the dataset 2 times */ + if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace via did1 */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); - if(tdims[0] != 1) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace via did1 */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); + if(tdims[0] != 1) + HDexit(EXIT_FAILURE); - /* Read from the dataset via did2 */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset via did2 */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 99) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 99) + HDexit(EXIT_FAILURE); - /* Notify parent process */ - child_notify = 2; - if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); + /* Notify parent process */ + child_notify = 2; + if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 3) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 3) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } - /* Refresh dataset via did1 */ - if(H5Drefresh(child_did1) < 0) - HDexit(EXIT_FAILURE); + /* Refresh dataset via did1 */ + if(H5Drefresh(child_did1) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace and verify */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace and verify */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); - if(tdims[0] != 2) - HDexit(EXIT_FAILURE); + if(tdims[0] != 2) + HDexit(EXIT_FAILURE); - /* Read from the dataset */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 100 || rbuf[1] != 100) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 100 || rbuf[1] != 100) + HDexit(EXIT_FAILURE); - /* Close the 2 datasets */ - if(H5Dclose(child_did1) < 0) - HDexit(EXIT_FAILURE); - if(H5Dclose(child_did2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 datasets */ + if(H5Dclose(child_did1) < 0) + HDexit(EXIT_FAILURE); + if(H5Dclose(child_did2) < 0) + HDexit(EXIT_FAILURE); - /* Close the 2 files */ - if(H5Fclose(child_fid1) < 0) - HDexit(EXIT_FAILURE); - if(H5Fclose(child_fid2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 files */ + if(H5Fclose(child_fid1) < 0) + HDexit(EXIT_FAILURE); + if(H5Fclose(child_fid2) < 0) + HDexit(EXIT_FAILURE); - /* Close the pipes */ - if(HDclose(out_pdf[0]) < 0) - HDexit(EXIT_FAILURE); - if(HDclose(in_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close the pipes */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + if(HDclose(in_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - HDexit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* Close unused read end for out_pdf */ @@ -7042,7 +7042,7 @@ main(void) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if(!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) { printf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; } /* end if */ diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c index 1589f6e..e249e09 100644 --- a/test/swmr_check_compat_vfd.c +++ b/test/swmr_check_compat_vfd.c @@ -46,7 +46,7 @@ main(void) driver = HDgetenv("HDF5_DRIVER"); - if(H5FD_supports_swmr_test(driver)) + if(H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; else return EXIT_FAILURE; diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 0fc0289..b9ed9ce 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -226,81 +226,84 @@ convert(hid_t fid, const char *dname) /* Open the dataset */ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) { - error_msg("unable to open dataset \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - - } else if(verbose_g) - HDfprintf(stdout, "Open the dataset\n"); + error_msg("unable to open dataset \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Open the dataset\n"); /* Get the dataset's creation property list */ if((dcpl = H5Dget_create_plist(did)) < 0) { - error_msg("unable to get the dataset creation property list\n"); - h5tools_setstatus(EXIT_FAILURE); - goto error; + error_msg("unable to get the dataset creation property list\n"); + h5tools_setstatus(EXIT_FAILURE); + goto error; } /* Get the dataset's layout */ if((layout_type = H5Pget_layout(dcpl)) < 0) { - error_msg("unable to get the dataset layout type\n"); - h5tools_setstatus(EXIT_FAILURE); - goto error; - - } else if(verbose_g) - HDfprintf(stdout, "Retrieve the dataset's layout\n"); + error_msg("unable to get the dataset layout type\n"); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Retrieve the dataset's layout\n"); switch(layout_type) { - case H5D_CHUNKED: - if(verbose_g) - HDfprintf(stdout, "Dataset is a chunked dataset\n"); - - /* Get the dataset's chunk indexing type */ - if(H5Dget_chunk_index_type(did, &idx_type) < 0) { - error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + case H5D_CHUNKED: + if(verbose_g) + HDfprintf(stdout, "Dataset is a chunked dataset\n"); + + /* Get the dataset's chunk indexing type */ + if(H5Dget_chunk_index_type(did, &idx_type) < 0) { + error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + + if(idx_type == H5D_CHUNK_IDX_BTREE) { + if(verbose_g) + HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; + } + else if (verbose_g) + HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); - if(idx_type == H5D_CHUNK_IDX_BTREE) { - if(verbose_g) - HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; - } else if (verbose_g) - HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); break; - case H5D_CONTIGUOUS: - if(verbose_g) - HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n"); - break; + case H5D_CONTIGUOUS: + if(verbose_g) + HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n"); + break; - case H5D_COMPACT: - if(verbose_g) - HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n"); - break; + case H5D_COMPACT: + if(verbose_g) + HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n"); + break; - case H5D_VIRTUAL: - if(verbose_g) - HDfprintf(stdout, "No further action for virtual dataset\n"); - goto done; + case H5D_VIRTUAL: + if(verbose_g) + HDfprintf(stdout, "No further action for virtual dataset\n"); + goto done; - case H5D_NLAYOUTS: - case H5D_LAYOUT_ERROR: - default: - error_msg("unknown layout type for \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; + case H5D_NLAYOUTS: + case H5D_LAYOUT_ERROR: + default: + error_msg("unknown layout type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; } /* end switch */ /* No further action if it is a noop */ if(noop_g) { - if(verbose_g) - HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + if(verbose_g) + HDfprintf(stdout, "Not converting the dataset\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) @@ -308,51 +311,54 @@ convert(hid_t fid, const char *dname) /* Downgrade the dataset */ if(H5Dformat_convert(did) < 0) { - error_msg("unable to downgrade dataset \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Done\n"); + error_msg("unable to downgrade dataset \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Done\n"); done: /* Close the dataset */ if(H5Dclose(did) < 0) { error_msg("unable to close dataset \"%s\"\n", dname); h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Close the dataset\n"); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Close the dataset\n"); /* Close the dataset creation property list */ if(H5Pclose(dcpl) < 0) { error_msg("unable to close dataset creation property list\n"); h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - printf("Close the dataset creation property list\n"); + goto error; + } + else if(verbose_g) + HDprintf("Close the dataset creation property list\n"); - return(0); + return 0; error: if(verbose_g) - HDfprintf(stdout, "Error encountered\n"); + HDfprintf(stdout, "Error encountered\n"); H5E_BEGIN_TRY { H5Pclose(dcpl); H5Dclose(did); } H5E_END_TRY; - return(-1); + return -1; } /* convert() */ /*------------------------------------------------------------------------- - * Function: convert_dsets_cb() + * Function: convert_dsets_cb() * - * Purpose: The callback routine from the traversal to convert the - * chunk indexing type of the dataset object. + * Purpose: The callback routine from the traversal to convert the + * chunk indexing type of the dataset object. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int @@ -363,11 +369,11 @@ convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_vis /* If the object has already been seen then just return */ if(NULL == already_visited) { if(oi->type == H5O_TYPE_DATASET) { - if(verbose_g) - HDfprintf(stdout, "Going to process dataset:%s...\n", path); - if(convert(fid, path) < 0) - goto error; - } /* end if */ + if(verbose_g) + HDfprintf(stdout, "Going to process dataset:%s...\n", path); + if(convert(fid, path) < 0) + goto error; + } /* end if */ } /* end if */ return 0; diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 01ba4af..4f3e7a4 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -221,7 +221,7 @@ main (int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - parse_command_line (argc, argv); + parse_command_line(argc, argv); if (ub_file == NULL) { /* no user block */ @@ -252,21 +252,21 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - ifile = H5Fopen (input_file, H5F_ACC_RDONLY, H5P_DEFAULT); + ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT); if (ifile < 0) { error_msg("Can't open input HDF5 file \"%s\"\n", input_file); leave (EXIT_FAILURE); } - plist = H5Fget_create_plist (ifile); + plist = H5Fget_create_plist(ifile); if (plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", input_file); H5Fclose(ifile); leave (EXIT_FAILURE); } - status = H5Pget_userblock (plist, &usize); + status = H5Pget_userblock(plist, &usize); if (status < 0) { error_msg("Can't get user block for file \"%s\"\n", input_file); H5Pclose(plist); @@ -330,7 +330,7 @@ main (int argc, const char *argv[]) } } - newubsize = compute_user_block_size ((hsize_t) fsize); + newubsize = compute_user_block_size((hsize_t) fsize); startub = usize; @@ -345,22 +345,22 @@ main (int argc, const char *argv[]) else { /* add new ub to current ublock, pad to new offset */ newubsize += usize; - newubsize = compute_user_block_size ((hsize_t) newubsize); + newubsize = compute_user_block_size((hsize_t) newubsize); } } /* copy the HDF5 from starting at usize to starting at newubsize: * makes room at 'from' for new ub */ /* if no current ub, usize is 0 */ - copy_some_to_file (h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize)); + copy_some_to_file(h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize)); /* copy the old ub to the beginning of the new file */ if (!do_clobber) { - where = copy_some_to_file (h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize); + where = copy_some_to_file(h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize); } /* copy the new ub to the end of the ub */ - where = copy_some_to_file (ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1); + where = copy_some_to_file(ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1); /* pad the ub */ if(write_pad(ofid, where, &where) < 0) { @@ -372,18 +372,18 @@ main (int argc, const char *argv[]) } /* end if */ if(ub_file) - HDfree (ub_file); + HDfree(ub_file); if(input_file) - HDfree (input_file); + HDfree(input_file); if(output_file) - HDfree (output_file); + HDfree(output_file); if(ufid >= 0) - HDclose (ufid); + HDclose(ufid); if(h5fid >= 0) - HDclose (h5fid); + HDclose(h5fid); if(ofid >= 0) - HDclose (ofid); + HDclose(ofid); return h5tools_getstatus(); } diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index b66e7ce..088e6e9 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -346,7 +346,7 @@ main(int argc, char *argv[]) /* * Debug a global heap collection. */ - status = H5HG_debug (f, addr, stdout, 0, VCOL); + status = H5HG_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 7321c66..4f92cae 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "hdf5.h" #include "H5private.h" @@ -110,6 +108,10 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM1 0 #define SPACE1_DIM2 0 +/* Error macros */ +#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define PROGRAM_ERROR {AT(); goto error;} + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, @@ -178,7 +180,7 @@ static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int ma static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); -static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static int gen_dataset_idx(const char *file, int format); /*------------------------------------------------------------------------- @@ -286,7 +288,7 @@ int main(void) /* string dataset and attribute. HDFFV-10028 */ test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); - return 0; + return EXIT_SUCCESS; } /*------------------------------------------------------------------------- @@ -4908,9 +4910,9 @@ out: * types. * h5diff should show non-comparable output from these common objects. *-------------------------------------------------------------------------*/ -static void test_objs_nocomparables(const char *fname1, const char *fname2) +static void +test_objs_nocomparables(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; hid_t fid1 = -1; hid_t fid2 = -1; hid_t topgid1 = -1; @@ -4927,110 +4929,90 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) * Open file(s) to add objects *------------------------------------------------------------------------*/ /* file1 */ - fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); - status = FAIL; - goto out; - } + if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* file2 */ - fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); - status = FAIL; - goto out; - } + if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file1 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); - goto out; - } + if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) + PROGRAM_ERROR /* group */ - gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid1 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); - goto out; - } + if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file2 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* group */ - gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid2 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); - goto out; - } + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); - goto out; - } + if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) + PROGRAM_ERROR -out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if (fid1) + if(H5Fclose(fid1) < 0) + PROGRAM_ERROR + if(H5Fclose(fid2) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid1) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid2) < 0) + PROGRAM_ERROR + if(H5Gclose(gid1) < 0) + PROGRAM_ERROR + if(H5Gclose(gid2) < 0) + PROGRAM_ERROR + if(H5Tclose(tid1) < 0) + PROGRAM_ERROR + if(H5Tclose(tid2) < 0) + PROGRAM_ERROR + + return; + +error: + H5E_BEGIN_TRY { H5Fclose(fid1); - if (fid2) H5Fclose(fid2); - if (topgid1) H5Gclose(topgid1); - if (topgid2) H5Gclose(topgid2); - if (gid1) H5Gclose(gid1); - if (gid2) H5Gclose(gid2); - if (tid1) H5Tclose(tid1); - if (tid2) H5Tclose(tid2); + } H5E_END_TRY; + return; } static hid_t mkstr(int size, H5T_str_t pad) @@ -8085,36 +8067,40 @@ out: * *------------------------------------------------------------------------- */ -static -int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) +static herr_t +write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { hid_t did = -1; hid_t sid = -1; /* create a space */ - if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) - goto out; + if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + PROGRAM_ERROR /* create the dataset */ - if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* write */ - if (buf) { - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - } + if(buf) + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + PROGRAM_ERROR /* close */ - H5Dclose(did); - H5Sclose(sid); + if(H5Dclose(did) < 0) + PROGRAM_ERROR + if(H5Sclose(sid) < 0) + PROGRAM_ERROR return SUCCEED; -out: +error: + + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; - H5Dclose(did); - H5Sclose(sid); return FAIL; -} +} /* end write_dset() */ diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 8e4b3ac..667f2d9 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -26,9 +26,9 @@ */ static const char *s_opts = "h"; static struct long_options l_opts[] = { - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {NULL, 0, '\0'} + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {NULL, 0, '\0'} }; /*------------------------------------------------------------------------- @@ -37,152 +37,126 @@ static struct long_options l_opts[] = { * Purpose: Print the usage message * * Return: void - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void usage (const char *prog) { - fflush (stdout); - fprintf (stdout, "usage: %s h5_file\n", prog); - fprintf (stdout, - " Check that h5_fil is HDF5 file and print size of user block \n"); - fprintf (stdout, " %s -h\n", prog); - fprintf (stdout, " Print a usage message and exit\n"); -} + HDfflush(stdout); + HDfprintf(stdout, "usage: %s h5_file\n", prog); + HDfprintf(stdout, + " Check that h5_fil is HDF5 file and print size of user block \n"); + HDfprintf(stdout, " %s -h\n", prog); + HDfprintf(stdout, " Print a usage message and exit\n"); +} /* end usage() */ /*------------------------------------------------------------------------- * Function: parse_command_line * * Purpose: Parse the command line for the h5dumper. * - * Return: Success: - * + * Return: Success: void * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void parse_command_line (int argc, const char *argv[]) { - int opt; - - /* parse command line options */ - while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char) opt) - { - case 'h': - usage (h5tools_getprogname()); - exit (EXIT_SUCCESS); - case '?': - default: - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } + int opt; + + /* parse command line options */ + while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) { + switch ((char) opt) { + case 'h': + usage (h5tools_getprogname()); + HDexit(EXIT_SUCCESS); + case '?': + default: + usage (h5tools_getprogname()); + HDexit(EXIT_FAILURE); + } } - /* check for file name to be processed */ - if (argc <= opt_ind) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); + /* check for file name to be processed */ + if (argc <= opt_ind) { + error_msg("missing file name\n"); + usage (h5tools_getprogname()); + HDexit(EXIT_FAILURE); } -} +} /* end parse_command_line() */ /*------------------------------------------------------------------------- * Function: main * * Purpose: HDF5 user block unjammer * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: - * - * Modifications: - * + * Return: EXIT_SUCCESS/EXIT_FAILURE *------------------------------------------------------------------------- */ int main (int argc, const char *argv[]) { - char *ifname; - void *edata; - H5E_auto2_t func; - hid_t ifile; - hsize_t usize; - htri_t testval; - herr_t status; - hid_t plist; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - parse_command_line (argc, argv); - - if (argc <= (opt_ind)) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - return (EXIT_FAILURE); + char *ifname; + void *edata; + H5E_auto2_t func; + hid_t ifile; + hsize_t usize; + htri_t testval; + herr_t status; + hid_t plist = -1; + + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + parse_command_line(argc, argv); + + if(argc <= (opt_ind)) { + error_msg("missing file name\n"); + usage (h5tools_getprogname()); + return EXIT_FAILURE; } - ifname = HDstrdup (argv[opt_ind]); + ifname = HDstrdup(argv[opt_ind]); - testval = H5Fis_hdf5 (ifname); + testval = H5Fis_hdf5(ifname); - if (testval <= 0) - { - error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); - return (EXIT_FAILURE); + if(testval <= 0) { + error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); + return EXIT_FAILURE; } - ifile = H5Fopen (ifname, H5F_ACC_RDONLY, H5P_DEFAULT); + ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT); - if (ifile < 0) - { - error_msg("Can't open input HDF5 file \"%s\"\n", ifname); - return (EXIT_FAILURE); + if(ifile < 0) { + error_msg("Can't open input HDF5 file \"%s\"\n", ifname); + return EXIT_FAILURE; } - plist = H5Fget_create_plist (ifile); - if (plist < 0) - { - error_msg("Can't get file creation plist for file \"%s\"\n", - ifname); - return (EXIT_FAILURE); + plist = H5Fget_create_plist(ifile); + if(plist < 0) { + error_msg("Can't get file creation plist for file \"%s\"\n", ifname); + return EXIT_FAILURE; } - status = H5Pget_userblock (plist, &usize); - if (status < 0) - { - error_msg("Can't get user block for file \"%s\"\n", ifname); - return (EXIT_FAILURE); + status = H5Pget_userblock(plist, &usize); + if(status < 0) { + error_msg("Can't get user block for file \"%s\"\n", ifname); + return EXIT_FAILURE; } - printf ("%ld\n", (long) usize); + HDprintf("%ld\n", (long) usize); - H5Pclose (plist); - H5Fclose (ifile); + H5Pclose (plist); + H5Fclose (ifile); - return (EXIT_SUCCESS); -} + return EXIT_SUCCESS; +} /* end main() */ diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index b0a2f99..a36eb08 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -997,6 +997,7 @@ fi ############################################################################## ### T H E T E S T S ############################################################################## + # prepare for test COPY_TESTFILES_TO_TESTDIR diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in index 5082daf..0a5127f 100644 --- a/tools/test/h5stat/testh5stat.sh.in +++ b/tools/test/h5stat/testh5stat.sh.in @@ -249,7 +249,6 @@ TOOLTEST h5stat_help2.ddl --help TOOLTEST h5stat_notexist.ddl notexist.h5 TOOLTEST h5stat_nofile.ddl '' - # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 TOOLTEST h5stat_filters.ddl h5stat_filters.h5 -- cgit v0.12 From fe418f6c2389122bbab2404046513fac9d6dab7e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:06:05 -0500 Subject: Use constants for test comparisons --- java/test/TestH5E.java | 6 +++--- java/test/TestH5Edefault.java | 44 +++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 656069a..7810c74 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -168,7 +168,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3); try { H5.H5Epop(current_stackid, 1); @@ -186,7 +186,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == 3); + assertTrue("H5.H5Epop", num_msg == 2); } @Test @@ -314,7 +314,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == 4); + assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 5324d3a..e6ac7fa 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -27,6 +27,10 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Edefault { + public static final int ERRSTACK_CNT = 3; + public static final int ERRSTACK_MTY_CNT = 0; + public static final int ERRSTACK_POP_CNT = 2; + @Rule public TestName testname = new TestName(); @Before @@ -91,7 +95,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); //Save a copy of the current stack and clears the current stack try { @@ -122,7 +126,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Eclose_stack(stack_id); @@ -153,7 +157,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); //Save a copy of the current stack and clears the current stack try { @@ -174,7 +178,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_MTY_CNT); //Verify the copy has the correct number of messages try { @@ -184,7 +188,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Generate errors on default stack try { @@ -202,7 +206,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); //Remove one message from the current stack try { @@ -213,7 +217,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == 3); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_POP_CNT); //Verify the copy still has the correct number of messages try { @@ -223,7 +227,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); } @Test(expected = IllegalArgumentException.class) @@ -293,7 +297,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Save a copy of the current stack try { @@ -314,7 +318,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Generate errors on default stack try { @@ -332,7 +336,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Remove one message from the current stack try { @@ -343,7 +347,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); //Verify the copy still has the correct number of messages try { @@ -353,7 +357,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Eset_current_stack(stack_id); @@ -363,7 +367,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); } @Test(expected = IllegalArgumentException.class) @@ -386,7 +390,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -395,7 +399,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); } @Test(expected = IllegalArgumentException.class) @@ -471,7 +475,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -480,7 +484,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0); + assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); } @Test(expected = IllegalArgumentException.class) @@ -516,7 +520,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num: " + err); } - assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0); + assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); } @Test @@ -534,7 +538,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num_with_msg: " + err); } - assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > TestH5Edefault.ERRSTACK_MTY_CNT); } } -- cgit v0.12 From d2806d4875074efd03431385922480e27e32a060 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:52:13 -0500 Subject: HDFFV-10332 Adjust checks and generation of files --- src/CMakeLists.txt | 73 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1cd0a10..e90e580 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -860,6 +860,10 @@ else () set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR}) endif () +if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") +endif () + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") @@ -877,6 +881,30 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + ) + else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () + endif () +else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () endif () if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) @@ -896,6 +924,30 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + endif () + endif () +else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + endif () endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" @@ -933,27 +985,6 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared - ) - endif () - - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - endif () - set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) -- cgit v0.12 From cd290ddecb084a4496f57d60ca8db10d8abdf5ee Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:58:08 -0500 Subject: Add Constants to all ERR STK checks --- java/test/TestH5E.java | 16 ++++++++++------ java/test/TestH5Edefault.java | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 7810c74..a1ca42c 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -37,6 +37,10 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); + + public static final int ERRSTACK_CNT = 3; + public static final int ERRSTACK_MTY_CNT = 0; + long hdf_java_classid = -1; long current_stackid = -1; @@ -158,7 +162,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); try { num_msg = H5.H5Eget_num(current_stackid); @@ -168,7 +172,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); try { H5.H5Epop(current_stackid, 1); @@ -186,7 +190,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == 2); + assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1); } @Test @@ -227,7 +231,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == 0); + assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); } catch (Throwable err) { err.printStackTrace(); @@ -238,7 +242,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == 1); + assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT + 1); } catch (Throwable err) { err.printStackTrace(); @@ -314,7 +318,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3); + assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index e6ac7fa..8365027 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -27,12 +27,12 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Edefault { + @Rule public TestName testname = new TestName(); + public static final int ERRSTACK_CNT = 3; public static final int ERRSTACK_MTY_CNT = 0; public static final int ERRSTACK_POP_CNT = 2; - @Rule public TestName testname = new TestName(); - @Before public void H5Eset_default_stack() { assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); -- cgit v0.12 From bd1be52990553fa700c0aad09a3adcd28012af2f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:59:03 -0500 Subject: Fix typo --- java/test/TestH5E.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index a1ca42c..f6db1ed 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -242,7 +242,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT + 1); + assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT + 1); } catch (Throwable err) { err.printStackTrace(); -- cgit v0.12 From 59f36c5cdef1899742feb1c06ee09886e2d0a220 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 10:52:43 -0500 Subject: Remove extra constant --- java/test/TestH5Edefault.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 8365027..b510936 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -31,7 +31,6 @@ public class TestH5Edefault { public static final int ERRSTACK_CNT = 3; public static final int ERRSTACK_MTY_CNT = 0; - public static final int ERRSTACK_POP_CNT = 2; @Before public void H5Eset_default_stack() { @@ -217,7 +216,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_POP_CNT); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT - 1); //Verify the copy still has the correct number of messages try { @@ -347,7 +346,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); //Verify the copy still has the correct number of messages try { @@ -399,7 +398,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); } @Test(expected = IllegalArgumentException.class) -- cgit v0.12 From b3ad9e1c0e3d70233518ee84bd68935f5adb3b89 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Sep 2018 09:01:57 -0500 Subject: Fix missed replacement --- java/test/TestH5E.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index f6db1ed..1f4e658 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -328,7 +328,7 @@ public class TestH5E { fail("testH5Ewalk:H5Ewalk2 " + err); } assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); - assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==4); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==TestH5E.ERRSTACK_CNT); } } -- cgit v0.12 From 2862c93a2bd863a44ffe4e9664905090bc58f9ed Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Sep 2018 10:15:12 -0500 Subject: Correct $withval usage in configure --- configure.ac | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index cedfcfd..469c53d 100644 --- a/configure.ac +++ b/configure.ac @@ -1261,8 +1261,8 @@ AC_ARG_WITH([dmalloc], [Use dmalloc memory debugging aid [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_DMALLOC="yes" AC_CHECK_HEADERS([dmalloc.h],, [unset HAVE_DMALLOC]) if test "x$HAVE_DMALLOC" = "xyes"; then @@ -1272,7 +1272,7 @@ case $withval in AC_MSG_ERROR([couldn't find dmalloc library]) fi ;; - no) + X-|X-no|X-none) HAVE_DMALLOC="no" AC_MSG_CHECKING([for dmalloc library]) AC_MSG_RESULT([suppressed]) @@ -1340,8 +1340,8 @@ AC_ARG_WITH([zlib], filter [default=yes]])],, [withval=yes]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_ZLIB="yes" AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB]) if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then @@ -1355,7 +1355,7 @@ case $withval in AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) fi ;; - no) + X-|X-no|X-none) HAVE_ZLIB="no" AC_MSG_CHECKING([for zlib]) AC_MSG_RESULT([suppressed]) @@ -1434,8 +1434,8 @@ AC_ARG_WITH([szlib], filter [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_SZLIB="yes" AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZLIB]) if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then @@ -1445,7 +1445,7 @@ case $withval in AC_MSG_ERROR([couldn't find szlib library]) fi ;; - no) + X-|X-no|X-none) HAVE_SZLIB="no" AC_MSG_CHECKING([for szlib]) AC_MSG_RESULT([suppressed]) -- cgit v0.12 From 67a126c7ba8825ffb193c930c7b8cae939b3446d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 20 Sep 2018 10:40:51 -0700 Subject: Normalization with vol_integration (test code and H5Xtest.c) --- src/H5ACprivate.h | 2 +- src/H5Atest.c | 34 +- src/H5Ctest.c | 2 +- src/H5Dtest.c | 8 +- src/H5EApkg.h | 4 +- src/H5EAtest.c | 16 +- src/H5Edeprec.c | 10 +- src/H5FApkg.h | 4 +- src/H5FAtest.c | 25 +- src/H5FDspace.c | 1 + src/H5FSpkg.h | 4 +- src/H5FStest.c | 20 +- src/H5Fpkg.h | 10 +- src/H5Ftest.c | 105 ++-- src/H5Gpkg.h | 3 +- src/H5Gtest.c | 80 ++- src/H5HLdbg.c | 46 +- src/H5Ipublic.h | 2 +- src/H5MF.c | 3 + src/H5MFprivate.h | 3 +- src/H5Opkg.h | 19 +- src/H5Otest.c | 130 ++--- src/H5PBprivate.h | 6 +- src/H5Ppkg.h | 4 +- src/H5Ptest.c | 40 +- src/H5SMtest.c | 2 +- src/H5TS.c | 6 +- src/H5TSprivate.h | 1 + test/cache_common.c | 107 ++-- test/cache_logging.c | 9 +- test/cache_tagging.c | 25 +- test/dangle.c | 3 +- test/earray.c | 10 +- test/efc.c | 13 +- test/err_compat.c | 2 +- test/evict_on_close.c | 48 +- test/farray.c | 328 ++++++------ test/fheap.c | 2 +- test/fillval.c | 57 ++- test/freespace.c | 22 +- test/gheap.c | 344 ++++++------- test/h5test.c | 10 +- test/istore.c | 2 +- test/lheap.c | 12 +- test/mf.c | 74 +-- test/objcopy.c | 1 - test/ohdr.c | 30 +- test/page_buffer.c | 10 +- test/swmr.c | 4 +- test/swmr_generator.c | 4 +- test/tarray.c | 40 +- test/tattr.c | 1154 +++++++++++++++++++++---------------------- test/testfiles/err_compat_1 | 2 +- test/testframe.c | 8 +- test/testhdf5.c | 4 +- test/tfile.c | 37 +- test/tgenprop.c | 12 +- test/th5s.c | 1 - test/tmisc.c | 30 +- test/tsohm.c | 24 +- test/tunicode.c | 2 +- test/tvltypes.c | 4 +- test/unregister.c | 239 +++++---- test/vfd.c | 21 +- 64 files changed, 1627 insertions(+), 1658 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 99cc0e9..0e8620d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -435,7 +435,7 @@ H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, /* Tag & Ring routines */ H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag); H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag); -H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hbool_t match_global); +H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global); H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag); H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f); H5_DLL herr_t H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked); diff --git a/src/H5Atest.c b/src/H5Atest.c index 31fbe8e..36c3d35 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Atest.c - * Dec 18 2006 - * Quincey Koziol + * Created: H5Atest.c * - * Purpose: Attribute testing routines. + * Purpose: Attribute testing routines. * *------------------------------------------------------------------------- */ @@ -27,19 +25,19 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5A_TESTING /*suppress warning about H5A testing funcs*/ +#define H5A_TESTING /* Suppress warning about H5A testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ @@ -78,12 +76,11 @@ /*------------------------------------------------------------------------- - * Function: H5A__is_shared_test + * Function: H5A__is_shared_test * * Purpose: Check if an attribute is shared * - * Return: Success: Non-negative - * Failure: Negative + * Return: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Dec 19, 2006 @@ -111,12 +108,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__get_shared_rc_test + * Function: H5A__get_shared_rc_test * * Purpose: Retrieve the refcount for a shared attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 19, 2006 @@ -127,7 +123,7 @@ herr_t H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) { H5A_t *attr; /* Attribute object for ID */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Ctest.c b/src/H5Ctest.c index 2cd0a5d..9da6350 100644 --- a/src/H5Ctest.c +++ b/src/H5Ctest.c @@ -143,7 +143,7 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) /* Get file pointer */ if(NULL == (f = (H5F_t *)H5I_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") /* Get cache pointer */ cache = f->shared->cache; diff --git a/src/H5Dtest.c b/src/H5Dtest.c index c2b6199..ac1d05a 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -28,10 +28,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ /****************/ diff --git a/src/H5EApkg.h b/src/H5EApkg.h index fb9afc0..0adcde2 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -469,8 +469,8 @@ H5_DLL herr_t H5EA__dblock_debug(H5F_t *f, haddr_t addr, /* Testing routines */ #ifdef H5EA_TESTING -H5_DLL herr_t H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam); -H5_DLL int H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2); +H5_DLL herr_t H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam); +H5_DLL int H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2); #endif /* H5EA_TESTING */ #endif /* _H5EApkg_H */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 3da7996..7c02e16 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -401,7 +401,7 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5EA_get_cparam_test + * Function: H5EA__get_cparam_test * * Purpose: Retrieve the parameters used to create the extensible array * @@ -413,9 +413,9 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, +BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, -H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) +H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) /* Check arguments. */ HDassert(ea); @@ -429,11 +429,11 @@ H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits; -END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ +END_FUNC(PKG) /* end H5EA__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5EA_cmp_cparam_test + * Function: H5EA__cmp_cparam_test * * Purpose: Compare the parameters used to create the extensible array * @@ -445,9 +445,9 @@ END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERRCATCH, +BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, -H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) +H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) /* Check arguments. */ HDassert(cparam1); @@ -481,5 +481,5 @@ H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2) CATCH -END_FUNC(PRIV) /* end H5EA_cmp_cparam_test() */ +END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 603d448..4462303 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -227,7 +227,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eclear1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Clears the error stack for the specified error stack. * * Return: SUCCEED/FAIL @@ -258,7 +258,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eprint1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Prints the error stack in some default way. This is just a * convenience function for H5Ewalk() with a function that * prints error messages. Users are encouraged to write there @@ -296,7 +296,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Ewalk1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Walks the error stack for the current thread and calls some * function for each error along the way. * @@ -335,7 +335,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eget_auto1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Returns the current settings for the automatic error stack * traversal function and its data for specific error stack. * Either (or both) arguments may be null in which case the @@ -381,7 +381,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eset_auto1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any * API function which returns an error indication will first diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 720c046..6ce899e 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -307,8 +307,8 @@ H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, /* Testing routines */ #ifdef H5FA_TESTING -H5_DLL herr_t H5FA_get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam); -H5_DLL int H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2); +H5_DLL herr_t H5FA__get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam); +H5_DLL int H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2); #endif /* H5FA_TESTING */ #endif /* _H5FApkg_H */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 4b03036..27cd8b7 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -70,12 +70,9 @@ typedef struct H5FA__test_ctx_t { static void *H5FA__test_crt_context(void *udata); static herr_t H5FA__test_dst_context(void *ctx); static herr_t H5FA__test_fill(void *nat_blk, size_t nelmts); -static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts, - void *ctx); -static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts, - void *ctx); -static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth, - hsize_t idx, const void *elmt); +static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts, void *ctx); +static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts, void *ctx); +static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); static void *H5FA__test_crt_dbg_context(H5F_t *f, haddr_t obj_addr); @@ -361,7 +358,7 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_cparam_test + * Function: H5FA__get_cparam_test * * Purpose: Retrieve the parameters used to create the fixed array * @@ -372,9 +369,9 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, +BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, -H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) +H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) /* Check arguments. */ HDassert(fa); @@ -384,11 +381,11 @@ H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size; cparam->nelmts = fa->hdr->cparam.nelmts; -END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ +END_FUNC(PKG) /* end H5FA__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FA_cmp_cparam_test + * Function: H5FA__cmp_cparam_test * * Purpose: Compare the parameters used to create the fixed array * @@ -399,9 +396,9 @@ END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERRCATCH, +BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, -H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) +H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) /* Check arguments. */ HDassert(cparam1); @@ -415,5 +412,5 @@ H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2) CATCH -END_FUNC(PRIV) /* end H5FA_cmp_cparam_test() */ +END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */ diff --git a/src/H5FDspace.c b/src/H5FDspace.c index e158a44..69fcb96 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -38,6 +38,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5FDpkg.h" /* File Drivers */ #include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FLprivate.h" /* Free lists */ /****************/ diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index a5896ee..f160055 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -242,8 +242,8 @@ H5_DLL void H5FS__sect_assert(const H5FS_t *fspace); /* Testing routines */ #ifdef H5FS_TESTING -H5_DLL herr_t H5FS_get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam); -H5_DLL int H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2); +H5_DLL herr_t H5FS__get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam); +H5_DLL int H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2); #endif /* H5FS_TESTING */ #endif /* _H5FSpkg_H */ diff --git a/src/H5FStest.c b/src/H5FStest.c index 5ab0219..120a9a8 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -69,7 +69,7 @@ /*------------------------------------------------------------------------- - * Function: H5FS_get_cparam_test + * Function: H5FS__get_cparam_test * * Purpose: Retrieve the parameters used to create the free-space manager * similar to H5HF_get_cparam_test() @@ -82,9 +82,9 @@ *------------------------------------------------------------------------- */ herr_t -H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) +H5FS__get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(frsp); @@ -97,16 +97,16 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) cparam->max_sect_size = frsp->max_sect_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_get_cparam_test() */ +} /* H5FS__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FS_cmp_cparam_test + * Function: H5FS__cmp_cparam_test * * Purpose: Compare the parameters used to create the free space manager * similar to H5HF_cmp_cparam_test() * - * Return: SUCCEED/FAIL + * Return: A value like strcmp() * * Programmer: Vailin Choi * August 25th, 2008 @@ -114,11 +114,11 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) *------------------------------------------------------------------------- */ int -H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) +H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) { - int ret_value = SUCCEED; /* Return value */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(cparam1); @@ -151,5 +151,5 @@ H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_cmp_cparam_test */ +} /* H5FS__cmp_cparam_test */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2e8a793..3716c66 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -30,7 +30,7 @@ #include "H5Fprivate.h" /* Other public headers needed by this file */ -#include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */ +#include "H5Bpublic.h" /* B-tree header (for H5B_NUM_BTREE_ID) */ /* Other private headers needed by this file */ #include "H5private.h" /* Generic Functions */ @@ -462,10 +462,10 @@ H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f); /* Testing functions */ #ifdef H5F_TESTING -H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); -H5_DLL herr_t H5F_check_cached_stab_test(hid_t file_id); -H5_DLL herr_t H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); -H5_DLL herr_t H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); +H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); +H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id); +H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); +H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index bdecad2..df9c933 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -26,24 +26,24 @@ /* Module Setup */ /****************/ -#include "H5Fmodule.h" /* This source code file is part of the H5F module */ -#define H5F_TESTING /*suppress warning about H5F testing funcs*/ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#define H5G_TESTING /*suppress warning about H5G testing funcs*/ -#define H5SM_FRIEND /*suppress error about including H5SMpkg */ -#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#define H5F_TESTING /* Suppress warning about H5F testing funcs */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg.h */ +#define H5G_TESTING /* Suppress warning about H5G testing funcs */ +#define H5SM_FRIEND /* Suppress error about including H5SMpkg.h */ +#define H5SM_TESTING /* Suppress warning about H5SM testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMpkg.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMpkg.h" /* Shared object header messages */ /****************/ @@ -82,31 +82,29 @@ /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_mesg_count_test + * Function: H5F__get_sohm_mesg_count_test * * Purpose: Retrieve the number of shared messages of a given type in a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 3, 2007 + * Programmer: Quincey Koziol + * Jan 3, 2007 * *------------------------------------------------------------------------- */ herr_t -H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, - size_t *mesg_count) +H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_count) { - H5F_t *file; /* File info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_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) @@ -122,19 +120,18 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_sohm_mesg_count_test() */ +} /* end H5F__get_sohm_mesg_count_test() */ /*------------------------------------------------------------------------- - * Function: H5F_check_cached_stab_test + * Function: H5F__check_cached_stab_test * * Purpose: Check that a file's superblock contains a cached symbol * table entry, that the entry matches that in the root * group's object header, and check that the addresses are * valid. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Mar 31, 2009 @@ -142,17 +139,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_check_cached_stab_test(hid_t file_id) +H5F__check_cached_stab_test(hid_t file_id) { - H5F_t *file; /* File info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_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) @@ -168,16 +165,15 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_check_cached_stab_test() */ +} /* end H5F__check_cached_stab_test() */ /*------------------------------------------------------------------------- - * Function: H5F_get_maxaddr_test + * Function: H5F__get_maxaddr_test * * Purpose: Retrieve the maximum address for a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Jun 10, 2009 @@ -185,33 +181,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) +H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_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; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_maxaddr_test() */ +} /* end H5F__get_maxaddr_test() */ /*------------------------------------------------------------------------- - * Function: H5F_get_sbe_addr_test + * Function: H5F__get_sbe_addr_test * * Purpose: Retrieve the address of a superblock extension's object header - * for a file + * for a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Jul 10, 2016 @@ -219,21 +214,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) +H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_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; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_sbe_addr_test() */ +} /* end H5F__get_sbe_addr_test() */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b89777d..ae697ad 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -429,8 +429,7 @@ H5_DLL herr_t H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type H5_DLL herr_t H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *last_lnk, const H5G_lib_iterate_t op, void *op_data); H5_DLL herr_t H5G__link_release_table(H5G_link_table_t *ltable); -H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, - const H5O_link_t *lnk); +H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_t *lnk); /* Functions that understand "compact" link storage */ H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk); diff --git a/src/H5Gtest.c b/src/H5Gtest.c index f2f3e3a..1899606 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -28,13 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5Iprivate.h" /* IDs */ /****************/ /* Local Macros */ @@ -80,7 +80,7 @@ htri_t H5G__is_empty_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has no link messages and no symbol table message and no "dense" link storage @@ -114,7 +114,7 @@ H5G__is_empty_test(hid_t gid) /* 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) @@ -127,7 +127,7 @@ H5G__is_empty_test(hid_t gid) /* 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 */ @@ -158,7 +158,7 @@ H5G__is_empty_test(hid_t gid) /* 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 */ @@ -202,7 +202,7 @@ done: hid_t gid; IN: group to check unsigned *nmsgs; OUT: # of link messages in header RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has link messages and how many. GLOBAL VARIABLES @@ -232,15 +232,15 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) /* 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) /* 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) { @@ -269,7 +269,7 @@ done: htri_t H5G__has_stab_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has a symbol table message. GLOBAL VARIABLES @@ -299,15 +299,15 @@ H5G__has_stab_test(hid_t gid) /* 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) /* 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() < 0) @@ -326,7 +326,7 @@ done: htri_t H5G__is_new_dense_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group is in the "new" format for groups (link messages/ fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has @@ -358,19 +358,19 @@ H5G__is_new_dense_test(hid_t gid) /* 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) /* 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) /* 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 */ @@ -404,7 +404,7 @@ done: hsize_t *name_count; OUT: Number of links in name index hsize_t *corder_count; OUT: Number of links in creation order index RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Currently, just retrieves the number of links in each index and returns them. @@ -495,7 +495,7 @@ done: hid_t gid; IN: group to check size_t *lheap_size; OUT: Size of local heap RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Checks the size of the local heap for a group GLOBAL VARIABLES @@ -525,11 +525,11 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) /* 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() < 0) @@ -551,7 +551,7 @@ done: size_t *user_path_len; OUT: Size of user path unsigned *obj_hidden; OUT: Whether object is hidden RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Retrieves the user path for an ID. A zero for the length is returned in the case of no user path. @@ -648,15 +648,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__verify_cached_stab_test + * Function: H5G__verify_cached_stab_test * * Purpose: Check that a that the provided group entry contains a * cached symbol table entry, that the entry matches that in * the provided group's object header, and check that the * addresses are valid. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Mar 31, 2009 @@ -666,9 +665,9 @@ done: herr_t H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { - H5O_stab_t stab; /* Symbol table */ - H5HL_t *heap = NULL; /* Pointer to local heap */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /* Symbol table */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) @@ -681,7 +680,8 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) 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 */ + * 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") @@ -711,7 +711,7 @@ done: * group with a symbol table, and that that information is * correct. * - * Return: Non-negative on success/Negative on failure + * Return: H5_ITER_STOP/H5_ITER_CONT/H5_ITER_ERROR * * Programmer: Neil Fortner * Apr 8, 2011 @@ -732,9 +732,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); @@ -749,7 +747,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, targ_oloc.holding_file = FALSE; /* Iterate over entries */ - for(i=0; insyms; i++) { + for(i = 0; i < sn->nsyms; i++) { /* Update oloc address */ targ_oloc.addr = sn->entry[i].header; @@ -773,7 +771,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, 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") - } /* end if */ + } else if(sn->entry[i].type == H5G_CACHED_STAB) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached") diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index e4e6fa8..edb0261 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -76,10 +76,10 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) "Data bytes allocated for heap:", h->dblk_size); - /* - * Traverse the free list and check that all free blocks fall within + /* 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. */ + * the heap. + */ if(NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); @@ -88,35 +88,30 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) 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); - if((freelist->offset + freelist->size) > h->dblk_size) - HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); - else { + HDfprintf(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"); + else { int overlap = 0; size_t i; - for(i = 0; i < freelist->size; i++) { - if(marker[freelist->offset + i]) - overlap++; - marker[freelist->offset + i] = 1; - } /* end for */ - if(overlap) - HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); - else - amount_free += freelist->size; - } /* end for */ + for(i = 0; i < freelist->size; i++) { + if(marker[freelist->offset + i]) + overlap++; + marker[freelist->offset + i] = 1; + } /* end for */ + if(overlap) + HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + else + amount_free += freelist->size; + } /* end else */ } /* end for */ if(h->dblk_size) - HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, - "Percent of heap used:", - ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); + HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", + ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); - /* - * Print the data in a VMS-style octal dump. - */ + /* Print the data in a VMS-style octal dump */ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); CATCH @@ -127,3 +122,4 @@ CATCH H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); END_FUNC(PRIV) /* end H5HL_debug() */ + diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index c737bbe..c471e5a 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -66,7 +66,7 @@ typedef int64_t hid_t; * can be removed from the ID type. If the function returns negative * (failure) then the object will remain in the ID type. */ -typedef herr_t (*H5I_free_t)(void*); +typedef herr_t (*H5I_free_t)(void *); /* Type of the function to compare objects & keys */ typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); diff --git a/src/H5MF.c b/src/H5MF.c index 65b27db..0d368d4 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -2291,6 +2291,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2320,6 +2321,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; @@ -2435,6 +2437,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 58e5054..bd57f05 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -60,8 +60,7 @@ H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5MF_try_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested); -H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, - hsize_t size); +H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size); H5_DLL ssize_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 19d90c5..059b46a 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -648,16 +648,15 @@ H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS]; /* Testing functions */ #ifdef H5O_TESTING -H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid); -H5_DLL htri_t H5O_is_attr_dense_test(hid_t oid); -H5_DLL herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs); -H5_DLL herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); -H5_DLL herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val); -H5_DLL herr_t H5O_expunge_chunks_test(const H5O_loc_t *oloc); -H5_DLL herr_t H5O_get_rc(const H5O_loc_t *oloc, unsigned *rc); -H5_DLL herr_t H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, - unsigned *chunk_num); -H5_DLL herr_t H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); +H5_DLL htri_t H5O__is_attr_empty_test(hid_t oid); +H5_DLL htri_t H5O__is_attr_dense_test(hid_t oid); +H5_DLL herr_t H5O__num_attrs_test(hid_t oid, hsize_t *nattrs); +H5_DLL herr_t H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); +H5_DLL herr_t H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val); +H5_DLL herr_t H5O__expunge_chunks_test(const H5O_loc_t *oloc); +H5_DLL herr_t H5O__get_rc_test(const H5O_loc_t *oloc, unsigned *rc); +H5_DLL herr_t H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num); +H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); #endif /* H5O_TESTING */ /* Object header debugging routines */ diff --git a/src/H5Otest.c b/src/H5Otest.c index 32b31f2..7cb7b3d 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -75,11 +75,11 @@ /*-------------------------------------------------------------------------- NAME - H5O_is_attr_dense_test + H5O__is_attr_dense_test PURPOSE Determine whether attributes for an object are stored "densely" USAGE - htri_t H5O_is_attr_dense_test(oid) + htri_t H5O__is_attr_dense_test(oid) hid_t oid; IN: object to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -93,7 +93,7 @@ REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5O_is_attr_dense_test(hid_t oid) +H5O__is_attr_dense_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ @@ -101,7 +101,7 @@ H5O_is_attr_dense_test(hid_t oid) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -114,7 +114,7 @@ H5O_is_attr_dense_test(hid_t oid) /* 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; @@ -136,21 +136,21 @@ 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() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_is_attr_dense_test() */ +} /* H5O__is_attr_dense_test() */ /*-------------------------------------------------------------------------- NAME - H5O_is_attr_empty_test + H5O__is_attr_empty_test PURPOSE Determine whether there are any attributes for an object USAGE - htri_t H5O_is_attr_empty_test(oid) + htri_t H5O__is_attr_empty_test(oid) hid_t oid; IN: object to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -163,7 +163,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5O_is_attr_empty_test(hid_t oid) +H5O__is_attr_empty_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -174,7 +174,7 @@ H5O_is_attr_empty_test(hid_t oid) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -187,7 +187,7 @@ H5O_is_attr_empty_test(hid_t oid) /* 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) { @@ -237,21 +237,21 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) 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() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_is_attr_empty_test() */ +} /* H5O__is_attr_empty_test() */ /*-------------------------------------------------------------------------- NAME - H5O_num_attrs_test + H5O__num_attrs_test PURPOSE Determine whether there are any attributes for an object USAGE - herr_t H5O_num_attrs_test(oid, nattrs) + herr_t H5O__num_attrs_test(oid, nattrs) hid_t oid; IN: object to check hsize_t *nattrs; OUT: Number of attributes on object RETURNS @@ -265,7 +265,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) +H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -275,7 +275,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -288,7 +288,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) /* 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; @@ -335,21 +335,21 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) 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() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_num_attrs_test() */ +} /* H5O__num_attrs_test() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_dense_info_test + H5O__attr_dense_info_test PURPOSE Retrieve information about the state of the "dense" storage for attributes USAGE - herr_t H5O_attr_dense_info_test(oid, name_count, corder_count) + herr_t H5O__attr_dense_info_test(oid, name_count, corder_count) hid_t oid; IN: Object to check hsize_t *name_count; OUT: Number of attributes in name index hsize_t *corder_count; OUT: Number of attributes in creation order index @@ -365,7 +365,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) +H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -375,7 +375,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -391,7 +391,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* 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; @@ -438,22 +438,22 @@ done: 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") 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() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_attr_dense_info_test() */ +} /* H5O__attr_dense_info_test() */ /*-------------------------------------------------------------------------- NAME - H5O_check_msg_marked_test + H5O__check_msg_marked_test PURPOSE Check if an unknown message with the "mark if unknown" flag actually gets marked. USAGE - herr_t H5O_check_msg_marked_test(oid, flag_val) + herr_t H5O__check_msg_marked_test(oid, flag_val) hid_t oid; IN: Object to check hbool_t flag_val; IN: Desired flag value RETURNS @@ -468,7 +468,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) +H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -476,7 +476,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) unsigned idx; /* Index of message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -484,11 +484,11 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) /* 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++) - if(idx_msg->type->id == H5O_UNKNOWN_ID) { + if(idx_msg->type->id == H5O_UNKNOWN_ID) { /* 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") @@ -503,15 +503,15 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) 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() */ +} /* H5O__check_msg_marked_test() */ /*-------------------------------------------------------------------------- NAME - H5O_expunge_chunks_test + H5O__expunge_chunks_test PURPOSE Expunge all the chunks for an object header from the cache. USAGE @@ -529,7 +529,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_expunge_chunks_test(const H5O_loc_t *loc) +H5O__expunge_chunks_test(const H5O_loc_t *loc) { H5O_t *oh = NULL; /* Object header */ haddr_t chk_addr[16]; /* Array of chunk addresses */ @@ -537,11 +537,11 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* 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; @@ -553,7 +553,7 @@ 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) */ @@ -563,16 +563,16 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_expunge_chunks_test() */ +} /* H5O__expunge_chunks_test() */ /*-------------------------------------------------------------------------- NAME - H5O_get_rc + H5O__get_rc_test PURPOSE Retrieve the refcount for the object header USAGE - herr_t H5O_expunge_chunks_test(loc, rc) + herr_t H5O__get_rc_test(loc, rc) const H5O_loc_t *loc; IN: Object location for object header to query unsigned *rc; OUT: Pointer to refcount for object header RETURNS @@ -587,12 +587,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_get_rc(const H5O_loc_t *loc, unsigned *rc) +H5O__get_rc_test(const H5O_loc_t *loc, unsigned *rc) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -600,7 +600,7 @@ H5O_get_rc(const H5O_loc_t *loc, unsigned *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; @@ -608,19 +608,19 @@ H5O_get_rc(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_expunge_chunks_test() */ +} /* H5O__get_rc_test() */ /*-------------------------------------------------------------------------- NAME - H5O_msg_get_chunkno_test + H5O__msg_get_chunkno_test PURPOSE Retrieve the chunk number for an object header message of a given type. USAGE - herr_t H5O_check_msg_marked_test(oid, chunk_num) + herr_t H5O__msg_get_chunkno_test(oid, msg_type, chunk_num) hid_t oid; IN: Object to check unsigned msg_type; IN: Object header message type to check unsigned *chunk_num; OUT: Object header chunk that the message is in @@ -636,7 +636,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) +H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -645,7 +645,7 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -658,11 +658,11 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) /* 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++) - if(idx_msg->type->id == msg_type) { + if(idx_msg->type->id == msg_type) { /* Set the chunk number for the message */ *chunk_num = idx_msg->chunkno; @@ -676,21 +676,21 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) 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() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_msg_get_chunkno_test() */ +} /* H5O__msg_get_chunkno_test() */ /*-------------------------------------------------------------------------- NAME - H5O_msg_move_to_new_chunk_test + H5O__msg_move_to_new_chunk_test PURPOSE Move a message into a new chunk USAGE - herr_t H5O_msg_move_to_new_chunk_test(oid, msg_type) + herr_t H5O__msg_move_to_new_chunk_test(oid, msg_type) hid_t oid; IN: Object to check unsigned msg_type; IN: Object header message type to check RETURNS @@ -704,7 +704,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) +H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -713,7 +713,7 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -726,11 +726,11 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) /* 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++) - if(curr_msg->type->id == msg_type) { + if(curr_msg->type->id == msg_type) { H5O_msg_alloc_info_t found_msg; /* Information about message to move */ unsigned msg_chunkno = curr_msg->chunkno; /* Chunk that the message is in */ uint8_t *end_chunk_data = (oh->chunk[msg_chunkno].image + oh->chunk[msg_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[msg_chunkno].gap); /* End of message data in chunk */ @@ -784,10 +784,10 @@ 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() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_msg_get_chunkno_test() */ +} /* H5O__msg_get_chunkno_test() */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index aef87e1..b94b845 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -91,10 +91,8 @@ H5_DLL herr_t H5PB_dest(H5F_t *f); H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr); H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr); -H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/); -H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf); +H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 60b2363..19ff7f9 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -200,8 +200,8 @@ H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, /* Testing functions */ #ifdef H5P_TESTING -H5_DLL char *H5P_get_class_path_test(hid_t pclass_id); -H5_DLL hid_t H5P_open_class_path_test(const char *path); +H5_DLL char *H5P__get_class_path_test(hid_t pclass_id); +H5_DLL hid_t H5P__open_class_path_test(const char *path); #endif /* H5P_TESTING */ #endif /* _H5Ppkg_H */ diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 475a164..075040d 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -35,11 +35,11 @@ /*-------------------------------------------------------------------------- NAME - H5P_get_class_path_test + H5P__get_class_path_test PURPOSE Routine to query the full path of a generic property list class USAGE - char *H5P_get_class_name_test(pclass_id) + char *H5P__get_class_name_test(pclass_id) hid_t pclass_id; IN: Property class to query RETURNS Success: Pointer to a malloc'ed string containing the full path of class @@ -51,17 +51,17 @@ GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path() + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__get_class_path() EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ char * -H5P_get_class_path_test(hid_t pclass_id) +H5P__get_class_path_test(hid_t pclass_id) { H5P_genclass_t *pclass; /* Property class to query */ char *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) @@ -73,53 +73,53 @@ H5P_get_class_path_test(hid_t pclass_id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_path_test() */ +} /* H5P__get_class_path_test() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path_test + H5P__open_class_path_test PURPOSE Routine to open a [copy of] a class with its full path name USAGE - hid_t H5P_open_class_name_test(path) + hid_t H5P__open_class_name_test(path) const char *path; IN: Full path name of class to open [copy of] RETURNS Success: ID of generic property class - Failure: NULL + Failure: H5I_INVALID_HID DESCRIPTION This routine opens [a copy] of the class indicated by the full path. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_open_class_path() + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__open_class_path() EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ hid_t -H5P_open_class_path_test(const char *path) +H5P__open_class_path_test(const char *path) { H5P_genclass_t *pclass = NULL; /* Property class to query */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments. */ - if (NULL == path || *path=='\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid class path"); + if(NULL == path || *path=='\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid class path"); /* Open the property list class */ - if ((pclass=H5P_open_class_path(path))==NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to find class with full path"); + if(NULL == (pclass = H5P_open_class_path(path))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path"); /* Get an atom for the class */ - if ((ret_value=H5I_register(H5I_GENPROP_CLS, pclass, TRUE))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); done: - if(ret_value<0 && pclass) + if(H5I_INVALID_HID == ret_value && pclass) H5P_close_class(pclass); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_open_class_path_test() */ +} /* H5P__open_class_path_test() */ diff --git a/src/H5SMtest.c b/src/H5SMtest.c index 490265c..0a6149d 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -113,7 +113,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/src/H5TS.c b/src/H5TS.c index d239e09..10e14d5 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -359,7 +359,6 @@ H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex) ret_value = FALSE; #endif /* H5_HAVE_CODESTACK */ - /* Set up thread local storage */ if(TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc())) ret_value = FALSE; @@ -428,12 +427,9 @@ H5TS_win32_process_exit(void) /* Clean up per-process thread local storage */ TlsFree(H5TS_errstk_key_g); - #ifdef H5_HAVE_CODESTACK TlsFree(H5TS_funcstk_key_g); #endif /* H5_HAVE_CODESTACK */ - - /* Clean up per-process thread local storage */ TlsFree(H5TS_apictx_key_g); return; @@ -479,7 +475,6 @@ H5TS_win32_thread_exit(void) LocalFree((HLOCAL)lpvData); #endif /* H5_HAVE_CODESTACK */ - /* Clean up per-thread thread local storage */ lpvData = TlsGetValue(H5TS_apictx_key_g); if(lpvData) LocalFree((HLOCAL)lpvData); @@ -534,3 +529,4 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata) } /* H5TS_create_thread */ #endif /* H5_HAVE_THREADSAFE */ + diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index 8d74676..9e093a6 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -128,3 +128,4 @@ H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t * att #endif /* c_plusplus || __cplusplus */ #endif /* H5TSprivate_H_ */ + diff --git a/test/cache_common.c b/test/cache_common.c index 2cc188e..b078964 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" #include "H5MMprivate.h" + #include "cache_common.h" @@ -3276,23 +3277,24 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - HDassert(fid >= 0); - saved_fid = fid; + HDassert(fid >= 0); + saved_fid = fid; if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { pass = FALSE; failure_mssg = "H5Fflush() failed."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } else { + } + else { file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); - if(file_ptr == NULL) { + if(file_ptr == NULL) { pass = FALSE; failure_mssg = "Can't get file_ptr."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } + } } } @@ -3303,36 +3305,36 @@ setup_cache(size_t max_cache_size, if(pass) { /* A bit of fancy footwork here: - * - * The call to H5Fcreate() allocates an instance of H5C_t, - * initializes it, and stores its address in f->shared->cache. - * - * We don't want to use this cache, as it has a bunch of extra - * initialization that may change over time, and in any case - * it will not in general be configured the way we want it. - * - * We used to deal with this problem by storing the file pointer - * in another instance of H5C_t, and then ignoring the original - * version. However, this strategy doesn't work any more, as - * we can't store the file pointer in the instance of H5C_t, - * and we have modified many cache routines to use a file - * pointer to look up the target cache. - * - * Thus we now make note of the address of the instance of - * H5C_t created by the call to H5Fcreate(), set - * file_ptr->shared->cache to NULL, call H5C_create() - * to allocate a new instance of H5C_t for test purposes, - * and store than new instance's address in - * file_ptr->shared->cache. - * - * On shut down, we call H5C_dest on our instance of H5C_t, - * set file_ptr->shared->cache to point to the original - * instance, and then close the file normally. - */ + * + * The call to H5Fcreate() allocates an instance of H5C_t, + * initializes it, and stores its address in f->shared->cache. + * + * We don't want to use this cache, as it has a bunch of extra + * initialization that may change over time, and in any case + * it will not in general be configured the way we want it. + * + * We used to deal with this problem by storing the file pointer + * in another instance of H5C_t, and then ignoring the original + * version. However, this strategy doesn't work any more, as + * we can't store the file pointer in the instance of H5C_t, + * and we have modified many cache routines to use a file + * pointer to look up the target cache. + * + * Thus we now make note of the address of the instance of + * H5C_t created by the call to H5Fcreate(), set + * file_ptr->shared->cache to NULL, call H5C_create() + * to allocate a new instance of H5C_t for test purposes, + * and store than new instance's address in + * file_ptr->shared->cache. + * + * On shut down, we call H5C_dest on our instance of H5C_t, + * set file_ptr->shared->cache to point to the original + * instance, and then close the file normally. + */ HDassert(saved_cache == NULL); - saved_cache = file_ptr->shared->cache; - file_ptr->shared->cache = NULL; + saved_cache = file_ptr->shared->cache; + file_ptr->shared->cache = NULL; cache_ptr = H5C_create(max_cache_size, min_clean_size, @@ -3351,19 +3353,20 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - if(cache_ptr == NULL) { + if(cache_ptr == NULL) { pass = FALSE; failure_mssg = "H5C_create() failed."; if(verbose) HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC); - } else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { + } + else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { pass = FALSE; - failure_mssg = "Bad cache_ptr magic."; + failure_mssg = "Bad cache_ptr magic."; if(verbose) HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC); - } + } } if(show_progress) /* 7 */ @@ -3446,7 +3449,7 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - if ( H5C_prep_for_file_close(file_ptr) < 0 ) { + if ( H5C_prep_for_file_close(file_ptr) < 0 ) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; @@ -3456,23 +3459,23 @@ takedown_cache(H5F_t * file_ptr, H5C_dest(file_ptr); - if ( saved_cache != NULL ) { + if ( saved_cache != NULL ) { - file_ptr->shared->cache = saved_cache; - saved_cache = NULL; - } + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + } } if ( saved_fapl_id != H5P_DEFAULT ) { H5Pclose(saved_fapl_id); - saved_fapl_id = H5P_DEFAULT; + saved_fapl_id = H5P_DEFAULT; } if ( saved_fcpl_id != H5P_DEFAULT ) { H5Pclose(saved_fcpl_id); - saved_fcpl_id = H5P_DEFAULT; + saved_fcpl_id = H5P_DEFAULT; } if ( saved_fid != -1 ) { @@ -3489,21 +3492,21 @@ takedown_cache(H5F_t * file_ptr, saved_actual_base_addr = HADDR_UNDEF; } - if ( H5Fclose(saved_fid) < 0 ) { + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; - failure_mssg = "couldn't close test file."; + failure_mssg = "couldn't close test file."; - } else { + } else { - saved_fid = -1; + saved_fid = -1; } /* Pop API context */ H5CX_pop(); - if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -3515,10 +3518,10 @@ takedown_cache(H5F_t * file_ptr, if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "couldn't delete test file."; + failure_mssg = "couldn't delete test file."; - } - } + } + } } return; diff --git a/test/cache_logging.c b/test/cache_logging.c index 1eb9d41..6fd48d8 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -40,8 +40,8 @@ test_logging_api(void) char *location = NULL; size_t size; - hid_t fid; - hid_t gid; + hid_t fid = -1; + hid_t gid = -1; hbool_t is_currently_logging; char group_name[8]; char filename[1024]; @@ -166,10 +166,11 @@ main(void) if(nerrors) { HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return 1; + HDexit(EXIT_FAILURE); } HDprintf("All Metadata Cache Logging tests passed.\n"); - return 0; + + HDexit(EXIT_SUCCESS); } diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 119ba62..0160607 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -394,7 +394,7 @@ error: * Function: get_sbe_tag() * * Purpose: This function retrieves the tag associated with the superblock - * extension (the object header address stored in the superblock) + * extension (the object header address stored in the superblock) * * Return: 0 on Success; 1 on Failure * @@ -407,7 +407,7 @@ static int get_sbe_tag(hid_t fid, haddr_t *tag) { /* Retrieve the superblock extension's object header address for the file */ - if(H5F_get_sbe_addr_test(fid, tag) < 0) + if(H5F__get_sbe_addr_test(fid, tag) < 0) TEST_ERROR; return 0; @@ -3599,7 +3599,7 @@ check_external_link_open_tags(void) /* =========================== */ /* Close open objects and file */ /* =========================== */ - if ( (H5Gclose(xid)) < 0 ) TEST_ERROR; + if ( H5Gclose(xid) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; if ( H5Fclose(fid2) < 0 ) TEST_ERROR; @@ -3672,7 +3672,7 @@ check_invalid_tag_application(void) /* This should fail as no tag is set up during the protect call */ if (( lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR; - /* Again, set up a valid tag in the DXPL */ + /* Again, set up a valid tag in the API context */ H5AC_tag((haddr_t)25, NULL); /* Call H5HL_protect again to protect the local heap. This should succeed. */ @@ -3711,9 +3711,7 @@ error: * * Purpose: Run tests on library's ability to tag metadata entries. * - * Return: Success: - * - * Failure: + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * January 15, 2009 @@ -3755,12 +3753,12 @@ main(void) /* Run tests on each fcpl set up above. */ if (test_type == TEST_DEFAULT) { - if (!nerrs) printf("Testing standard tag application cases w/ default fcpl:\n"); + if (!nerrs) HDprintf("Testing standard tag application cases w/ default fcpl:\n"); fcpl = fcpl_default; } else if (test_type == TEST_SHMESG) { - if (!nerrs) printf("Testing standard tag application cases w/ shared messages:\n"); + if (!nerrs) HDprintf("Testing standard tag application cases w/ shared messages:\n"); fcpl = fcpl_shmesg_all; } else { @@ -3780,7 +3778,7 @@ main(void) if (!nerrs) nerrs += check_link_removal_tags(fcpl, test_type); } /* end for */ - if (!nerrs) printf("Testing other specific tag application cases:\n"); + if (!nerrs) HDprintf("Testing other specific tag application cases:\n"); if (!nerrs) nerrs += check_group_creation_tags(); if (!nerrs) nerrs += check_multi_group_creation_tags(); if (!nerrs) nerrs += check_group_open_tags(); @@ -3804,10 +3802,13 @@ main(void) HDremove(FILENAME2); /* Return Errors */ - return nerrs > 0; + if (nerrs > 0) + return EXIT_FAILURE; + else + return EXIT_SUCCESS; error: /* Return with Error */ - return 1; + return EXIT_FAILURE; } /* main */ diff --git a/test/dangle.c b/test/dangle.c index 75e9c84..9f30f10 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -602,7 +602,8 @@ test_dangle_force(void) TEST_ERROR; /* Allocate the array of object IDs */ - objs = (hid_t*)HDmalloc(sizeof(hid_t) * (size_t)count); + if(NULL == (objs = (hid_t *)HDcalloc((size_t)count, sizeof(hid_t)))) + TEST_ERROR; /* Get the list of open IDs */ if(H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) diff --git a/test/earray.c b/test/earray.c index d72b3f5..02e4d85 100644 --- a/test/earray.c +++ b/test/earray.c @@ -521,18 +521,18 @@ verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam) /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5EA_create_t)); - if(H5EA_get_cparam_test(ea, &test_cparam) < 0) + if(H5EA__get_cparam_test(ea, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5EA_cmp_cparam_test(cparam, &test_cparam)) + if(H5EA__cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return 0; error: - return(-1); + return -1; } /* verify_cparam() */ @@ -2398,7 +2398,7 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; diff --git a/test/efc.c b/test/efc.c index 5a946bb..d63ef34 100644 --- a/test/efc.c +++ b/test/efc.c @@ -2885,8 +2885,7 @@ error: * * Purpose: Test the external file cache code * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Neil Fortner * December 16, 2010 @@ -2900,7 +2899,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ - puts("Testing the external file cache"); + HDputs("Testing the external file cache"); /* Create property lists */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); @@ -2937,14 +2936,14 @@ main(void) if(nerrors) goto error; - puts("All external file cache tests passed."); + HDputs("All external file cache tests passed."); h5_clean_files(FILENAME, fapl_id); - return 0; + return EXIT_SUCCESS; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl_id); @@ -2952,6 +2951,6 @@ error: if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } /* end main() */ diff --git a/test/err_compat.c b/test/err_compat.c index eee150b..4860a3c 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -469,7 +469,7 @@ main(void) char filename[1024]; const char *FUNC_main="main"; - fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n"); + fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 6536837..9d23f2f 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Dana Robinson - * Spring 2016 - * - * Purpose: Tests the basic operation of the evict-on-close cache +/* Purpose: Tests the basic operation of the evict-on-close cache * behavior. Tests that ensure the tagging is handled correctly * are located in cache.c. */ @@ -91,9 +87,6 @@ static herr_t check_group_layout(hid_t fid, const char *group_name); * * Return: TRUE/FALSE * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hbool_t @@ -114,8 +107,8 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) return TRUE; else entry_ptr = entry_ptr->ht_next; - } /* end while */ - } /* end for */ + } + } return FALSE; } /* end verify_tag_not_in_cache() */ @@ -129,9 +122,6 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) * Return: Success: The file ID of the created file * Failure: -1 * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hid_t @@ -207,7 +197,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -303,7 +293,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -593,9 +583,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -710,9 +697,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -815,9 +799,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -873,7 +854,7 @@ check_evict_on_close_api(void) /* ensure an invalid plist fails */ H5E_BEGIN_TRY { - status = H5Pget_evict_on_close((hid_t)-1, &evict_on_close); + status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); @@ -897,9 +878,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -979,7 +957,7 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: @@ -992,7 +970,7 @@ error: H5Pclose(fapl_id); } H5E_END_TRY; - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* end main() */ @@ -1007,9 +985,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -1052,9 +1027,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -1076,14 +1048,14 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); HDprintf("Note that EoC is not supported under parallel so most tests are skipped.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: HDprintf("***** %u evict-on-close test%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* main() - parallel */ diff --git a/test/farray.c b/test/farray.c index 383cb32..21d3186 100644 --- a/test/farray.c +++ b/test/farray.c @@ -25,9 +25,9 @@ #include "H5FApkg.h" /* Fixed Arrays */ /* Other private headers that this test requires */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ @@ -113,74 +113,71 @@ h5_stat_size_t empty_size_g; /*------------------------------------------------------------------------- - * Function: init_cparam + * Function: init_cparam * - * Purpose: Initialize array creation parameter structure + * Purpose: Initialize array creation parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t init_cparam(H5FA_create_t *cparam, farray_test_param_t *tparam) { /* Wipe out background */ HDmemset(cparam, 0, sizeof(*cparam)); - cparam->cls = H5FA_CLS_TEST; - cparam->raw_elmt_size = ELMT_SIZE; - cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; - cparam->nelmts = tparam->nelmts; + cparam->cls = H5FA_CLS_TEST; + cparam->raw_elmt_size = ELMT_SIZE; + cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; + cparam->nelmts = tparam->nelmts; - return(0); + return SUCCEED; } /* init_cparam() */ /*------------------------------------------------------------------------- - * Function: create_file + * Function: create_file * - * Purpose: Create file and retrieve pointer to internal file object - * - * Return: Success: 0 - * Failure: -1 + * Purpose: Create file and retrieve pointer to internal file object * + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ -static int -create_file(hid_t fapl, hid_t *file, H5F_t **f) +static herr_t +create_file(hid_t fapl_id, hid_t *fid, H5F_t **f) { /* Create the file to work on */ - if((*file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((*fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if(NULL == (*f = (H5F_t *)H5I_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ if(H5AC_ignore_tags(*f) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_file() */ /*------------------------------------------------------------------------- - * Function: check_stats + * Function: check_stats * - * Purpose: Verify stats for a fixed array + * Purpose: Verify stats for a fixed array * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t check_stats(const H5FA_t *fa, const farray_state_t *state) { H5FA_stat_t farray_stats; /* Statistics about the array */ @@ -194,40 +191,38 @@ check_stats(const H5FA_t *fa, const farray_state_t *state) HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, state->hdr_size); TEST_ERROR - } /* end if */ + } if(farray_stats.dblk_size != state->dblk_size) { HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, state->dblk_size); TEST_ERROR - } /* end if */ + } if(farray_stats.nelmts != state->nelmts) { HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, state->nelmts); TEST_ERROR - } /* end if */ + } - /* All tests passed */ - return(0); + /* Success */ + return SUCCEED; error: - return(-1); + return FAIL; } /* check_stats() */ /*------------------------------------------------------------------------- - * Function: set_fa_state + * Function: set_fa_state * - * Purpose: Set the state of the Fixed Array + * Purpose: Set the state of the Fixed Array * - * Return: does not fail - * - * Programmer: Vailin Choi; 5th August, 2009 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) { size_t dblk_page_nelmts; /* # of elements per page */ @@ -242,57 +237,58 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; if(state->nelmts > dblk_page_nelmts) { - size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - size_t dblk_page_init_size = (npages + 7) / 8; - hsize_t checksum_size = npages * 4; + size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + size_t dblk_page_init_size = (npages + 7) / 8; + hsize_t checksum_size = npages * 4; - state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + + state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + state->nelmts * cparam->raw_elmt_size; - } else - state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; + } + else + state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; - return(0); + return SUCCEED; } /* end set_fa_state() */ /*------------------------------------------------------------------------- - * Function: reopen_file + * Function: reopen_file * - * Purpose: Perform common "re-open" operations on file & array for testing + * Purpose: Perform common "re-open" operations on file & array for testing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static int -reopen_file(hid_t *file, H5F_t **f, hid_t fapl, +reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id, H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam) { /* Check for closing & re-opening the array */ /* (actually will close & re-open the file as well) */ if(tparam->reopen_array) { + /* Close array, if given */ if(fa && *fa) { if(H5FA_close(*fa) < 0) FAIL_STACK_ERROR *fa = NULL; - } /* end if */ + } /* Close file */ - if(*file) { - if(H5Fclose(*file) < 0) + if(*fid) { + if(H5Fclose(*fid) < 0) FAIL_STACK_ERROR - *file = (-1); + *fid = H5I_INVALID_HID; *f = NULL; - } /* end if */ + } /* Re-open the file */ - if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if((*fid = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5I_object(*fid))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -303,27 +299,26 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, if(fa) if(NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) FAIL_STACK_ERROR - } /* end if */ + } /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* reopen_file() */ /*------------------------------------------------------------------------- - * Function: create_array + * Function: create_array * - * Purpose: Create a fixed array and perform initial checks + * Purpose: Create a fixed array and perform initial checks * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t create_array(H5F_t *f, const H5FA_create_t *cparam, H5FA_t **fa, haddr_t *fa_addr) { @@ -338,65 +333,65 @@ create_array(H5F_t *f, const H5FA_create_t *cparam, FAIL_STACK_ERROR if(!H5F_addr_defined(*fa_addr)) TEST_ERROR + + /* Check array stats */ HDmemset(&state, 0, sizeof(state)); - state.hdr_size = FA_HDR_SIZE; - state.nelmts = cparam->nelmts; + state.hdr_size = FA_HDR_SIZE; + state.nelmts = cparam->nelmts; if(check_stats(*fa, &state)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_array() */ /*------------------------------------------------------------------------- - * Function: verify_cparam + * Function: verify_cparam * - * Purpose: Verify creation parameters are correct + * Purpose: Verify creation parameters are correct * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t verify_cparam(const H5FA_t *fa, const H5FA_create_t *cparam) { H5FA_create_t test_cparam; /* Creation parameters for array */ /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5FA_create_t)); - if(H5FA_get_cparam_test(fa, &test_cparam) < 0) + if(H5FA__get_cparam_test(fa, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5FA_cmp_cparam_test(cparam, &test_cparam)) + if(H5FA__cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* verify_cparam() */ /*------------------------------------------------------------------------- - * Function: finish + * Function: finish * - * Purpose: Close array, delete array, close file and verify that file + * Purpose: Close array, delete array, close file and verify that file * is empty size * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) +static herr_t +finish(hid_t fid, hid_t fapl_id, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) { h5_stat_size_t file_size; /* File size, after deleting array */ @@ -409,11 +404,11 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file) < 0) + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size = h5_get_file_size(filename_g, fapl)) < 0) + if((file_size = h5_get_file_size(filename_g, fapl_id)) < 0) TEST_ERROR /* Verify the file is correct size */ @@ -421,10 +416,10 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* finish() */ @@ -627,23 +622,21 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if(create_file(fapl_id, &fid, &f) < 0) TEST_ERROR - /* - * Display testing message - */ + /* Display testing message */ TESTING("open fixed array twice"); /* Create array */ @@ -666,15 +659,15 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if(reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ - if((file2 = H5Freopen(file)) < 0) + if((fid2 = H5Freopen(fid)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5I_object(fid2))) FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ @@ -694,11 +687,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if(finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -712,8 +705,8 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(fid); + H5Fclose(fid2); } H5E_END_TRY; return 1; @@ -736,26 +729,24 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - hid_t file0 = -1; /* File ID */ - hid_t file00 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ - - /* - * Display testing message - */ + char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid0 = H5I_INVALID_HID; /* File ID */ + hid_t fid00 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + + /* Display testing message */ TESTING("open fixed array twice, through different file handles"); /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if(create_file(fapl_id, &fid, &f) < 0) TEST_ERROR /* Create array */ @@ -781,11 +772,11 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (So that there is something holding the file open when the extensible * array is closed) */ - if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if((fid0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if(reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ @@ -797,26 +788,25 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - file = -1; + fid = H5I_INVALID_HID; /* Open a different file */ /* (This re-allocates the 'top' file pointer and assigns it a different * 'shared' file pointer, making the file pointer in the fixed array's * header stale) */ - h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); - if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[1], fapl_id, filename_tmp, sizeof(filename_tmp)); + if((fid00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR - /* Re-open the file with the fixed array */ - if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if((fid2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5I_object(fid2))) FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ @@ -828,13 +818,13 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa TEST_ERROR /* Close the extra file handles */ - if(H5Fclose(file0) < 0) + if(H5Fclose(fid0) < 0) FAIL_STACK_ERROR - if(H5Fclose(file00) < 0) + if(H5Fclose(fid00) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if(finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -848,10 +838,10 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); - H5Fclose(file0); - H5Fclose(file00); + H5Fclose(fid); + H5Fclose(fid2); + H5Fclose(fid0); + H5Fclose(fid00); } H5E_END_TRY; return 1; @@ -966,7 +956,7 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; @@ -1666,7 +1656,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); @@ -1706,12 +1696,12 @@ main(void) switch(curr_test) { /* "Normal" testing parameters */ case FARRAY_TEST_NORMAL: - puts("Testing with NORMAL PARAMETERS"); + HDputs("Testing with NORMAL PARAMETERS"); break; /* "Re-open array" testing parameters */ case FARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); + HDputs("Testing with reopen array flag set"); tparam.reopen_array = FARRAY_TEST_REOPEN; break; @@ -1738,25 +1728,25 @@ main(void) switch(curr_iter) { /* "Forward" testing parameters */ case FARRAY_ITER_FW: - puts("Testing with forward iteration"); + HDputs("Testing with forward iteration"); tparam.fiter = &fa_iter_fw; break; /* "Reverse" testing parameters */ case FARRAY_ITER_RV: - puts("Testing with reverse iteration"); + HDputs("Testing with reverse iteration"); tparam.fiter = &fa_iter_rv; break; /* "Random" testing parameters */ case FARRAY_ITER_RND: - puts("Testing with random iteration"); + HDputs("Testing with random iteration"); tparam.fiter = &fa_iter_rnd; break; /* "Cyclic" testing parameters */ case FARRAY_ITER_CYC: - puts("Testing with cyclic iteration"); + HDputs("Testing with cyclic iteration"); tparam.fiter = &fa_iter_cyc; break; @@ -1772,22 +1762,26 @@ main(void) nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)tparam.nelmts, "setting all the array elements"); } /* end for */ - /* Check skipping elements */ + /* Check skipping elements */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)1, TRUE, "skipping to first element"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, ((hsize_t)1 << cparam.max_dblk_page_nelmts_bits), TRUE, "skipping to first element in data block page"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE, "skipping to last element"); - /* Create Fixed Array of MAX_NELMTS elements */ - /* - * MAX_NELMTS succeeds on jam and smirom. - * The value was adjusted for linew due to the following: - Linew failed with "H5FD_sec2_truncate(): unable to extend file properly" - Linew failed with "H5FD_sec2_truncate(): File too large" - */ + /* Create Fixed Array */ + /* MAX_NELMTS succeeds on some platforms buy may fail on others: + * + * "H5FD_sec2_truncate(): unable to extend file properly" + * + * and + * + * "H5FD_sec2_truncate(): File too large" + * + * have both been seen. + */ tparam.nelmts = MAX_NELMTS/17; - init_cparam(&cparam, &tparam); + init_cparam(&cparam, &tparam); - /* Set the last element in the Fixed Array */ + /* Set the last element in the Fixed Array */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE, "skipping to last element"); } /* end for */ @@ -1800,22 +1794,22 @@ main(void) if(nerrors) goto error; - puts("All fixed array tests passed."); + HDputs("All fixed array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Pclose(fapl); + H5Pclose(fapl); } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; + HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/fheap.c b/test/fheap.c index e38d263..1af56a6 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -3037,7 +3037,7 @@ error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_size() */ diff --git a/test/fillval.c b/test/fillval.c index 8c8e902..5b95de9 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -762,15 +762,17 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - if(datatype==H5T_INTEGER) + if(datatype == H5T_INTEGER) { fillval = *(int*)_fillval; - else if(datatype==H5T_COMPOUND) { - fill_c.a=((comp_datatype*)_fillval)->a; + } + else if(datatype == H5T_COMPOUND) { + fill_c.a=((comp_datatype*)_fillval)->a; fill_c.x=((comp_datatype*)_fillval)->x; fill_c.y=((comp_datatype*)_fillval)->y; fill_c.z=((comp_datatype*)_fillval)->z; - } else { - puts("Invalid type for test"); + } + else { + HDputs("Invalid type for test"); goto error; } @@ -806,7 +808,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; } /* case for compound datatype */ - } else if(datatype==H5T_COMPOUND) { + } + else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || @@ -828,10 +831,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* Select all odd data locations in the file dataset */ for (i=0, nelmts=1; i<5; i++) { - hs_size[i] = cur_size[i]/2; - hs_offset[i] = 0; - hs_stride[i] = 2; - nelmts *= hs_size[i]; + hs_size[i] = cur_size[i]/2; + hs_offset[i] = 0; + hs_stride[i] = 2; + nelmts *= hs_size[i]; } if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error; if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, @@ -1089,17 +1092,23 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) } h5_fixname(base_name, fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5D_CHUNKED==layout) { - if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; - } else if(H5D_COMPACT==layout) { - if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if(H5D_CHUNKED == layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) + goto error; + } + else if(H5D_COMPACT == layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) + goto error; } - if((ctype_id=create_compound_type()) < 0) goto error; + if((ctype_id = create_compound_type()) < 0) + goto error; /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ if(H5D_COMPACT != layout) { @@ -2359,8 +2368,6 @@ test_partalloc(hid_t fapl, const char *base_name) * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -2380,8 +2387,8 @@ main(int argc, char *argv[]) else if(!strcmp(argv[argno], "compact")) test_compact =1; else { - fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); - exit(EXIT_FAILURE); + HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); + HDexit(EXIT_FAILURE); } } /* end for */ } /* end if */ @@ -2444,15 +2451,15 @@ main(int argc, char *argv[]) if(nerrors) goto error; - puts("All fill value tests passed."); + HDputs("All fill value tests passed."); if(h5_cleanup(FILENAME, fapl)) HDremove(FILE_NAME_RAW); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("***** FILL VALUE TESTS FAILED *****"); - return 1; + HDputs("***** FILL VALUE TESTS FAILED *****"); + HDexit(EXIT_FAILURE); } diff --git a/test/freespace.c b/test/freespace.c index 33a6f89..f397377 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -24,7 +24,7 @@ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5VMprivate.h" @@ -496,7 +496,7 @@ test_fs_create(hid_t fapl) if(!H5F_addr_defined(fs_addr)) TEST_ERROR - if (frsp->nclasses != nclasses) + if(frsp->nclasses != nclasses) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -504,9 +504,9 @@ test_fs_create(hid_t fapl) TEST_ERROR HDmemset(&test_cparam, 0, sizeof(H5FS_create_t)); - if(H5FS_get_cparam_test(frsp, &test_cparam) < 0) + if(H5FS__get_cparam_test(frsp, &test_cparam) < 0) FAIL_STACK_ERROR - if (H5FS_cmp_cparam_test(&cparam, &test_cparam)) + if(H5FS__cmp_cparam_test(&cparam, &test_cparam)) FAIL_STACK_ERROR /* Close the free space manager */ @@ -1857,14 +1857,14 @@ test_fs_sect_shrink(hid_t fapl) * Re-add section A that allow shrinking and its section class type defines "can_shrink" */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); can_shrink = FALSE; if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* should have nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1875,18 +1875,18 @@ test_fs_sect_shrink(hid_t fapl) /* section A should not be there in free-space */ if((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ if(H5FS_close(f, frsp) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ if(H5FS_delete(f, fs_addr) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; /* Close the file */ @@ -2082,7 +2082,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2357,7 +2357,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR diff --git a/test/gheap.c b/test/gheap.c index bf0f18a..4dc3fb0 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -15,9 +15,9 @@ * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Purpose: Tests the global heap. The global heap is the set of all - * collections but the collections are not related to one - * another by anything that appears in the file format. + * Purpose: Tests the global heap. The global heap is the set of all + * collections but the collections are not related to one + * another by anything that appears in the file format. */ #include "h5test.h" #include "H5ACprivate.h" @@ -56,37 +56,35 @@ const char *FILENAME[] = { NULL }; - + /*------------------------------------------------------------------------- * Function: test_1 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is larger than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is larger than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_1 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("monotonically increasing lengths"); @@ -97,10 +95,10 @@ test_1 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -116,11 +114,12 @@ test_1 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if(status < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; - } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { + } + else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { H5_FAILED(); - puts(" Collection addresses are not monotonically increasing"); + HDputs(" Collection addresses are not monotonically increasing"); nerrors++; } } @@ -134,11 +133,12 @@ test_1 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if(HDmemcmp(in, out, size)) { + } + else if(HDmemcmp(in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -147,51 +147,51 @@ test_1 (hid_t fapl) HDfree(obj); obj = NULL; - if(H5Fclose(file) < 0) goto error; - if(nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_2 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is smaller than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is smaller than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_2 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + int nerrors = 0; + char filename[1024]; TESTING("monotonically decreasing lengths"); @@ -202,10 +202,10 @@ test_2 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -216,9 +216,9 @@ test_2 (hid_t fapl) size = GHEAP_TEST_NOBJS - u; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, size, out, obj + u) < 0) { + if(H5HG_insert(f, size, out, obj + u) < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -232,11 +232,12 @@ test_2 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if (memcmp (in, out, size)) { + } + else if (memcmp (in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -245,51 +246,51 @@ test_2 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_3 * - * Purpose: Creates a few global heap objects and then removes them all. - * The collection should also be removed. + * Purpose: Creates a few global heap objects and then removes them all. + * The collection should also be removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_3 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("complete object removal"); @@ -300,11 +301,11 @@ test_3 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; } /* Create some stuff */ @@ -315,7 +316,7 @@ test_3 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -325,7 +326,7 @@ test_3 (hid_t fapl) status = H5HG_remove(f, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } } @@ -334,52 +335,52 @@ test_3 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_4 * - * Purpose: Tests the H5HG_remove() feature by writing lots of objects - * and occassionally removing some. When we're done they're all - * removed. + * Purpose: Tests the H5HG_remove() feature by writing lots of objects + * and occassionally removing some. When we're done they're all + * removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_4 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("partial object removal"); @@ -390,10 +391,10 @@ test_4 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -405,21 +406,20 @@ test_4 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } - /* - * Remove every third one beginning with the second, but after the - * next one has already been inserted. That is, insert A, B, C; - * remove B, insert D, E, F; remove E; etc. - */ + /* Remove every third one beginning with the second, but after the + * next one has already been inserted. That is, insert A, B, C; + * remove B, insert D, E, F; remove E; etc. + */ if(1 == (u % 3)) { H5Eclear2(H5E_DEFAULT); status = H5HG_remove(f, obj + u - 1); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } HDmemset(obj + u - 1, 0, sizeof *obj); @@ -430,51 +430,51 @@ test_4 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_ooo_indices * - * Purpose: Tests that indices can be stored out of order. This can + * Purpose: Tests that indices can be stored out of order. This can * happen when the indices "wrap around" due to many * insertions and deletions (for example, from rewriting a * VL dataset). * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, October 26, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_ooo_indices(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; unsigned i, j; - H5HG_t *obj = NULL; - herr_t status; - int nerrors=0; - char filename[1024]; + H5HG_t *obj = NULL; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("out of order indices"); @@ -487,16 +487,18 @@ test_ooo_indices(hid_t fapl) goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; - } /* end if */ + } /* Alternately insert 1000 entries and remove the previous group of 1000 - * entries, until the indices wrap around */ - for(i=0; i<66; i++) { + * entries, until the indices wrap around. + */ + for(i = 0; i < 66; i++) { /* Insert 1000 entries. The index into the obj array will alternate up * and down by 1000 so the previous set of insertions is preserved and - * can be deleted. */ + * can be deleted. + */ for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); status = H5HG_insert(f, sizeof(j), &j, &obj[j]); @@ -506,7 +508,7 @@ test_ooo_indices(hid_t fapl) /* Check that the index is as expected */ if(obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1) GHEAP_REPEATED_ERR(" Unexpected global heap index"); - } /* end for */ + } /* Remove the previous 1000 entries */ if(i>0) @@ -515,20 +517,21 @@ test_ooo_indices(hid_t fapl) status = H5HG_remove(f, &obj[j]); if (status<0) GHEAP_REPEATED_ERR(" Unable to remove object from global heap"); - } /* end for */ - } /* end for */ + } + } /* The indices should have "wrapped around" on the last iteration */ HDassert(obj[534].idx == 65535); HDassert(obj[535].idx == 1); /* Reopen the file */ - if (H5Fclose(file)<0) goto error; + if (H5Fclose(file) < 0) + goto error; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to open file"); + HDputs(" Unable to open file"); goto error; } /* end if */ @@ -538,14 +541,15 @@ test_ooo_indices(hid_t fapl) goto error; if(i != j) { H5_FAILED(); - puts(" Incorrect read value"); + HDputs(" Incorrect read value"); goto error; - } /* end if */ - } /* end for */ - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + } + } + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; HDfree(obj); obj = NULL; @@ -554,69 +558,67 @@ test_ooo_indices(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } /* end test_ooo_indices */ - + /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests global heap. + * Function: main * - * Return: Success: zero - * - * Failure: non-zero - * - * Programmer: Robb Matzke - * Tuesday, March 31, 1998 + * Purpose: Tests global heap. * - * Modifications: + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main (void) { - int nerrors=0; - hid_t fapl; + int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); - fapl = h5_fileaccess(); + if ((fapl_id = h5_fileaccess()) < 0) + goto error; /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; - nerrors += test_1(fapl); - nerrors += test_2(fapl); - nerrors += test_3(fapl); - nerrors += test_4(fapl); - nerrors += test_ooo_indices(fapl); + nerrors += test_1(fapl_id); + nerrors += test_2(fapl_id); + nerrors += test_3(fapl_id); + nerrors += test_4(fapl_id); + nerrors += test_ooo_indices(fapl_id); /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); if (nerrors) goto error; - puts("All global heap tests passed."); + + HDputs("All global heap tests passed."); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + h5_cleanup(FILENAME, fapl_id); + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDputs("*** TESTS FAILED ***"); + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/h5test.c b/test/h5test.c index 687f594..fb5b83d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1633,15 +1633,11 @@ error: * * Purpose: Callback function for h5_verify_cached_stabs. * - * Return: Success: 0 - * - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Tuesday, April 12, 2011 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1649,9 +1645,9 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) - return(H5G__verify_cached_stabs_test(oid)); + return H5G__verify_cached_stabs_test(oid); else - return(0); + return SUCCEED; } /* end h5_verify_cached_stabs_cb() */ diff --git a/test/istore.c b/test/istore.c index b5bac2c..1d57a2a 100644 --- a/test/istore.c +++ b/test/istore.c @@ -216,7 +216,7 @@ test_create(hid_t f, const char *prefix) /* Create chunked dataset of this dimensionality */ HDsnprintf(name, sizeof name, "%s_%02u", prefix, u); - if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) + if((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) return FAIL; /* Close dataset created */ diff --git a/test/lheap.c b/test/lheap.c index 4f09b6e..d309fb0 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -41,9 +41,7 @@ const char *FILENAME[] = { * heap, close the file, open the file, read data out of the * local heap, close the file. * - * Return: Success: zero - * - * Failure: non-zero + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, November 24, 1998 @@ -95,7 +93,7 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -147,7 +145,7 @@ main(void) if(j > 4) buf[j] = '\0'; - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -211,7 +209,7 @@ main(void) HDputs("All local heap tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; error: HDputs("*** TESTS FAILED ***"); @@ -221,6 +219,6 @@ main(void) if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } diff --git a/test/mf.c b/test/mf.c index 04b7c0b..eefd2a1 100644 --- a/test/mf.c +++ b/test/mf.c @@ -903,7 +903,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Retrieve the file's maxaddr */ - if(H5F_get_maxaddr_test(file, &maxaddr) < 0) + if(H5F__get_maxaddr_test(file, &maxaddr) < 0) FAIL_STACK_ERROR /* Allocate some temporary address space */ @@ -3702,7 +3702,7 @@ error: * Alignment = 1024 or 4096 * * Test 1: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block of 30 which should be from file allocation * Result: * The return address should be aligned @@ -3715,13 +3715,13 @@ error: * A fragment [1054, 994] or [4126, 4066] is freed to free-space * EOA is 2098 or 8242 * Test 2: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block which should be from file allocation * The return address should be aligned * H5MF_try_shrink() the block with aligned address should succeed * * Test 3: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block which should be from file allocation * The return address should be aligned * H5MF_try_extend() the block with aligned address should succeed @@ -5917,17 +5917,17 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ - return(0); + return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_mf_align_alloc6() */ /* @@ -7027,7 +7027,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) * assertion failures on the first file space alloc / dealloc. */ if(f->shared->first_alloc_dealloc){ - if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f)) + if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) FAIL_STACK_ERROR ran_H5MF_tidy_self_referential_fsm_hack = TRUE; } @@ -7614,7 +7614,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Addresses for small raw data blocks */ haddr_t gaddr1; /* Addresses for large data blocks */ hbool_t split = FALSE, multi = FALSE; @@ -7661,7 +7661,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) TEST_ERROR - /* Allocate 3 small meta data blocks: addr1, addr2, addr3 */ + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -7673,7 +7673,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR if(found_addr != addr2) @@ -7735,7 +7735,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR - /* Verify that the small meta data manager is there */ + /* Verify that the small metadata manager is there */ H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7746,16 +7746,16 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) * assertion failures on the first file space alloc / dealloc. */ if(f->shared->first_alloc_dealloc){ - if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f)) + if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) FAIL_STACK_ERROR } - /* Set up to use the small meta data manager */ + /* Set up to use the small metadata manager */ if(!(f->shared->fs_man[fs_type])) if(H5MF__open_fstype(f, fs_type) < 0) TEST_ERROR - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)(f->shared->fs_page_size-(addr3+TBLOCK_SIZE50)), f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR @@ -7838,7 +7838,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1; /* Address for small meta data block */ + haddr_t addr1; /* Address for small metadata block */ haddr_t saddr1; /* Address for small raw data block */ haddr_t gaddr1; /* Address for large data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -7872,14 +7872,14 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); /* Try to shrink the block with addr1 */ if((status = H5MF_try_shrink(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE50)) < 0) FAIL_STACK_ERROR - /* Couldn't shrink due to the section (remaining space in the page) is in the small meta data free-space manager */ + /* Couldn't shrink due to the section (remaining space in the page) is in the small metadata free-space manager */ if(status == TRUE) TEST_ERROR /* Allocate a small raw data block with saddr1 */ @@ -7961,7 +7961,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Address for small raw data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ htri_t was_extended; /* Whether the block can be extended or not */ @@ -7993,7 +7993,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE98); /* Try extending the block with addr1 at EOF not crossing page boundary */ @@ -8001,7 +8001,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Should succeed */ if(was_extended != TRUE) TEST_ERROR - /* Allocate 2 small meta data blocks with addr2 and addr3--will be on another meta data page */ + /* Allocate 2 small metadata blocks with addr2 and addr3--will be on another metadata page */ addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE100); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE150); @@ -8028,7 +8028,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Free the block with addr1 */ H5MF_xfree(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE3248); - /* Allocate a new meta data block with addr1 */ + /* Allocate a new metadata block with addr1 */ /* There is a page end threshold of size H5F_FILE_SPACE_PGEND_META_THRES at the end of the block */ /* The block is right next to the threshold */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3286); @@ -8409,7 +8409,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ haddr_t addr2, addr3, addr4, addr5; /* Addresses for blocks */ - haddr_t addr9, addr10, addr11; /* Address for small meta data blocks */ + haddr_t addr9, addr10, addr11; /* Address for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ H5FS_stat_t fs_stat; /* Information for free-space manager */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8445,7 +8445,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate 2 small meta data blocks: addr1, addr2 */ + /* Allocate 2 small metadata blocks: addr1, addr2 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -8464,13 +8464,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(saddr2 != (saddr1 + TBLOCK_SIZE30)) TEST_ERROR - /* Allocate a small meta data block with addr3--there is no free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr3--there is no free-space section big enough to fulfill the request */ addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE4020); /* Should be on the third page and page aligned */ if(addr3 % TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr4--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr4--there is a free-space section big enough to fulfill the request */ addr4 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* Should not be page aligned */ if(!(addr4 % TBLOCK_SIZE4096)) @@ -8479,7 +8479,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr4 != (addr2 + TBLOCK_SIZE50)) TEST_ERROR - /* Allocate a small meta data block with addr5--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr5--there is a free-space section big enough to fulfill the request */ addr5 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE40); /* Should not be page aligned */ if(!(addr5 % TBLOCK_SIZE4096)) @@ -8489,16 +8489,16 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr5 != (addr3 + TBLOCK_SIZE4020)) TEST_ERROR - /* Allocate a small meta data block with addr6--taking up the remaining space in the first page */ + /* Allocate a small metadata block with addr6--taking up the remaining space in the first page */ if(family) H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3080); else H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3088); - /* Allocate a small meta data block with addr7--taking up the remaining space in the third page */ + /* Allocate a small metadata block with addr7--taking up the remaining space in the third page */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE36); - /* Allocate 2 small meta data blocks: addr8, addr9--there is no free-space to fulfill the request */ + /* Allocate 2 small metadata blocks: addr8, addr9--there is no free-space to fulfill the request */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); addr9 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); @@ -8514,13 +8514,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(fs_stat.tot_space != TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr10--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr10--there is a free-space section big enough to fulfill the request */ addr10 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3900); /* The block should be next to the block with addr9 */ if(addr10 != (addr9 + TBLOCK_SIZE80)) TEST_ERROR - /* Allocate a small meta data block with addr11 */ + /* Allocate a small metadata block with addr11 */ /* The current free-space section is unable to fulfill the request; obtain a page from the large manager */ addr11 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* The address of the block should be the same the freed block with saddr1 */ @@ -8575,7 +8575,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) hid_t fcpl2 = -1; /* File creation property list ID */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2; /* Addresses for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ haddr_t gaddr1, gaddr2; /* Addresses for blocks */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8729,7 +8729,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Disable small data block mechanism */ if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR - /* Disable meta data block mechanism */ + /* Disable metadata block mechanism */ if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR @@ -8741,7 +8741,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) TEST_ERROR - /* Allocate 2 small meta data blocks */ + /* Allocate 2 small metadata blocks */ addr1 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50); diff --git a/test/objcopy.c b/test/objcopy.c index 18de027..9aa2265 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -21,7 +21,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" diff --git a/test/ohdr.c b/test/ohdr.c index 669b1e0..ffede25 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -15,24 +15,24 @@ * Tuesday, November 24, 1998 */ #include "h5test.h" -#include "H5Iprivate.h" + +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* Identifiers */ /* * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /* suppress error about including H5Gpkg */ #include "H5Gpkg.h" -#include "H5CXprivate.h" /* API Contexts */ - const char *FILENAME[] = { "ohdr", NULL @@ -119,7 +119,7 @@ test_cont(char *filename, hid_t fapl) FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR - if(H5O_expunge_chunks_test(&oh_locA) < 0) + if(H5O__expunge_chunks_test(&oh_locA) < 0) FAIL_STACK_ERROR if(H5O_get_hdr_info(&oh_locA, &hdr_info) < 0) @@ -220,7 +220,7 @@ test_ohdr_cache(char *filename, hid_t fapl) /* Query object header information */ rc = 0; - if(H5O_get_rc(&oh_loc, &rc) < 0) + if(H5O__get_rc_test(&oh_loc, &rc) < 0) FAIL_STACK_ERROR if(0 != rc) TEST_ERROR @@ -261,7 +261,7 @@ test_ohdr_cache(char *filename, hid_t fapl) * a non-invasive way -QAK) */ rc = 0; - if(H5O_get_rc(&oh_loc, &rc) < 0) + if(H5O__get_rc_test(&oh_loc, &rc) < 0) FAIL_STACK_ERROR if(0 != rc) TEST_ERROR @@ -567,7 +567,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Check that the "unknown" message was _NOT_ marked */ - if(H5O_check_msg_marked_test(did, FALSE) < 0) + if(H5O__check_msg_marked_test(did, FALSE) < 0) FAIL_STACK_ERROR /* Close the dataset */ @@ -647,7 +647,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Check that the "unknown" message was marked */ - if(H5O_check_msg_marked_test(did, TRUE) < 0) + if(H5O__check_msg_marked_test(did, TRUE) < 0) FAIL_STACK_ERROR /* Close the dataset */ @@ -769,9 +769,9 @@ version_string(H5F_libver_t libver) /* Return the formed version bound string */ return str; -} /* end of version_string */ - +} /* end version_string() */ + /*------------------------------------------------------------------------- * Function: main * @@ -780,13 +780,9 @@ version_string(H5F_libver_t libver) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * - * Modification: - * - Added loop of combinations of low/high library format bounds - * (BMR, Feb 2018) - * *------------------------------------------------------------------------- */ int diff --git a/test/page_buffer.c b/test/page_buffer.c index 3c61ab0..79f110c 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -21,6 +21,10 @@ #include "h5test.h" +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" +#include "H5PBprivate.h" + /* * This file needs to access private information from the H5F package. */ @@ -31,12 +35,8 @@ #define H5F_TESTING #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" -#include "H5PBprivate.h" - -#define FILENAME_LEN 1024 +#define FILENAME_LEN 1024 #define NUM_DSETS 5 #define NX 100 #define NY 50 diff --git a/test/swmr.c b/test/swmr.c index b7e54e7..8f50123 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -3015,7 +3015,7 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl) /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) FAIL_STACK_ERROR; /* Should be in chunk #0 for now */ if(0 != chunk_num) @@ -3072,7 +3072,7 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl) /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) FAIL_STACK_ERROR; /* Should be in chunk #0 for now */ if(1 != chunk_num) diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 1c2ec04..23620fb 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -230,12 +230,12 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, unsigned chunk_num; /* Object header chunk # for dataspace message */ /* Move the dataspace message to a new object header chunk */ - if(H5O_msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0) + if(H5O__msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0) return -1; /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0) return -1; /* Should not be in chunk #0 for now */ if(0 == chunk_num) diff --git a/test/tarray.c b/test/tarray.c index 99f7bf8..d8ededf 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -26,8 +26,8 @@ #define TESTFILE "tarrold.h5" /* 1-D array datatype */ -#define ARRAY1_RANK 1 -#define ARRAY1_DIM1 4 +#define ARRAY1_RANK 1 +#define ARRAY1_DIM1 4 /* 3-D array datatype */ #define ARRAY2_RANK 3 @@ -65,7 +65,7 @@ typedef struct void *test_array_alloc_custom(size_t size, void *info); void test_array_free_custom(void *mem, void *info); - + /*------------------------------------------------------------------------- * Function: test_array_atomic_1d * @@ -189,7 +189,7 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ - + /*------------------------------------------------------------------------- * Function: test_array_funcs * @@ -252,7 +252,7 @@ test_array_funcs(void) CHECK(ret, FAIL, "H5Tclose"); } /* end test_array_funcs() */ - + /*------------------------------------------------------------------------- * Function: test_array_atomic_3d * @@ -381,7 +381,7 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ - + /*------------------------------------------------------------------------- * Function: test_array_array_atomic * @@ -540,7 +540,7 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_atomic * @@ -747,7 +747,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_array * @@ -1006,7 +1006,7 @@ test_array_compound_array(void) ** allocated. ** ****************************************************************/ - + /*------------------------------------------------------------------------- * Function: test_array_alloc_custom * @@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info) return ret_value; } /* end test_array_alloc_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_free_custom * @@ -1081,7 +1081,7 @@ test_array_free_custom(void *_mem, void *info) return; } /* end test_array_free_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_atomic * @@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_array * @@ -1341,7 +1341,7 @@ test_array_vlen_array(void) for(k=0; k<(i+j+1); k++) for(l=0; l= min_dense; u--) { @@ -5108,18 +5106,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, u, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, u, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ @@ -5128,13 +5126,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (min_dense - 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (min_dense - 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -5153,18 +5151,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Close Datasets */ @@ -5212,18 +5210,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { @@ -5232,18 +5230,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, u, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, u, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ @@ -5252,13 +5250,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (min_dense - 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (min_dense - 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -5277,18 +5275,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete all attributes */ for(u = max_compact; u > 0; u--) { @@ -5318,7 +5316,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_transition() */ - + /**************************************************************** ** ** test_attr_corder_delete(): Test basic H5A (attribute) code. @@ -5425,10 +5423,10 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, until attribute storage is in dense form */ for(u = 0; u < max_compact * 2; u++) { @@ -5447,18 +5445,18 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Close Datasets */ @@ -5519,7 +5517,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_delete() */ - + /*------------------------------------------------------------------------- * Function: attr_info_by_idx_check * @@ -5666,7 +5664,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, return(-1); } /* end attr_info_by_idx_check() */ - + /**************************************************************** ** ** test_attr_info_by_idx(): Test basic H5A (attribute) code. @@ -5755,10 +5753,10 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for query on non-existant attribute */ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT); @@ -5787,13 +5785,13 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound offset queries */ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, H5P_DEFAULT); @@ -5819,8 +5817,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); /* Verify information for new attribute */ ret = attr_info_by_idx_check(my_dataset, attrname, (hsize_t)u, use_index); @@ -5828,21 +5826,21 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound offset queries */ @@ -5876,7 +5874,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_info_by_idx() */ - + /**************************************************************** ** ** test_attr_delete_by_idx(): Test basic H5A (attribute) code. @@ -5995,10 +5993,10 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for deleting non-existant attribute */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6025,13 +6023,13 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound deletions */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); @@ -6091,8 +6089,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); } /* end for */ /* Work on all the datasets */ @@ -6131,8 +6129,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -6141,21 +6139,21 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound deletion */ @@ -6216,8 +6214,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6264,8 +6262,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -6376,8 +6374,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6408,7 +6406,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_delete_by_idx() */ - + /**************************************************************** ** ** attr_iterate2_cb(): Revised attribute operator @@ -6482,7 +6480,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); } /* end attr_iterate2_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /**************************************************************** ** ** attr_iterate1_cb(): Attribute operator @@ -6495,7 +6493,7 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data) } /* end attr_iterate1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: attr_iterate2_fail_cb * @@ -6517,7 +6515,7 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED * return(H5_ITER_ERROR); } /* end attr_iterate2_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: attr_iterate_check * @@ -6817,7 +6815,7 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_iterate_check() */ - + /**************************************************************** ** ** test_attr_iterate2(): Test basic H5A (attribute) code. @@ -6947,10 +6945,10 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for iterating over object with no attributes (should be OK) */ ret = H5Aiterate2(my_dataset, idx_type, order, NULL, attr_iterate2_cb, NULL); @@ -6983,13 +6981,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound iteration */ idx = u; @@ -7049,8 +7047,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7059,21 +7057,21 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound iteration */ @@ -7121,7 +7119,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) HDfree(visited); } /* test_attr_iterate2() */ - + /*------------------------------------------------------------------------- * Function: attr_open_by_idx_check * @@ -7181,7 +7179,7 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, return(-1); } /* end attr_open_by_idx_check() */ - + /**************************************************************** ** ** test_attr_open_by_idx(): Test basic H5A (attribute) code. @@ -7299,10 +7297,10 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening an attribute on an object with no attributes */ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -7329,13 +7327,13 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound opening an attribute on an object */ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); @@ -7383,8 +7381,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7393,21 +7391,21 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound opening an attribute on an object */ @@ -7443,7 +7441,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: attr_open_check * @@ -7529,7 +7527,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_open_check() */ - + /**************************************************************** ** ** test_attr_open_by_name(): Test basic H5A (attribute) code. @@ -7621,10 +7619,10 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with no attributes */ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); @@ -7657,13 +7655,13 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with compact attribute storage */ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); @@ -7720,8 +7718,8 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7730,21 +7728,21 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for opening a non-existant attribute on an object with dense attribute storage */ @@ -7784,7 +7782,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_name() */ - + /**************************************************************** ** ** test_attr_create_by_name(): Test basic H5A (attribute) code. @@ -7875,10 +7873,10 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -7901,13 +7899,13 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Test opening attributes stored compactly */ ret = attr_open_check(fid, dsetname, my_dataset, u); @@ -7954,8 +7952,8 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7964,21 +7962,21 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Test opening attributes stored compactly */ @@ -8132,14 +8130,14 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8151,10 +8149,10 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8206,11 +8204,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -8258,11 +8256,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ /* Close attribute's datatype */ @@ -8279,15 +8277,15 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -8303,20 +8301,20 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -8463,14 +8461,14 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8482,10 +8480,10 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8537,11 +8535,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -8589,11 +8587,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Create new attribute name */ @@ -8726,15 +8724,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -8750,20 +8748,20 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -8909,14 +8907,14 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8928,10 +8926,10 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8983,11 +8981,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -9027,7 +9025,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check refcount for attribute */ ret = H5A__get_shared_rc_test(attr, &shared_refcount); CHECK(ret, FAIL, "H5A__get_shared_rc_test"); - VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 2, "H5A__get_shared_rc_test"); } /* end else */ /* Close attribute */ @@ -9035,11 +9033,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ @@ -9095,15 +9093,15 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -9119,20 +9117,20 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -9278,14 +9276,14 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -9297,10 +9295,10 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -9352,11 +9350,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -9404,11 +9402,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ @@ -9426,8 +9424,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on first dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Check ref count on attributes of first dataset */ for(u = 0; u < max_compact * 2; u++) { @@ -9474,20 +9472,20 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -10958,7 +10956,7 @@ test_attr(void) CHECK(ret, FAIL, "H5Pclose"); } /* test_attr() */ - + /*------------------------------------------------------------------------- * Function: cleanup_attr * diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index 8190665..e8ea044 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -1,5 +1,5 @@ Testing error API H5Eset/get_auto Testing error API based on data I/O All error API tests passed. - This program tests the Error API compatible with HDF5 version (number). There're supposed to be some error messages + This program tests the Error API compatible with HDF5 version (number). There are supposed to be some error messages ********* Print error stack in HDF5 default way ********* HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed diff --git a/test/testframe.c b/test/testframe.c index 21f9ea3..335118c 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -146,10 +146,10 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * Record the program name and private routines if provided. */ TestProgName = ProgName; - if (NULL != private_usage) - TestPrivateUsage = private_usage; - if (NULL != private_parser) - TestPrivateParser = private_parser; + if(NULL != private_usage) + TestPrivateUsage = private_usage; + if(NULL != private_parser) + TestPrivateParser = private_parser; } diff --git a/test/testhdf5.c b/test/testhdf5.c index 713cccf..e136086 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -90,8 +90,8 @@ main(int argc, char *argv[]) /* Exit failure if errors encountered; else exit success. */ /* No need to print anything since PerformTests() already does. */ if (GetTestNumErrs() > 0) - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); else - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* end main() */ diff --git a/test/tfile.c b/test/tfile.c index d3134f8..0db4c1b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -22,7 +22,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" @@ -896,15 +895,15 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pget_fclose_degree"); switch(fc_degree) { - case H5F_CLOSE_STRONG: + case H5F_CLOSE_STRONG: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Close second open */ ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_SEMI: + break; + case H5F_CLOSE_SEMI: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -919,8 +918,8 @@ test_file_close(void) /* Close second open */ ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_WEAK: + break; + case H5F_CLOSE_WEAK: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -935,7 +934,7 @@ test_file_close(void) CHECK(ret, FAIL, "H5Gclose"); ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); - break; + break; case H5F_CLOSE_DEFAULT: default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); @@ -957,7 +956,7 @@ test_file_close(void) ****************************************************************/ static void create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, - hid_t *ret_gid2, hid_t *ret_gid3) + hid_t *ret_gid2, hid_t *ret_gid3) { ssize_t oid_count; herr_t ret; @@ -1109,9 +1108,10 @@ test_get_obj_ids(void) oid_list = (hid_t *)HDcalloc((size_t)oid_list_size, sizeof(hid_t)); CHECK_PTR(oid_list, "HDcalloc"); - /* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here. + /* Call the public function H5F_get_obj_ids to use H5F__get_objects. User reported having problem here. * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in - * (oid_list_size) */ + * (oid_list_size). + */ ret_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, (size_t)oid_list_size, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, oid_list_size, "H5Fget_obj_count"); @@ -2670,8 +2670,8 @@ test_cached_stab_info(void) CHECK(file_id, FAIL, "H5Fopen"); /* Verify the cached symbol table information */ - ret = H5F_check_cached_stab_test(file_id); - CHECK(ret, FAIL, "H5F_check_cached_stab_test"); + ret = H5F__check_cached_stab_test(file_id); + CHECK(ret, FAIL, "H5F__check_cached_stab_test"); /* Close file */ ret = H5Fclose(file_id); @@ -3941,14 +3941,6 @@ error: ** This routine checks the free space available in a file as ** returned by the public routine H5Fget_freespace(). ** -** Modifications: -** Vailin Choi; July 2012 -** Remove datasets in reverse order so that all file spaces are shrunk. -** (A change due to H5FD_FLMAP_DICHOTOMY.) -** -** Vailin Choi; Dec 2012 -** Add changes due to paged aggregation via new format: -** the amount of freespace is different. ** *****************************************************************/ static void @@ -5360,7 +5352,8 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } else /* Should fail */ VERIFY(ok, FALSE, "H5Fcreate"); - } else { /* Should succeed */ + } + else { /* Should succeed */ VERIFY(ok, TRUE, "H5Fcreate"); VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); @@ -7341,7 +7334,7 @@ test_file(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ - + /*------------------------------------------------------------------------- * Function: cleanup_file * diff --git a/test/tgenprop.c b/test/tgenprop.c index 5031846..151913c 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1774,8 +1774,8 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for first class */ - path=H5P_get_class_path_test(cid1); - CHECK_PTR(path, "H5P_get_class_path_test"); + path = H5P__get_class_path_test(cid1); + CHECK_PTR(path, "H5P__get_class_path_test"); if(HDstrcmp(path,CLASS1_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); H5free_memory(path); @@ -1789,14 +1789,14 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for second class */ - path=H5P_get_class_path_test(cid2); - CHECK_PTR(path, "H5P_get_class_path_test"); + path = H5P__get_class_path_test(cid2); + CHECK_PTR(path, "H5P__get_class_path_test"); if(HDstrcmp(path,CLASS2_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH); /* Open a copy of the class with the path name */ - cid3 = H5P_open_class_path_test(path); - CHECK_I(cid3, "H5Popen_class_path"); + cid3 = H5P__open_class_path_test(path); + CHECK_I(cid3, "H5P__open_class_path_test"); /* Check that the classes are equal */ ret = H5Pequal(cid2,cid3); diff --git a/test/th5s.c b/test/th5s.c index 0619571..14f5de9 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -22,7 +22,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" diff --git a/test/tmisc.c b/test/tmisc.c index 22e1aad..47c0606 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2713,9 +2713,6 @@ test_misc15(void) fapl = H5Fget_access_plist(file); CHECK(fapl, FAIL, "H5Fget_access_plist"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -2723,6 +2720,9 @@ test_misc15(void) ret = H5Fis_hdf5(MISC15_FILE); CHECK(ret, FAIL, "H5Fis_hdf5"); + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); @@ -4721,6 +4721,7 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25a() */ + /**************************************************************** ** ** test_misc25b(): Exercise null object header message merge bug @@ -4756,7 +4757,7 @@ test_misc25b(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25b() */ - + /**************************************************************** ** ** test_misc25c(): Exercise another null object header message merge bug. @@ -4890,7 +4891,7 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25c() */ - + /**************************************************************** ** ** test_misc26(): Regression test: ensure that copying filter @@ -4976,7 +4977,7 @@ test_misc26(void) CHECK_I(ret, "H5Pclose"); } - + /**************************************************************** ** ** test_misc27(): Ensure that objects with incorrect # of object @@ -5021,7 +5022,7 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ - + /**************************************************************** ** ** test_misc28(): Ensure that the dataset chunk cache will hold @@ -5198,7 +5199,7 @@ test_misc28(void) CHECK_I(ret, "H5Pclose"); } /* end test_misc28() */ - + /**************************************************************** ** ** test_misc29(): Ensure that speculative metadata reads don't @@ -5247,7 +5248,7 @@ test_misc30_get_info(hid_t loc_id) return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } - + /**************************************************************** ** ** test_misc30(): Exercise local heap code that loads prefix @@ -5312,7 +5313,7 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ - + /**************************************************************** ** ** test_misc31(): Test reentering library through deprecated @@ -5410,7 +5411,7 @@ test_misc31(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end test_misc31() */ - + /**************************************************************** * * test_misc32(): Simple test of filter memory allocation @@ -5584,7 +5585,7 @@ test_misc34(void) } /* end test_misc34() */ - + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5637,7 +5638,7 @@ test_misc(void) } /* test_misc() */ - + /*------------------------------------------------------------------------- * Function: cleanup_misc * @@ -5647,9 +5648,6 @@ test_misc(void) * * Programmer: Albert Cheng * July 2, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/test/tsohm.c b/test/tsohm.c index d00a03a..718b12f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3862,9 +3862,9 @@ test_sohm_external_dtype(void) CHECK_I(file1, "H5Fcreate"); /* Check on datatype storage status. It should be zero now. */ - ret = H5F_get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Create data set */ dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, @@ -3872,9 +3872,9 @@ test_sohm_external_dtype(void) CHECK_I(dataset1, "H5Dcreate2"); /* Check on datatype storage status. It should be 1 now. */ - ret = H5F_get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Retieve the dataset's datatype */ dset1_tid = H5Dget_type(dataset1); @@ -3900,9 +3900,9 @@ test_sohm_external_dtype(void) CHECK_I(file2, "H5Fcreate"); /* Check on datatype storage status. It should be zero now. */ - ret = H5F_get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Create a data set using the datatype of the dataset in the first file. */ dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT, @@ -3910,9 +3910,9 @@ test_sohm_external_dtype(void) CHECK_I(dataset2, "H5Dcreate2"); /* Check on datatype storage status. It should be 1 now. */ - ret = H5F_get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Write the data to the dataset2 */ ret = H5Dwrite(dataset2, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig); diff --git a/test/tunicode.c b/test/tunicode.c index e0e1f24..5a60036 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -163,7 +163,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ - strncpy(buf, new_string, big_len); + HDstrncpy(buf, new_string, big_len); HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); diff --git a/test/tvltypes.c b/test/tvltypes.c index 91ef0c2..8824066 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -1348,7 +1348,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; jstring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; jstring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ diff --git a/test/unregister.c b/test/unregister.c index dbf6293..ff116cf 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -16,6 +16,7 @@ * Purpose: Tests H5Zunregister function */ #include "h5test.h" + #include "H5CXprivate.h" /* API Contexts */ const char *FILENAME[] = { @@ -24,8 +25,8 @@ const char *FILENAME[] = { NULL }; -#define GROUP_NAME "group" -#define DSET_NAME "dataset" +#define GROUP_NAME "test_group" +#define DSET_NAME "test_dataset" #define FILENAME_BUF_SIZE 1024 #define DSET_DIM1 100 #define DSET_DIM2 200 @@ -35,39 +36,34 @@ const char *FILENAME[] = { #define H5Z_FILTER_DUMMY 312 -static size_t filter_dummy(unsigned int flags, size_t cd_nelmts, +static size_t do_nothing(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* Dummy filter for test_unregister_filters only */ const H5Z_class2_t H5Z_DUMMY[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DUMMY, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dummy", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_dummy, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DUMMY, /* Filter ID number */ + 1, 1, /* Encoding and decoding enabled */ + "dummy", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + do_nothing, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: filter_dummy + * Function: do_nothing * - * Purpose: A dummy compression method that doesn't do anything. This - * filter is only for test_unregister_filters. Please don't + * Purpose: A dummy compression method that doesn't do anything. This + * filter is only for test_unregister_filters. Please don't * use it for other tests because it may mess up this test. * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * April 24, 2013 + * Return: Data chunk size * *------------------------------------------------------------------------- */ static size_t -filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, +do_nothing(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { @@ -75,194 +71,233 @@ filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, } /*------------------------------------------------------------------------- - * Function: test_unregister_filters - * - * Purpose: Tests unregistering filter before closing the file + * Function: test_unregister_filters * - * Return: Success: 0 - * Failure: -1 + * Purpose: Tests unregistering filter before closing the file * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -test_unregister_filters(hid_t my_fapl) +test_unregister_filters(hid_t fapl_id) { - hid_t file1, file2; - hid_t dc; - hid_t gcpl, gid, group; - hid_t dataset, space; - int i, j, n; - char gname[256]; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t gid_loop = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + int i, j, n; + char group_name[32]; char filename[FILENAME_BUF_SIZE]; - const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ - hsize_t dims[2]; - int points[DSET_DIM1][DSET_DIM2]; + const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ + hsize_t dims[2]; + int data[DSET_DIM1][DSET_DIM2]; herr_t ret; TESTING("Unregistering filter"); /* Create first file */ - h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename); - if((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename)); + if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Create second file */ - h5_fixname(FILENAME[1], my_fapl, filename, sizeof filename); - if((file2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)); + if((fid2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Register DUMMY filter */ - if(H5Zregister(H5Z_DUMMY) < 0) goto error; - - if(H5Zfilter_avail(H5Z_FILTER_DUMMY)!=TRUE) goto error; + if (H5Zregister(H5Z_DUMMY) < 0) + goto error; + if (H5Zfilter_avail(H5Z_FILTER_DUMMY) != TRUE) + goto error; + + /******************* + * PART 1 - GROUPS * + *******************/ - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error; - /* Use DUMMY filter for creating groups */ - if(H5Pset_filter (gcpl, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) goto error; + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + if(H5Pset_filter(gcpl_id, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) + goto error; /* Create a group using this filter */ - if((gid = H5Gcreate2(file1, GROUP_NAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error; + if((gid = H5Gcreate2(fid1, GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Create multiple groups under the main group */ - for (i=0; i < GROUP_ITERATION; i++) { - sprintf(gname, "group_%d", i); - if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Gclose(group) < 0) goto error; + for(i = 0; i < GROUP_ITERATION; i++) { + HDsprintf(group_name, "group_%d", i); + if((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Gclose(gid_loop) < 0) + goto error; } - if(H5Fflush(file1, H5F_SCOPE_GLOBAL) < 0) goto error; + /* Flush the file containing the groups */ + if(H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0) + goto error; /* Unregister the filter before closing the group. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } /* Close the group */ - if(H5Gclose(gid) < 0) goto error; + if(H5Gclose(gid) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (gcpl) < 0) goto error; + if(H5Pclose (gcpl_id) < 0) + goto error; - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + /********************* + * PART 2 - DATASETS * + *********************/ - if(H5Pset_filter(dc, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) goto error; + /* Use DUMMY filter for creating datasets */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0) + goto error; + if(H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) + goto error; - /* Initialize the dataset */ + /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - points[i][j] = n++; + data[i][j] = n++; - /* Create the data space */ + /* Create the dataspace */ dims[0] = DSET_DIM1; dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) + goto error; /* Create a dataset in the first file */ - if((dataset = H5Dcreate2(file1, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; /* Create a dataset in the second file */ - if((dataset = H5Dcreate2(file2, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset in the second file */ + if(H5Dclose(did) < 0) + goto error; /* Unregister the filter after closing all objects but before closing files. - * It should flush all files. */ - if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) goto error; + * It should flush all files. + */ + if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (dc) < 0) goto error; - if(H5Fclose(file1) < 0) goto error; - if(H5Fclose(file2) < 0) goto error; + if(H5Pclose(dcpl_id) < 0) + goto error; + if(H5Fclose(fid1) < 0) + goto error; + if(H5Fclose(fid2) < 0) + goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Fclose(fid1); + H5Fclose(fid2); + H5Pclose(dcpl_id); + H5Pclose(gcpl_id); + H5Gclose(gid); + H5Gclose(gid_loop); + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + + return FAIL; } /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests unregistering filter with H5Zunregister + * Function: main * - * Return: Success: exit(EXIT_SUCCESS) + * Purpose: Tests unregistering filter with H5Zunregister * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; - int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Testing setup */ h5_reset(); - fapl = h5_fileaccess(); + fapl_id = h5_fileaccess(); /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; /* Test unregistering filter in its own file */ - nerrors += (test_unregister_filters(fapl) < 0 ? 1 : 0); + nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0); - if(nerrors) + h5_cleanup(FILENAME, fapl_id); + + if (nerrors) goto error; - printf("All filter unregistration tests passed.\n"); + HDprintf("All filter unregistration tests passed.\n"); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: nerrors = MAX(1, nerrors); - printf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", + HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/vfd.c b/test/vfd.c index dfc5047..19223ea 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1118,8 +1118,7 @@ error: * Purpose: Private function for test_multi() to tests wrong ways of * reopening multi file. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 19, 2005 @@ -1129,7 +1128,7 @@ error: static herr_t test_multi_opens(char *fname) { - hid_t file=-1; + hid_t fid = H5I_INVALID_HID; char super_name[1024]; /*name string "%%s-s.h5"*/ char sf_name[1024]; /*name string "multi_file-s.h5"*/ @@ -1138,11 +1137,11 @@ test_multi_opens(char *fname) HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); H5E_BEGIN_TRY { - file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - return(file >= 0 ? -1 : 0); -} + return(fid >= 0 ? FAIL : SUCCEED); +} /* end test_multi_opens() */ /*------------------------------------------------------------------------- @@ -1150,8 +1149,7 @@ test_multi_opens(char *fname) * * Purpose: Tests the file handle interface for MUTLI driver * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -1365,7 +1363,7 @@ test_multi(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1374,9 +1372,10 @@ error: H5Pclose(fapl); H5Pclose(fapl2); H5Fclose(file); + H5Aclose(attr); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_multi() */ /*------------------------------------------------------------------------- -- cgit v0.12 From e2f6e6f62f8885e85540c870ff3e3370b7617c79 Mon Sep 17 00:00:00 2001 From: hdftest Date: Thu, 20 Sep 2018 14:54:10 -0500 Subject: Snapshot version 1.11 release 2. --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- java/src/hdf/hdf5lib/H5.java | 4 ++-- java/test/TestH5.java | 4 ++-- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- .../testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 +++++++------- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.txt b/README.txt index 07c231e..2d03cc7 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.11.3 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 037d4cb..c771e8b 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.2" +PROJECT_NUMBER = "1.11.3" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 7eaf80a..d1c3a9f 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -34,7 +34,7 @@ cmake_minimum_required (VERSION 3.10) # CTEST_SOURCE_NAME - source folder ############################################################################## -set (CTEST_SOURCE_VERSION "1.11.2") +set (CTEST_SOURCE_VERSION "1.11.3") set (CTEST_SOURCE_VERSEXT "") ############################################################################## diff --git a/configure.ac b/configure.ac index cedfcfd..e42b038 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.2], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.11.3], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index f58623e..be7cae4 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. *
* - * @version HDF5 1.11.2
+ * @version HDF5 1.11.3
* See also: hdf.hdf5lib.HDFArray
* hdf.hdf5lib.HDF5Constants
* hdf.hdf5lib.HDF5CDataTypes
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 2 }; + public final static int LIB_VERSION[] = { 1, 11, 3 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index b922583..738c9f1 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 2 }; + int libversion[] = { 1, 11, 3 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 2; + int majnum = 1, minnum = 11, relnum = 3; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c8c7d5c..0da8423 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.11.3 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index a4c80cd..c247e57 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -93,10 +93,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 11 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 2 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 3 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.2" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.11.3" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index a1fc0cb..8f48c37 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { -- cgit v0.12 From b48686febd832aefbc44274bff9e0408bbc84aa0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 20 Sep 2018 13:38:40 -0700 Subject: Normalization with vol_integration (misc internal and datatype) --- src/H5AC.c | 19 ++- src/H5Aint.c | 10 +- src/H5B.c | 4 +- src/H5B2.c | 2 +- src/H5B2hdr.c | 3 +- src/H5Bdbg.c | 4 +- src/H5C.c | 33 ++-- src/H5CX.c | 6 +- src/H5Cimage.c | 14 +- src/H5Ctag.c | 2 +- src/H5F.c | 171 ++++++++++--------- src/H5FApkg.h | 15 +- src/H5Fquery.c | 6 +- src/H5HF.c | 2 +- src/H5HFdbg.c | 15 +- src/H5HFhdr.c | 6 +- src/H5HFiblock.c | 348 +++++++++++++++++++-------------------- src/H5HFman.c | 1 + src/H5HFprivate.h | 12 +- src/H5HFsection.c | 12 +- src/H5HFspace.c | 7 +- src/H5HG.c | 74 ++++----- src/H5HGcache.c | 4 +- src/H5HGpkg.h | 2 +- src/H5I.c | 6 +- src/H5Lpublic.h | 4 +- src/H5Ocopy.c | 7 +- src/H5Odtype.c | 9 +- src/H5R.c | 48 +++--- src/H5Rdeprec.c | 16 +- src/H5Rint.c | 16 +- src/H5Rpkg.h | 12 +- src/H5Rprivate.h | 6 - src/H5SM.c | 118 ++++++------- src/H5T.c | 262 ++++++++++++----------------- src/H5Tcommit.c | 236 ++++++++++++-------------- src/H5Tcompound.c | 10 +- src/H5Tconv.c | 67 ++++---- src/H5Tdeprec.c | 22 +-- src/H5Tenum.c | 2 - src/H5Toh.c | 2 +- src/H5Torder.c | 10 +- src/H5Tpkg.h | 4 +- src/H5Tprivate.h | 1 - src/H5Tvlen.c | 24 ++- src/H5Z.c | 114 +++++++------ src/H5detect.c | 421 +++++++++++++++++++++++------------------------ src/H5make_libsettings.c | 30 ++-- src/Makefile.am | 7 +- 49 files changed, 1066 insertions(+), 1160 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 989ee10..9894e39 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -2620,7 +2620,7 @@ done: * * Purpose: Sets the metadata tag property in the provided property list. * - * Return: SUCCEED on success, FAIL otherwise. + * Return: void * * Programmer: Mike McGreevy * December 1, 2009 @@ -2773,7 +2773,7 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag HDassert(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) + if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries") done: @@ -2924,16 +2924,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_set_ring + * Function: H5AC_set_ring * - * Purpose: Routine to set the ring on a DXPL (for passing through - * to the metadata cache). + * Purpose: Routine to set the ring on a DXPL (for passing through + * to the metadata cache). * - * Return: Success: Non-negative - * Failure: Negative + * Return: void * - * Programmer: Quincey Koziol - * Tuesday, September 8, 2015 + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 * *------------------------------------------------------------------------- */ @@ -2942,6 +2941,8 @@ 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() */ + /* Get the current ring value and return that (if orig_ring is NOT null) */ if(orig_ring) *orig_ring = H5CX_get_ring(); diff --git a/src/H5Aint.c b/src/H5Aint.c index 807c67e..4c7568a 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -240,7 +240,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * (to maintain ref. count incr/decr similarity with "shared message" * type of datatype sharing) */ - if(H5T_committed(attr->shared->dt)) + 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") @@ -2112,14 +2112,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk") - if(!H5T_committed(attr_src->shared->dt)) { + if(!H5T_is_named(attr_src->shared->dt)) { /* If the datatype is not named, it may have been shared in the * source file's heap. Un-share it for now. We'll try to shared * 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") - } /* end if */ + } /* 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 */ @@ -2354,7 +2354,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, HDassert(file_src); HDassert(file_dst); - if(H5T_committed(attr_src->shared->dt)) { + if(H5T_is_named(attr_src->shared->dt)) { H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */ H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */ @@ -2374,7 +2374,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, /* Update shared message info from named datatype info */ H5T_update_shared(attr_dst->shared->dt); - } /* end if */ + } /* Try to share both the datatype and dataset. This does nothing if the * datatype is committed or sharing is disabled. diff --git a/src/H5B.c b/src/H5B.c index 53d5529..71b9020 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -471,12 +471,12 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, * 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; /* diff --git a/src/H5B2.c b/src/H5B2.c index 1f964b8..cf8e4a9 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -220,7 +220,7 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata) /* 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) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index e9b6810..68669e8 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -523,8 +523,7 @@ done: *------------------------------------------------------------------------- */ H5B2_hdr_t * -H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, - unsigned flags) +H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) { H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */ H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */ diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 5cad81b..c491783 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -80,7 +80,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* 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); @@ -91,7 +91,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, 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. diff --git a/src/H5C.c b/src/H5C.c index c4d4eed..a22eca0 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -1284,7 +1284,7 @@ H5C_insert_entry(H5F_t * f, insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); - /* Get the ring type from the DXPL */ + /* Get the ring type from the API context */ ring = H5CX_get_ring(); entry_ptr = (H5C_cache_entry_t *)thing; @@ -2331,10 +2331,10 @@ H5C_protect(H5F_t * f, 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. */ + * 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(); @@ -2389,10 +2389,10 @@ H5C_protect(H5F_t * f, 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. - */ + /* 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) @@ -2438,10 +2438,10 @@ H5C_protect(H5F_t * f, * * 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. + * + * 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 @@ -4287,11 +4287,8 @@ done: *------------------------------------------------------------------------- */ 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__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; diff --git a/src/H5CX.c b/src/H5CX.c index f809d1c..faf0b24 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -53,7 +53,7 @@ * each thread individually. The association of contexts to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E_get_my_stack() must be preceeded + * In order for this macro to work, H5E__get_my_stack() must be preceeded * by "H5CX_node_t *ctx =". */ #define H5CX_get_my_context() H5CX__get_context() @@ -320,7 +320,9 @@ typedef struct H5CX_lapl_cache_t { /********************/ /* Local Prototypes */ /********************/ +#ifdef H5_HAVE_THREADSAFE static H5CX_node_t **H5CX__get_context(void); +#endif /* H5_HAVE_THREADSAFE */ static void H5CX__push_common(H5CX_node_t *cnode); static H5CX_node_t *H5CX__pop_common(void); @@ -862,7 +864,7 @@ done: * * Purpose: Sanity checks and sets up collective operations. * - * Note: Should be called for all API routines that modify file + * Note: Should be called for all API routines that modify file * file metadata but don't pass in an access property list. * * Return: Non-negative on success / Negative on failure diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 26b6506..bdab1a3 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1139,22 +1139,22 @@ H5C__load_cache_image(H5F_t *f) */ if(H5F_addr_defined(cache_ptr->image_addr)) { /* Sanity checks */ - HDassert(cache_ptr->image_len > 0); + HDassert(cache_ptr->image_len > 0); HDassert(cache_ptr->image_buffer == NULL); - /* Allocate space for the image */ + /* 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") - /* Load the image from file */ - if(H5C__read_cache_image(f, cache_ptr) < 0) + /* 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") - /* Reconstruct cache contents, from image */ - if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0) + /* 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") - /* Free the image buffer */ + /* Free the image buffer */ cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer); /* Update stats -- must do this now, as we are about diff --git a/src/H5Ctag.c b/src/H5Ctag.c index 66aedd9..0f08ede 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -471,7 +471,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.") ctx->evicted_entries_last_pass = TRUE; - } /* end else-if */ + } else ctx->skipped_pf_dirty_entries = TRUE; diff --git a/src/H5F.c b/src/H5F.c index 65fbc9e..68bdfd3 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -21,20 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -76,10 +76,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* File ID class */ static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ }}; @@ -113,16 +113,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_term_package + * Function: H5F_term_package * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. + * + * Return: Success: Positive if anything was done that might + * have affected other interfaces; + * zero otherwise. + * + * Failure: Never fails * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; - * zero otherwise. - * Failure: Never fails. *------------------------------------------------------------------------- */ int @@ -155,35 +157,38 @@ H5F_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Fget_create_plist + * Function: H5Fget_create_plist * - * Purpose: Get an atom for a copy of the file-creation property list for - * this file. This function returns an atom with a copy of the - * properties used to create a file. + * Purpose: Get an atom for a copy of the file-creation property list for + * this file. This function returns an atom with a copy of the + * properties used to create a file. + * + * Return: Success: Object ID for a copy of the file creation + * property list. + * + * Failure: H5I_INVALID_HID * - * Return: Success: template ID - * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Fget_create_plist(hid_t file_id) { - H5F_t *file; /* File info */ - H5P_genplist_t *plist; /* Property list */ - hid_t ret_value; /* Return value */ + H5F_t *file; /* File info */ + H5P_genplist_t *plist; /* Property list */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") - /* Create the property list object to return */ + /* Retrieve the file creation property list */ if((ret_value = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: FUNC_LEAVE_API(ret_value) @@ -191,37 +196,39 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_access_plist + * Function: H5Fget_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fget_access_plist(hid_t file_id) { - H5F_t *f; /* File info */ - hid_t ret_value; /* Return value */ + H5F_t *file; /* File info */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if((ret_value = H5F_get_access_plist(f, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + if((ret_value = H5F_get_access_plist(file, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: FUNC_LEAVE_API(ret_value) @@ -309,30 +316,30 @@ done: * Purpose: Returns a pointer to the file handle of the low-level file * driver. * - * Return: Success: non-negative value. - * Failure: negative. + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t -H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) +H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) { - H5F_t *file; /* File to query */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ii**x", file_id, fapl, file_handle); + H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle); /* Check args */ if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") - /* Get the file */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5F_get_vfd_handle(file, fapl, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + if(H5F_get_vfd_handle(file, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: FUNC_LEAVE_API(ret_value) @@ -340,16 +347,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fis_hdf5 + * Function: H5Fis_hdf5 * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. + * + * Return: TRUE/FALSE/FAIL * - * Return: Success: TRUE/FALSE - * Failure: Negative *------------------------------------------------------------------------- */ htri_t @@ -360,7 +367,7 @@ H5Fis_hdf5(const char *name) FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); - /* Check args and all the boring stuff. */ + /* Check args */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") @@ -394,37 +401,39 @@ done: * the list of file creation and file access properties. * * Return: Success: A file ID - * Failure: FAIL + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ - if (!filename || !*filename) + if(!filename || !*filename) 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)) + if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) 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)) + if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) 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) + if(H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else - if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) + if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) 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 */ @@ -435,7 +444,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. */ - if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) + if(0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; @@ -444,7 +453,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ - if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) + if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") /* Keep this ID in file object structure */ diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 6ce899e..8f76fc9 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -275,8 +275,7 @@ H5_DLL herr_t H5FA__hdr_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr); H5_DLL size_t H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_modified(H5FA_hdr_t *hdr); -H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, - unsigned flags); +H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags); H5_DLL herr_t H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags); H5_DLL herr_t H5FA__hdr_delete(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); @@ -285,8 +284,7 @@ H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); H5_DLL H5FA_dblock_t *H5FA__dblock_alloc(H5FA_hdr_t *hdr); H5_DLL haddr_t H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty); H5_DLL unsigned H5FA__dblock_sblk_idx(const H5FA_hdr_t *hdr, hsize_t idx); -H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, - unsigned flags); +H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags); H5_DLL herr_t H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags); H5_DLL herr_t H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr); H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); @@ -294,16 +292,13 @@ H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); /* Data block page routines */ H5_DLL herr_t H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts); H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts); -H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, - size_t dblk_page_nelmts, unsigned flags); +H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags); H5_DLL herr_t H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags); H5_DLL herr_t H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page); /* Debugging routines for dumping file structures */ -H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); -H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, - int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); +H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); +H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); /* Testing routines */ #ifdef H5FA_TESTING diff --git a/src/H5Fquery.c b/src/H5Fquery.c index be24072..2500ea8 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -277,11 +277,11 @@ H5F_get_nopen_objs(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F_get_file_id * - * Purpose: Retrieve the file's 'file_id' value + * Purpose: Retrieve the file's 'file_id' value * - * Return: 'file_id' on success/abort on failure (shouldn't fail) + * Return: 'file_id' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5HF.c b/src/H5HF.c index b7a6244..3df7e7b 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -167,7 +167,7 @@ H5HF_create(H5F_t *f, const H5HF_create_t *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))) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 70dfeed..fc437dc 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -395,7 +395,7 @@ H5HF_hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) /* 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); @@ -531,13 +531,13 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* 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, ""); @@ -788,13 +788,13 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* 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); @@ -878,8 +878,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, - int fwidth) +H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -897,7 +896,7 @@ H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, /* 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) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 8166d88..b014017 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -484,7 +484,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Second phase of header final initialization */ /* (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") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "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 */ @@ -494,11 +494,11 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* 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; diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index e5c2559..20a62b7 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -256,52 +256,52 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) /* Check for last reference to block */ if(iblock->rc == 0) { - /* If this indirect block has a parent, reset it's child iblock pointer */ - if(iblock->parent) { - H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ - 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)); - - /* 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]); - 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); - - /* 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); - iblock->hdr->root_iblock = NULL; - } /* end if */ - - /* Indicate that the root indirect block is unpinned */ - iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); - } /* end if */ - } /* end else */ - - /* Check if the block is still in the cache */ - 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") - } /* 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") - } /* end else */ + /* If this indirect block has a parent, reset it's child iblock pointer */ + if(iblock->parent) { + H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ + 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)); + + /* 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]); + 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); + + /* 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); + iblock->hdr->root_iblock = NULL; + } /* end if */ + + /* Indicate that the root indirect block is unpinned */ + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); + } /* end if */ + } /* end else */ + + /* Check if the block is still in the cache */ + 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") + } /* 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") + } /* end else */ } /* end if */ done: @@ -408,13 +408,13 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) dblock->parent = iblock; dblock->par_entry = 0; - /* Destroy flush dependency between direct block and header */ - if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) + /* 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") dblock->fd_parent = NULL; - /* Create flush dependency between direct block and new root indirect block */ - if(H5AC_create_flush_dependency(iblock, dblock) < 0) + /* 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") dblock->fd_parent = iblock; @@ -1059,14 +1059,14 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, iblock->block_off += hdr->man_dtable.row_block_off[par_entry / hdr->man_dtable.cparam.width]; iblock->block_off += hdr->man_dtable.row_block_size[par_entry / hdr->man_dtable.cparam.width] * (par_entry % hdr->man_dtable.cparam.width); - /* Set indirect block parent as flush dependency parent */ - iblock->fd_parent = par_iblock; + /* Set indirect block parent as flush dependency parent */ + iblock->fd_parent = par_iblock; } /* end if */ else { iblock->block_off = 0; /* Must be the root indirect block... */ - /* Set heap header as flush dependency parent */ - iblock->fd_parent = hdr; + /* Set heap header as flush dependency parent */ + iblock->fd_parent = hdr; } /* end else */ /* Update indirect block's statistics */ @@ -1430,69 +1430,69 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) 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") - /* If the indirect block wasn't removed already (by reverting it) */ - if(!iblock->removed_from_cache) { - /* Check for reducing size of root indirect block */ - if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 - && entry > iblock->max_child) { - unsigned max_child_row; /* Row for max. child entry */ - - /* Compute information needed for determining whether to reduce size of root indirect block */ - max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; - - /* Check if the root indirect block should be reduced */ - 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") - } /* end if */ - } /* end if */ + /* If the indirect block wasn't removed already (by reverting it) */ + if(!iblock->removed_from_cache) { + /* Check for reducing size of root indirect block */ + if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 + && entry > iblock->max_child) { + unsigned max_child_row; /* Row for max. child entry */ + + /* Compute information needed for determining whether to reduce size of root indirect block */ + max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; + + /* Check if the root indirect block should be reduced */ + 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") + } /* end if */ + } /* end if */ } /* end if */ /* If the indirect block wasn't removed already (by reverting it) */ 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") - - /* Check for last child being removed from indirect block */ - if(iblock->nchildren == 0) { - hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ - - /* If this indirect block's refcount is >1, then it's being deleted - * from the fractal heap (since its nchildren == 0), but is still - * referred to from free space sections in the heap (refcount >1). - * Its space in the file needs to be freed now, and it also needs - * to be removed from the metadata cache now, in case the space in - * the file is reused by another piece of metadata that is inserted - * into the cache before the indirect block's entry is evicted - * (having two entries at the same address would be an error, from - * the cache's perspective). - */ - /* Lock indirect block for deletion */ - 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); - - /* 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") - - /* 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") - 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") - iblock->parent = NULL; - iblock->par_entry = 0; - } /* end if */ - } /* end if */ + /* 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") + + /* Check for last child being removed from indirect block */ + if(iblock->nchildren == 0) { + hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ + + /* If this indirect block's refcount is >1, then it's being deleted + * from the fractal heap (since its nchildren == 0), but is still + * referred to from free space sections in the heap (refcount >1). + * Its space in the file needs to be freed now, and it also needs + * to be removed from the metadata cache now, in case the space in + * the file is reused by another piece of metadata that is inserted + * into the cache before the indirect block's entry is evicted + * (having two entries at the same address would be an error, from + * the cache's perspective). + */ + /* Lock indirect block for deletion */ + 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); + + /* 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") + + /* 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") + 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") + iblock->parent = NULL; + iblock->par_entry = 0; + } /* end if */ + } /* end if */ } /* end if */ /* Decrement the reference count on this indirect block if we're not deleting it */ @@ -1501,48 +1501,48 @@ 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 */ if(del_iblock) { - unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ - hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ - - /* If the refcount is still >0, unpin the block and take ownership - * from the cache, otherwise let the cache destroy it. - */ - if(del_iblock->rc > 0) { - cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); - cache_flags |= H5AC__UNPIN_ENTRY_FLAG; - took_ownership = TRUE; - } /* end if */ - else { - /* Entry should be removed from the cache */ - cache_flags |= H5AC__DELETED_FLAG; - - /* If the indirect block is in real file space, tell - * the cache to free its file space as well. - */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; - } /* end else */ - - /* 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") - - /* if took ownership, free file space & mark block as removed from cache */ - if(took_ownership) { - /* Free indirect block disk space, if it's in real space */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - 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") - del_iblock->addr = HADDR_UNDEF; - - /* Mark block as removed from the cache */ - del_iblock->removed_from_cache = TRUE; - } /* end if */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ + hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ + + /* If the refcount is still >0, unpin the block and take ownership + * from the cache, otherwise let the cache destroy it. + */ + if(del_iblock->rc > 0) { + cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); + cache_flags |= H5AC__UNPIN_ENTRY_FLAG; + took_ownership = TRUE; + } /* end if */ + else { + /* Entry should be removed from the cache */ + cache_flags |= H5AC__DELETED_FLAG; + + /* If the indirect block is in real file space, tell + * the cache to free its file space as well. + */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; + } /* end else */ + + /* 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") + + /* if took ownership, free file space & mark block as removed from cache */ + if(took_ownership) { + /* Free indirect block disk space, if it's in real space */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + 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") + del_iblock->addr = HADDR_UNDEF; + + /* Mark block as removed from the cache */ + del_iblock->removed_from_cache = TRUE; + } /* end if */ } /* end if */ done: @@ -1633,24 +1633,24 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, if(H5F_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 */ + hsize_t dblock_size; /* Size of direct block on disk */ - /* Check for I/O filters on this heap */ - if(hdr->filter_len > 0) - dblock_size = iblock->filt_ents[entry].size; - else - dblock_size = hdr->man_dtable.row_block_size[row]; + /* Check for I/O filters on this heap */ + if(hdr->filter_len > 0) + dblock_size = iblock->filt_ents[entry].size; + else + dblock_size = hdr->man_dtable.row_block_size[row]; /* 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") } /* end if */ else { - hsize_t row_block_size; /* The size of blocks in this row */ + hsize_t row_block_size; /* The size of blocks in this row */ unsigned child_nrows; /* Number of rows in new indirect block */ - /* Get the row's block size */ - row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; + /* Get the row's block size */ + row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, row_block_size); @@ -1733,30 +1733,30 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, /* Indirect entries in this indirect block */ if(iblock->nrows > hdr->man_dtable.max_direct_rows) { - unsigned first_row_bits; /* Number of bits used bit addresses in first row */ + 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 */ unsigned entry; /* Current entry in row */ size_t u; /* Local index variable */ entry = hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width; - first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5VM_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM_log2_of2(hdr->man_dtable.cparam.width); num_indirect_rows = - (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; + (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++, num_indirect_rows++) { 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(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") + for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) + if(H5F_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") } /* 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) @@ -1810,17 +1810,17 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, */ prev_par_block_off = par_block_off = 0; while(row >= hdr->man_dtable.max_direct_rows) { - /* Retain previous parent block offset */ - prev_par_block_off = par_block_off; + /* Retain previous parent block offset */ + prev_par_block_off = par_block_off; /* Compute the new parent indirect block's offset in the heap's address space */ /* (based on previous block offset) */ par_block_off += hdr->man_dtable.row_block_off[row]; par_block_off += hdr->man_dtable.row_block_size[row] * col; - /* Preserve current row & column */ - prev_row = row; - prev_col = col; + /* Preserve current row & column */ + prev_row = row; + prev_col = col; /* 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) diff --git a/src/H5HFman.c b/src/H5HFman.c index 394bcff..7f90f49 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -140,6 +140,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { + /* 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") diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 5086afb..587a8fc 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -110,15 +110,13 @@ H5_DLL H5HF_t *H5HF_create(H5F_t *f, const H5HF_create_t *cparam); H5_DLL H5HF_t *H5HF_open(H5F_t *f, haddr_t fh_addr); H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/); H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/); -H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, - void *id/*out*/); +H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id/*out*/); H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, const void *id, size_t *obj_len_p/*out*/); H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p/*out*/); H5_DLL herr_t H5HF_read(H5HF_t *fh, const void *id, void *obj/*out*/); H5_DLL herr_t H5HF_write(H5HF_t *fh, void *id, hbool_t *id_changed, const void *obj); -H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, - void *op_data); +H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, void *op_data); H5_DLL herr_t H5HF_remove(H5HF_t *fh, const void *id); H5_DLL herr_t H5HF_close(H5HF_t *fh); H5_DLL herr_t H5HF_delete(H5F_t *f, haddr_t fh_addr); @@ -128,11 +126,9 @@ H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats); H5_DLL herr_t H5HF_size(const H5HF_t *fh, hsize_t *heap_size/*out*/); /* Debugging routines */ -H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, - int indent, int fwidth); +H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, int indent, int fwidth); #ifdef H5HF_DEBUGGING -H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth); +H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* H5HF_DEBUGGING */ #endif /* _H5HFprivate_H */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 66c8414..36e966e 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -692,8 +692,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, *------------------------------------------------------------------------- */ herr_t -H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - size_t amt) +H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2094,8 +2093,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_row_debug(const H5FS_section_info_t *_sect, - FILE *stream, int indent, int fwidth) +H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, int fwidth) { const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Section to dump info */ @@ -2666,8 +2664,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, - unsigned start_entry, unsigned nentries) +H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *first_row_sect = NULL; /* First row section in new indirect section */ @@ -2841,8 +2838,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - H5HF_indirect_t *sect_iblock) +H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indirect_t *sect_iblock) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 5260ae2..37a0502 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -311,7 +311,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *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 */ + /* 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") @@ -404,7 +404,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ + /* Iterate over all sections, seting 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") @@ -602,8 +602,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - uint16_t new_class) +H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HG.c b/src/H5HG.c index 53f1b2a..b9d8dc3 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -83,7 +83,7 @@ /********************/ static haddr_t H5HG__create(H5F_t *f, size_t size); - +static size_t H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr); /*********************/ /* Package Variables */ @@ -204,11 +204,11 @@ H5HG__create(H5F_t *f, size_t size) /* 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") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "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; @@ -223,7 +223,7 @@ done: /* Check if the heap object was allocated */ if(heap) /* Destroy the heap object */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") } /* end if */ } /* end if */ @@ -275,7 +275,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_alloc + * Function: H5HG__alloc * * Purpose: Given a heap with enough free space, this function will split * the free space to make a new empty heap object and initialize @@ -293,14 +293,14 @@ done: *------------------------------------------------------------------------- */ static size_t -H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) +H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) { size_t idx; uint8_t *p; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(heap); @@ -363,27 +363,27 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) heap->obj[0].begin = NULL; } /* end if */ else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) { - /* - * Some free space remains and it's larger than a heap object header, - * so write the new free heap object header to the heap. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - p = heap->obj[0].begin; - UINT16ENCODE(p, 0); /*id*/ - UINT16ENCODE(p, 0); /*nrefs*/ - UINT32ENCODE(p, 0); /*reserved*/ - H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains and it's larger than a heap object header, + * so write the new free heap object header to the heap. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + p = heap->obj[0].begin; + UINT16ENCODE(p, 0); /*id*/ + UINT16ENCODE(p, 0); /*nrefs*/ + UINT32ENCODE(p, 0); /*reserved*/ + H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* end else-if */ else { - /* - * Some free space remains but it's smaller than a heap object header, - * so we don't write the header. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains but it's smaller than a heap object header, + * so we don't write the header. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* Mark the heap as dirty */ @@ -394,7 +394,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HG_alloc() */ +} /* end H5HG__alloc() */ /*------------------------------------------------------------------------- @@ -522,7 +522,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) HDassert(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); @@ -548,7 +548,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) 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))) + if(0 == (idx = H5HG__alloc(f, heap, size, &heap_flags))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object") /* Copy data into the heap */ @@ -608,7 +608,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* 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); @@ -617,7 +617,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* 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") HDmemcpy(object, p, size); /* @@ -678,7 +678,7 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) HDassert(f); HDassert(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))) @@ -839,11 +839,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_free + * Function: H5HG__free * - * Purpose: Destroys a global heap collection in memory + * Purpose: Destroys a global heap collection in memory * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, January 15, 2003 @@ -851,7 +851,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_free(H5HG_heap_t *heap) +H5HG__free(H5HG_heap_t *heap) { herr_t ret_value = SUCCEED; /* Return value */ @@ -872,5 +872,5 @@ H5HG_free(H5HG_heap_t *heap) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HG_free() */ +} /* H5HG__free() */ diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 3a770ae..beaea7b 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -374,7 +374,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && heap) - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value) @@ -485,7 +485,7 @@ H5HG__cache_heap_free_icr(void *_thing) HDassert(heap->cache_info.type == H5AC_GHEAP); /* Destroy global heap collection */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection") done: diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index a735ba0..4ed9b10 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -137,7 +137,7 @@ struct H5HG_heap_t { /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5HG_free(H5HG_heap_t *heap); +H5_DLL herr_t H5HG__free(H5HG_heap_t *heap); H5_DLL H5HG_heap_t *H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags); #endif /* _H5HGpkg_H */ diff --git a/src/H5I.c b/src/H5I.c index 3cf592d..6cb1947 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -144,7 +144,7 @@ static herr_t H5I__debug(H5I_type_t type); * Return: Success: Positive if any action was taken that might * affect some other interface; zero otherwise. * - * Failure: Negative. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -2032,8 +2032,8 @@ done: /*------------------------------------------------------------------------- * Function: H5Iget_file_id * - * Purpose: The public version of H5I_get_file_id(), obtains the file - * ID given an object ID. User has to close this ID. + * Purpose: Obtains the file ID given an object ID. The user has to + * close this ID. * * Return: Success: The file ID associated with the object * diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index e6fd37c..7bdb001 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -41,10 +41,10 @@ #define H5L_SAME_LOC (hid_t)0 /* Current version of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS 1 +#define H5L_LINK_CLASS_T_VERS 1 /* Previous versions of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS_0 0 +#define H5L_LINK_CLASS_T_VERS_0 0 #ifdef __cplusplus extern "C" { diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index b57eaf6..fa57862 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1541,7 +1541,7 @@ H5O_copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) 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_committed(dt)) { + 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") @@ -1658,9 +1658,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, 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") - /* Check if the datatype is committed and search the skip list if so - */ - if(H5T_committed(key->dt)) { + /* Check if the datatype is committed and search the skip list if so */ + if(H5T_is_named(key->dt)) { /* Get datatype object fileno */ H5F_GET_FILENO(obj_oloc->file, key->fileno); diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 8060398..b8eb4a7 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1485,7 +1485,7 @@ H5O_dtype_can_share(const void *_mesg) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable") /* Don't share committed datatypes */ - if((tri_ret = H5T_committed(mesg)) > 0) + if((tri_ret = H5T_is_named(mesg)) > 0) HGOTO_DONE(FALSE) else if(tri_ret < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is shared") @@ -1619,14 +1619,15 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc, FUNC_ENTER_STATIC if(dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { - HDassert(H5T_committed(dt_dst)); + HDassert(H5T_is_named(dt_dst)); if(H5O_loc_reset(&(dt_dst->oloc)) < 0) 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_committed(dt_dst)); + else { + HDassert(!H5T_is_named(dt_dst)); + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5R.c b/src/H5R.c index 95abc32..65aa6cb 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -93,7 +93,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t { H5G_loc_t loc; /* File location */ H5S_t *space = NULL; /* Pointer to dataspace containing region */ - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id); @@ -101,17 +101,17 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Check args */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - if (H5G_loc(loc_id, &loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) + if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported") - if (space_id == (-1) && ref_type == H5R_DATASET_REGION) + if(space_id == (-1) && ref_type == H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") - if (space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) + if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Set up collective metadata if appropriate */ @@ -165,13 +165,13 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref); /* Check args */ - if (H5G_loc(obj_id, &loc) < 0) + if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (oapl_id < 0) + if(oapl_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Verify access property list and set up collective metadata if appropriate */ @@ -181,7 +181,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r /* Get the file pointer from the entry */ file = loc.oloc->file; - /* Create reference */ + /* Dereference */ if((ret_value = H5R__dereference(file, oapl_id, ref_type, _ref)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") @@ -224,11 +224,11 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("i", "iRt*x", id, ref_type, ref); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (ref_type != H5R_DATASET_REGION) + if(ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Get the dataspace with the correct region selected */ @@ -236,7 +236,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") /* Atomize */ - if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) + if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: @@ -278,14 +278,14 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - /* Get the object information */ + /* Get the object type */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") @@ -333,17 +333,17 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, { H5G_loc_t loc; /* Group location */ H5F_t *file; /* File object */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") /* Get the file pointer from the entry */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index fb62430..41765cf 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -37,12 +37,12 @@ #include "H5Ppublic.h" /* Property lists */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ @@ -119,7 +119,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Get the object information */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -166,9 +166,9 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) /* Get the file pointer from the entry */ file = loc.oloc->file; - /* Create reference */ + /* Dereference */ if((ret_value = H5R__dereference(file, H5P_DATASET_ACCESS_DEFAULT, ref_type, _ref)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable dereference object") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rint.c b/src/H5Rint.c index d2f315b..1bbe217 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -221,8 +221,7 @@ H5R_term_package(void) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, - H5S_t *space) +H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space) { H5G_loc_t obj_loc; /* Group hier. location of object */ H5G_name_t path; /* Object group hier. path */ @@ -371,8 +370,7 @@ done: Added a check for undefined reference pointer. --------------------------------------------------------------------------*/ hid_t -H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, - const void *_ref) +H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_ref) { H5O_loc_t oloc; /* Object location */ H5G_name_t path; /* Path of object */ @@ -459,7 +457,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_GROUP, group, TRUE)) < 0) { H5G_close(group); HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register group") - } /* end if */ + } break; } @@ -475,7 +473,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) { H5T_close(type); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register datatype") - } /* end if */ + } break; } @@ -492,7 +490,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) { H5D_close(dset); HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset") - } /* end if */ + } break; } @@ -536,7 +534,7 @@ H5R__get_region(H5F_t *file, const void *_ref) const uint8_t *p; /* Pointer to OID to store */ H5HG_t hobjid; /* Heap object ID */ uint8_t *buf = NULL; /* Buffer to store serialized selection in */ - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value; /* Return value */ FUNC_ENTER_PACKAGE @@ -574,7 +572,7 @@ done: H5MM_xfree(buf); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R__get_region() */ +} /* end H5R__get_region() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index fbbff50..504d2af 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -50,15 +50,11 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, - H5R_type_t ref_type, H5S_t *space); -H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, - const void *_ref); +H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space); +H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref); H5_DLL H5S_t *H5R__get_region(H5F_t *file, const void *_ref); -H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, - const void *_ref, H5O_type_t *obj_type); -H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, - const void *_ref, char *name, size_t size); +H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); +H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size); #endif /* _H5Rpkg_H */ diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h index 8c0ba8f..1bf2e92 100644 --- a/src/H5Rprivate.h +++ b/src/H5Rprivate.h @@ -20,11 +20,6 @@ #include "H5Rpublic.h" /* Private headers needed by this file */ -#include "H5Fprivate.h" /* Files */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ - /**************************/ /* Library Private Macros */ @@ -45,6 +40,5 @@ /* Library Private Prototypes */ /******************************/ - #endif /* _H5Rprivate_H */ diff --git a/src/H5SM.c b/src/H5SM.c index 1bf6301..0fa3489 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -142,7 +142,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc) /* 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); @@ -209,11 +209,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); @@ -386,7 +386,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id) 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() */ @@ -424,11 +424,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; @@ -436,7 +436,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() */ @@ -648,9 +648,9 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* 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++) @@ -661,11 +661,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; @@ -773,7 +773,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, /* 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 @@ -973,7 +973,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, done: /* 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() */ @@ -1081,7 +1081,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, /* 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) @@ -1103,7 +1103,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, */ 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". @@ -1130,7 +1130,7 @@ done: /* 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() */ @@ -1254,15 +1254,15 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* 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; @@ -1285,14 +1285,14 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* 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 != UFAIL) @@ -1503,7 +1503,7 @@ done: /* 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); @@ -1557,11 +1557,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 @@ -1572,7 +1572,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* 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 @@ -1590,7 +1590,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) 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) @@ -1794,7 +1794,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* 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. @@ -1813,7 +1813,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* 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; @@ -1833,13 +1833,13 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* 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") if(list_pos == UFAIL) - 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); @@ -1859,7 +1859,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, * 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; @@ -1893,7 +1893,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* 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 */ @@ -1905,7 +1905,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* 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); @@ -1929,7 +1929,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, 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) @@ -2068,7 +2068,7 @@ done: /* 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() */ @@ -2180,16 +2180,16 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const 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), &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; @@ -2198,7 +2198,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* 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 +2218,13 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* 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") if(list_pos == UFAIL) - 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]; @@ -2243,7 +2243,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, if((msg_exists = H5B2_find(bt2, &key, H5SM_get_refcount_bt2_cb, &message)) < 0) 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 */ @@ -2253,9 +2253,9 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, 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") if(bt2 && H5B2_close(bt2) < 0) @@ -2418,11 +2418,11 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, 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; @@ -2559,11 +2559,11 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, if(table_vers == UFAIL) 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"); + HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); if(num_indexes == UFAIL) 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"); + HDfprintf(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) @@ -2576,7 +2576,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, /* 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, ""); for(x = 0; x < num_indexes; ++x) { @@ -2604,7 +2604,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, 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() */ @@ -2650,7 +2650,7 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, /* 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; @@ -2708,11 +2708,11 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, 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() */ @@ -2757,7 +2757,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; @@ -2771,7 +2771,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) 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") - if(H5B2_size(bt2, &(ih_info->index_size)) < 0) + if(H5B2_size(bt2, &(ih_info->index_size)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") /* Close the v2 B-tree */ @@ -2792,8 +2792,8 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) 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") + if(H5HF_size(fheap, &(ih_info->heap_size)) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") /* Close the fractal heap */ if(H5HF_close(fheap) < 0) diff --git a/src/H5T.c b/src/H5T.c index 76b0663..a9d2168 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -28,24 +28,19 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tpkg.h" /* Datatypes */ - -/* Check for header needed for SGI floating-point code */ -#ifdef H5_HAVE_SYS_FPU_H -#include -#endif /* H5_HAVE_SYS_FPU_H */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ @@ -292,17 +287,13 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_lib_conv_t func); -static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_func_t *conv); -static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_t func); +static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_lib_conv_t func); +static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_func_t *conv); +static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func); static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst); static herr_t H5T__set_size(H5T_t *dt, size_t size); static herr_t H5T__close_cb(H5T_t *dt); -static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, - const char *name, H5T_conv_func_t *conv); +static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv); /*****************************/ @@ -1391,7 +1382,7 @@ H5T_top_term_package(void) if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: conversion function " + 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); @@ -1597,6 +1588,35 @@ H5T_term_package(void) /*------------------------------------------------------------------------- + * Function: H5T__close_cb + * + * Purpose: Called when the ref count reaches zero on the datatype's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__close_cb(H5T_t *dt) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(dt); + HDassert(dt->shared); + + /* Close the datatype */ + if(H5T_close(dt) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5Tcreate * * Purpose: Create a new type and initialize it to reasonable values. @@ -1626,7 +1646,7 @@ 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))) @@ -1644,33 +1664,27 @@ done: /*------------------------------------------------------------------------- * Function: H5Tcopy * - * Purpose: Copies a datatype. The resulting datatype is not locked. - * The datatype should be closed when no longer needed by - * calling H5Tclose(). - * - * Return: Success: The ID of a new datatype. + * Purpose: Copies a datatype. The resulting datatype is not locked. + * The datatype should be closed when no longer needed by + * calling H5Tclose(). * - * Failure: Negative + * Return: Success: The ID of a new datatype * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: + * Failure: H5I_INVALID_HID * - * Robb Matzke, 4 Jun 1998 - * The returned type is always transient and unlocked. If the TYPE_ID - * argument is a dataset instead of a datatype then this function - * returns a transient, modifiable datatype which is a copy of the - * dataset's datatype. + * Note: The returned type is always transient and unlocked. If the + * TYPE_ID argument is a dataset instead of a datatype then + * this function returns a transient, modifiable datatype + * which is a copy of the dataset's datatype. * *------------------------------------------------------------------------- */ hid_t H5Tcopy(hid_t type_id) { - H5T_t *dt; /* Pointer to the datatype to copy */ - H5T_t *new_dt = NULL; - hid_t ret_value; /* Return value */ + H5T_t *dt = NULL; /* Pointer to the datatype to copy */ + H5T_t *new_dt = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type_id); @@ -1721,7 +1735,7 @@ H5Tcopy(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") done: - if(ret_value < 0) + 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") @@ -1835,9 +1849,9 @@ H5Tlock(hid_t type_id) H5TRACE1("e", "i", type_id); /* Check args */ - if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if(H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state) + 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") if(H5T_lock(dt, TRUE) < 0) @@ -1972,15 +1986,6 @@ done: * Programmer: Quincey Koziol * Wednesday, November 29, 2000 * - * Modifications: - * Raymond Lu - * 4 December 2009 - * Added a flag as a parameter to indicate whether the caller is - * H5Tdetect_class. I also added the check for VL string type - * just like the public function. Because we want to tell users - * VL string is a string type but we treat it as a VL type - * internally, H5T_detect_class needs to know where the caller - * is from. *------------------------------------------------------------------------- */ htri_t @@ -2213,7 +2218,7 @@ H5Tget_super(hid_t type) { H5T_t *dt; /* Datatype to query */ H5T_t *super = NULL; /* Supertype */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type); @@ -2226,7 +2231,7 @@ H5Tget_super(hid_t type) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register parent datatype") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(super && H5T_close_real(super) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release super datatype info") @@ -2289,7 +2294,7 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, FUNC_ENTER_STATIC /* Check args */ - HDassert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers); + HDassert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); HDassert(name && *name); HDassert(src); HDassert(dst); @@ -2354,8 +2359,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, 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") - /* - * Notify all other functions to recalculate private data since some + /* Notify all other functions to recalculate private data since some * functions might cache a list of conversion functions. For * instance, the compound type converter caches a list of conversion * functions for the members, so adding a new function should cause @@ -2445,7 +2449,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.app_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + 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); #endif @@ -2455,7 +2459,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.lib_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + 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); #endif @@ -2627,7 +2631,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + 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); #endif @@ -2637,7 +2641,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + 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); #endif @@ -3151,7 +3155,7 @@ H5T__create(H5T_class_t type, size_t size) case H5T_REFERENCE: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_INTERNAL, 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 */ @@ -3166,8 +3170,8 @@ done: if(dt) { 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__create() */ @@ -3186,27 +3190,6 @@ done: * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * - * Robb Matzke, 4 Jun 1998 - * Added the METHOD argument. If it's H5T_COPY_TRANSIENT then the - * result will be an unlocked transient type. Otherwise if it's - * H5T_COPY_ALL then the result is a named type if the original is a - * named type, but the result is not opened. Finally, if it's - * H5T_COPY_REOPEN and the original type is a named type then the result - * is a named type and the type object header is opened again. The - * H5T_COPY_REOPEN method is used when returning a named type to the - * application. - * - * Robb Matzke, 22 Dec 1998 - * Now able to copy enumeration data types. - * - * Robb Matzke, 20 May 1999 - * Now able to copy opaque types. - * - * Pedro Vicente, 21 Sep 2002 - * Added a deep copy of the symbol table entry - * *------------------------------------------------------------------------- */ H5T_t * @@ -3498,9 +3481,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_lock (H5T_t *dt, hbool_t immutable) +H5T_lock(H5T_t *dt, hbool_t immutable) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3511,7 +3494,8 @@ H5T_lock (H5T_t *dt, hbool_t immutable) dt->shared->state = immutable ? H5T_STATE_IMMUTABLE : H5T_STATE_RDONLY; break; case H5T_STATE_RDONLY: - if (immutable) dt->shared->state = H5T_STATE_IMMUTABLE; + if(immutable) + dt->shared->state = H5T_STATE_IMMUTABLE; break; case H5T_STATE_IMMUTABLE: case H5T_STATE_NAMED: @@ -3601,10 +3585,8 @@ H5T__free(H5T_t *dt) /* Free the ID to name info */ H5G_name_free(&(dt->path)); - /* - * Don't free locked datatypes. - */ - if(H5T_STATE_IMMUTABLE==dt->shared->state) + /* Don't free locked datatypes */ + if(H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype") /* Close the datatype */ @@ -3613,7 +3595,7 @@ H5T__free(H5T_t *dt) for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name); (void)H5T_close_real(dt->shared->u.compnd.memb[i].type); - } /* end for */ + } dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb); dt->shared->u.compnd.nmembs = 0; break; @@ -3661,7 +3643,7 @@ done: * * Purpose: Frees a datatype and all associated memory. * - * Hote: Does _not_ deal with open hamed datatypes, etc. + * Hote: Does _not_ deal with open named datatypes, etc. * * Return: Non-negative on success/Negative on failure * @@ -3700,41 +3682,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__close_cb - * - * Purpose: Callback routine for closing a datatype ID. Closes the datatype - * object that was attached to the ID. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__close_cb(H5T_t *dt) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* check args */ - HDassert(dt && dt->shared); - - /* Call actual datatype close routine */ - if(H5T_close(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T__close_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5T_close + * Function: H5T_close * - * Purpose: Frees a data type and all associated memory. Deals with - * open named datatypes appropriately. + * Purpose: Frees a data type and all associated memory. Deals with + * open named datatypes appropriately. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -3749,7 +3702,8 @@ H5T_close(H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt && dt->shared); + HDassert(dt); + HDassert(dt->shared); /* Named datatype cleanups */ if(dt->shared->state == H5T_STATE_OPEN) { @@ -3761,8 +3715,7 @@ H5T_close(H5T_t *dt) HDassert(H5F_addr_defined(dt->sh_loc.u.loc.oh_addr)); HDassert(H5F_addr_defined(dt->oloc.addr)); - /* - * If a named type is being closed then close the object header and + /* If a named type is being closed then close the object header and * remove from the list of open objects in the file. */ @@ -3862,7 +3815,7 @@ H5T__set_size(H5T_t *dt, size_t size) dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem; else if(dt->shared->type!=H5T_VLEN) dt->shared->size = dt->shared->parent->shared->size; - } /* end if */ + } else { if (H5T_IS_ATOMIC(dt->shared)) { offset = dt->shared->u.atomic.offset; @@ -3876,7 +3829,7 @@ H5T__set_size(H5T_t *dt, size_t size) offset = 8 * size - prec; if (prec > 8*size) prec = 8 * size; - } /* end if */ + } else prec = offset = 0; @@ -3974,7 +3927,7 @@ H5T__set_size(H5T_t *dt, size_t size) 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"); - } /* end if */ + } break; case H5T_ENUM: @@ -4000,7 +3953,7 @@ H5T__set_size(H5T_t *dt, size_t size) if (H5T_IS_ATOMIC(dt->shared)) { dt->shared->u.atomic.offset = offset; dt->shared->u.atomic.prec = prec; - } /* end if */ + } } /* end if */ /* Check if the new compound type is packed */ @@ -4038,7 +3991,7 @@ H5T_get_size(const H5T_t *dt) HDassert(dt); FUNC_LEAVE_NOAPI(dt->shared->size) -} +} /* end H5T_get_size() */ /*------------------------------------------------------------------------- @@ -4615,7 +4568,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if(H5T__conv_noop((hid_t)FAIL, (hid_t)FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); + HDfprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); #endif H5E_clear_stack(NULL); /*ignore the error*/ } /* end if */ @@ -4623,8 +4576,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_g.npaths = 1; } /* end if */ - /* - * Find the conversion path. If source and destination types are equal + /* Find the conversion path. If source and destination types are equal * then use entry[0], otherwise do a binary search over the * remaining entries. * @@ -4663,8 +4615,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, */ old_npaths = H5T_g.npaths; - /* - * If we didn't find the path, if the caller is an API function specifying + /* If we didn't find the path, if the caller is an API function specifying * a new hard conversion function, or if the caller is a private function * specifying a new hard conversion and the path is a soft conversion, then * create a new path and add the new function to the path. @@ -4686,8 +4637,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, else path = table; - /* - * If a hard conversion function is specified and none is defined for the + /* If a hard conversion function is specified and none is defined for the * path, or the caller is an API function, or the caller is a private function but * the existing path is a soft function, then add the new conversion to the path * and initialize its conversion data. @@ -4793,7 +4743,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -4803,7 +4753,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -5028,7 +4978,7 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, H5_timer_end(&(tpath->stats.timer), &timer); tpath->stats.ncalls++; tpath->stats.nelmts += nelmts; - } /* end if */ + } #endif done: @@ -5150,14 +5100,10 @@ done: /*------------------------------------------------------------------------- * Function: H5T_is_named * - * Purpose: Check if a datatype is named. - * - * Return: TRUE + * Purpose: Check if a datatype is named/committed. * - * FALSE + * Return: TRUE/FALSE/FAIL * - * Programmer: Pedro Vicente - * Tuesday, Sep 3, 2002 *------------------------------------------------------------------------- */ htri_t @@ -5213,7 +5159,7 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") dt->shared->state = H5T_STATE_TRANSIENT; - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 649bd2e..ce537dc 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -56,8 +56,6 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); -static hid_t H5T__get_create_plist(const H5T_t *type); static H5T_t *H5T__open_oid(const H5G_loc_t *loc); @@ -83,15 +81,12 @@ static H5T_t *H5T__open_oid(const H5G_loc_t *loc); /*------------------------------------------------------------------------- - * Function: H5Tcommit2 + * Function: H5Tcommit2 * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * April 5, 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -100,7 +95,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Location to create datatype */ - H5T_t *type; /* Datatype for ID */ + H5T_t *type = NULL; /* Datatype for ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -108,11 +103,13 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name) + 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") 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 correct property list */ if(H5P_DEFAULT == lcpl_id) @@ -134,7 +131,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, 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") done: FUNC_LEAVE_API(ret_value) @@ -194,7 +191,7 @@ done: * to return it to the state it was in before it was committed. */ if(ret_value < 0 && (NULL != ocrt_info.new_obj)) { - if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { + 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") @@ -212,9 +209,9 @@ done: /* Mark datatype as being back in memory */ if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY)) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory") - dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; + dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; dt->shared->state = old_state; - } /* end if */ + } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -222,21 +219,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tcommit_anon + * Function: H5Tcommit_anon * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * * The resulting ID should be linked into the file with * H5Olink or it will be deleted when closed. * - * Note: Datatype access property list is unused currently, but is - * checked for sanity anyway. + * Note: The datatype access property list is unused currently, but + * is checked for sanity anyway. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Peter Cao - * May 17, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -244,7 +238,7 @@ herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ - H5T_t *type = NULL; /* Datatype created */ + H5T_t *type = NULL; /* Datatype created */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -252,9 +246,11 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Check arguments */ 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") 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") /* Get correct property list */ if(H5P_DEFAULT == tcpl_id) @@ -267,9 +263,9 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) 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") - /* Commit the type */ + /* Commit the datatype */ if(H5T__commit_anon(loc.oloc->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") done: FUNC_LEAVE_API(ret_value) @@ -277,24 +273,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__commit_anon + * Function: H5T__commit_anon * - * Purpose: Create an anonymous committed datatype. + * Purpose: Create an anonymous committed datatype. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 12, 2017 * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) { H5O_loc_t *oloc; /* Object location for datatype */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(file); @@ -303,7 +299,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) /* 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 */ @@ -392,9 +388,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) * 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(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0) @@ -442,23 +438,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tcommitted - * - * Purpose: Determines if a datatype is committed or not. - * - * Return: Success: TRUE if committed, FALSE otherwise. + * Function: H5Tcommitted * - * Failure: Negative + * Purpose: Determines if a datatype is committed or not. * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 + * Return: TRUE/FALSE/FAIL * *------------------------------------------------------------------------- */ htri_t H5Tcommitted(hid_t type_id) { - H5T_t *type; /* Datatype to query */ + H5T_t *type; /* Datatype to query */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -466,10 +457,10 @@ 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_committed(type); + ret_value = H5T_is_named(type); done: FUNC_LEAVE_API(ret_value) @@ -477,30 +468,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_committed - * - * Purpose: Determines if a datatype is committed or not. - * - * Return: Success: TRUE if committed, FALSE otherwise. - * - * Programmer: Quincey Koziol - * Wednesday, September 24, 2003 - * - *------------------------------------------------------------------------- - */ -htri_t -H5T_committed(const H5T_t *type) -{ - /* Use no-init for efficiency */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(type); - - FUNC_LEAVE_NOAPI(H5T_STATE_OPEN == type->shared->state || H5T_STATE_NAMED == type->shared->state) -} /* end H5T_committed() */ - - -/*------------------------------------------------------------------------- * Function: H5T_link * * Purpose: Adjust the link count for an object header by adding @@ -519,14 +486,14 @@ H5T_link(const H5T_t *type, int adjust) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(type); HDassert(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, FAIL, "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) @@ -534,16 +501,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Topen2 + * Function: H5Topen2 * - * Purpose: Opens a named datatype using a Datatype Access Property + * Purpose: Opens a named datatype using a Datatype Access Property * List. * - * Return: Success: Object ID of the named datatype. - * Failure: Negative + * Return: Success: Object ID of the named datatype * - * Programmer: James Laird - * Thursday July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -560,24 +525,26 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + 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") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open it */ + /* Open the datatype */ if(NULL == (type = H5T__open_name(&loc, name))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(type != NULL) (void)H5T_close(type); @@ -586,47 +553,56 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tget_create_plist - * - * Purpose: Returns a copy of the datatype creation property list. + * Function: H5Tget_create_plist * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Purpose: Returns a copy of the datatype creation property list. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Failure: FAIL + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Tget_create_plist(hid_t dtype_id) { - H5T_t *type; /* Datatype object for ID */ - herr_t status; /* Generic status value */ - hid_t ret_value = FAIL; /* Return value */ + H5T_t *type = NULL; /* Datatype object for ID */ + htri_t is_named = FAIL; /* Is the datatype named? */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dtype_id); /* Check arguments */ if(NULL == (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, H5I_INVALID_HID, "not a datatype") /* Check if the datatype is committed */ - if((status = H5T_committed(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check whether 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") - /* Retrieve further information, if the datatype is committed */ - if(status > 0) - /* Retrieve datatype creation properties */ + /* If the datatype is not committed/named, just copy the default + * creation property list and return that. + */ + if(FALSE == is_named) { + H5P_genplist_t *tcpl_plist = NULL; + + /* 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") + 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") + } + /* If the datatype is committed, retrieve further information */ + else { if((ret_value = H5T__get_create_plist(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") + } done: FUNC_LEAVE_API(ret_value) @@ -666,7 +642,7 @@ H5Tflush(hid_t type_id) /* Flush metadata for named datatype */ if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: FUNC_LEAVE_API(ret_value) @@ -704,7 +680,7 @@ H5Trefresh(hid_t type_id) if(H5CX_set_loc(type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call private function to refresh datatype object */ + /* Refresh the datatype's metadata */ if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") @@ -714,50 +690,50 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__get_create_plist + * Function: H5T__get_create_plist * - * Purpose: Returns a copy of the datatype creation property list. + * Purpose: Returns a copy of the datatype creation property list. * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Wednesday, December 13, 2017 * *------------------------------------------------------------------------- */ -static hid_t +hid_t H5T__get_create_plist(const H5T_t *type) { H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */ H5P_genplist_t *new_plist; /* New datatype creation property list */ hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ - hid_t ret_value = FAIL; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(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, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "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; @@ -766,7 +742,7 @@ done: if(ret_value < 0) if(new_tcpl_id > 0) if(H5I_dec_app_ref(new_tcpl_id) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "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() */ @@ -981,11 +957,11 @@ H5T__open_oid(const H5G_loc_t *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; diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index feece57..d4f1008 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -202,7 +202,7 @@ done: * modifying the returned datatype does not * modify the member type. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, January 7, 1998 @@ -221,17 +221,17 @@ 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_get_member_type(dt, membno, H5T_COPY_REOPEN))) - 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 atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") done: if(ret_value < 0) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 803a6da..563de65 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2962,7 +2962,7 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne 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") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "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") @@ -8295,14 +8295,6 @@ H5_GCC_DIAG_ON(float-equal) * Programmer: Raymond Lu * Wednesday, Jan 21, 2004 * - * Raymond Lu - * Wednesday, April 21, 2004 - * There is a new design for exception handling like overflow, - * which is passed in as a transfer property. - * - * Raymond Lu - * Monday, March 13, 2006 - * Added support for VAX floating-point types. *------------------------------------------------------------------------- */ herr_t @@ -9008,8 +9000,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } #endif - /* - * Put the data in little endian order so our loops aren't so + /* Put the data in little endian order so our loops aren't so * complicated. We'll do all the conversion stuff assuming * little endian and then we'll fix the order at the end. */ @@ -9022,26 +9013,23 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } } - /*zero-set all destination bits*/ + /* Zero-set all destination bits*/ H5T__bit_set (d, dst.offset, dst.prec, FALSE); /* Copy source into a temporary buffer */ H5T__bit_copy(int_buf, (size_t)0, s, src.offset, src.prec); - /* - * Find the sign bit value of the source. - */ + /* Find the sign bit value of the source */ if(H5T_SGN_2 == src.u.i.sign) sign = (size_t)H5T__bit_get_d(int_buf, src.prec - 1, (size_t)1); - /* - * What is the bit position(starting from 0 as first one) for the most significant - * bit(MSB) of S which is set? + /* What is the bit position(starting from 0 as first one) for the most significant + * bit(MSB) of S which is set? */ if(H5T_SGN_2 == src.u.i.sign) { sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); if(sign && sfirst < 0) - /* The case 0x80...00, which is negative with maximal value */ + /* The case 0x80...00, which is negative with maximal value */ is_max_neg = 1; } else if(H5T_SGN_NONE == src.u.i.sign) sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, TRUE); @@ -9050,9 +9038,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(!sign && sfirst < 0) goto padding; - /* - * Convert source integer if it's negative - */ + /* Convert source integer if it's negative */ if(H5T_SGN_2 == src.u.i.sign && sign) { if(!is_max_neg) { /* Equivalent to ~(i - 1) */ @@ -9060,10 +9046,10 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_neg(int_buf, (size_t)0, buf_size * 8); sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); } else { - /* If it's maximal negative number 0x80...000, treat it as if it overflowed - * (create a carry) to help conversion. i.e. a character type number 0x80 - * is treated as 0x100. - */ + /* If it's maximal negative number 0x80...000, treat it as if it overflowed + * (create a carry) to help conversion. i.e. a character type number 0x80 + * is treated as 0x100. + */ sfirst = (ssize_t)(src.prec - 1); is_max_neg = 0; } @@ -9072,7 +9058,8 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* 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 - * step. */ + * step. + */ H5T__bit_set(int_buf, src.prec, (buf_size * 8) - src.prec, 0); /* Set sign bit in destination */ @@ -9081,14 +9068,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, first = (size_t)sfirst; - /* - * Calculate the true destination exponent by adjusting according to + /* Calculate the true destination exponent by adjusting according to * the destination exponent bias. Implied and non-implied normalization * should be the same. */ if (H5T_NORM_NONE==dst.u.f.norm || H5T_NORM_IMPLIED==dst.u.f.norm) { expo = first + dst.u.f.ebias; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -9096,13 +9083,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (H5T_NORM_IMPLIED==dst.u.f.norm) { /* Imply first bit */ H5T__bit_set(int_buf, first, (size_t)1, 0); - } else if (H5T_NORM_NONE==dst.u.f.norm) { - first++; + } + else if (H5T_NORM_NONE==dst.u.f.norm) { + first++; } /* Roundup for mantissa */ if(first > dst.u.f.msize) { - /* If the bit sequence is bigger than the mantissa part, there'll be some + /* If the bit sequence is bigger than the mantissa part, there'll be some * precision loss. Let user's handler deal with the case if it's present */ if(cb_struct.func) { @@ -9114,14 +9102,15 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; goto padding; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) 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 - * point, we do roundup when the least significant digit before radix is odd, we do - * rounddown if it's even. - */ + /* 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 + * point, we do roundup when the least significant digit before radix is odd, we do + * rounddown if it's even. + */ /* Check 1st dropoff bit, see if it's set. */ if(H5T__bit_get_d(int_buf, ((first - dst.u.f.msize) - 1), (size_t)1)) { diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 13d2f5f..a7f54a7 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -109,19 +109,19 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Check arguments */ 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") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") 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 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") - /* Commit the datatype to the file, using default property list values */ + /* Commit the datatype */ if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: FUNC_LEAVE_API(ret_value) @@ -137,7 +137,7 @@ done: * * Return: Success: Object ID of the named datatype. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Monday, June 1, 1998 @@ -149,7 +149,7 @@ H5Topen1(hid_t loc_id, const char *name) { H5T_t *type = NULL; H5G_loc_t loc; - hid_t ret_value = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); @@ -160,19 +160,19 @@ H5Topen1(hid_t loc_id, const char *name) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - /* Open it */ + /* Open the datatype */ if(NULL == (type = H5T__open_name(&loc, name))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(type && H5T_close(type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't 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/src/H5Tenum.c b/src/H5Tenum.c index ade7d08..0ed1775 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -46,8 +46,6 @@ static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, * Programmer: Robb Matzke * Tuesday, December 22, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5Toh.c b/src/H5Toh.c index c0139fe..c5ee994 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -180,7 +180,7 @@ H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *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))) diff --git a/src/H5Torder.c b/src/H5Torder.c index 877316d..1995a03 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -199,7 +199,7 @@ done: herr_t H5Tset_order(hid_t type_id, H5T_order_t order) { - H5T_t *dt; /* Datatype to modify */ + H5T_t *dt = NULL; /* Datatype to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -207,15 +207,15 @@ 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(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) diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index e1b996c..04e9451 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -167,7 +167,7 @@ struct H5T_path_t { char name[H5T_NAMELEN]; /*name for debugging only */ H5T_t *src; /*source datatype */ H5T_t *dst; /*destination datatype */ - H5T_conv_func_t conv; /* Conversion funcion */ + H5T_conv_func_t conv; /* Conversion function */ hbool_t is_hard; /*is it a hard function? */ hbool_t is_noop; /*is it the noop conversion? */ hbool_t are_compounds; /*are source and dest both compounds?*/ @@ -447,10 +447,12 @@ H5_DLL herr_t H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, H5_DLL herr_t H5T__upgrade_version(H5T_t *dt, unsigned new_version); /* Committed / named datatype routines */ +H5_DLL herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id); H5_DLL H5T_t *H5T__open_name(const H5G_loc_t *loc, const char *name); +H5_DLL hid_t H5T__get_create_plist(const H5T_t *type); /* Conversion functions */ H5_DLL herr_t H5T__conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 89cdcfd..9dae53b 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -144,7 +144,6 @@ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); /* Operations on named datatypes */ H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc); -H5_DLL htri_t H5T_committed(const H5T_t *type); H5_DLL int H5T_link(const H5T_t *type, int adjust); H5_DLL herr_t H5T_update_shared(H5T_t *type); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index ba31cd1..467847f 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -204,7 +204,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.vlen.read = H5T_vlen_seq_mem_read; dt->shared->u.vlen.write = H5T_vlen_seq_mem_write; dt->shared->u.vlen.setnull = H5T_vlen_seq_mem_setnull; - } /* end if */ + } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { /* size in memory, disk size is different */ dt->shared->size = sizeof(char *); @@ -216,9 +216,10 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.vlen.read = H5T_vlen_str_mem_read; dt->shared->u.vlen.write = H5T_vlen_str_mem_write; dt->shared->u.vlen.setnull = H5T_vlen_str_mem_setnull; - } /* end else-if */ - else + } + else { HDassert(0 && "Invalid VL type"); + } /* Reset file ID (since this VL is in memory) */ dt->shared->u.vlen.f = NULL; @@ -667,8 +668,7 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) */ static herr_t H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info, - void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, - size_t base_size) + void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { char *t; /* Pointer to temporary buffer allocated */ size_t len; /* Maximum length of the string to copy */ @@ -847,10 +847,11 @@ H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) UINT32DECODE(vl, hobjid.idx); /* Check if this sequence actually has any data */ - if(hobjid.addr > 0) + if(hobjid.addr > 0) { /* Read the VL information from disk */ if(NULL == H5HG_read(f, &hobjid, buf, NULL)) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -898,10 +899,11 @@ H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_all UINT32DECODE(bg, bg_hobjid.idx); /* Free heap object for old data */ - if(bg_hobjid.addr > 0) + if(bg_hobjid.addr > 0) { /* Free heap object */ if(H5HG_remove(f, &bg_hobjid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") + } } /* end if */ /* Set the length of the sequence */ @@ -1159,6 +1161,10 @@ done: * * Purpose: Alternative method to reclaim any VL data for a buffer element. * + * Use this function when the datatype is already available, but + * the allocation info is needed from the context before jumping + * into recursion. + * * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy @@ -1169,8 +1175,8 @@ done: herr_t 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 */ + H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ + herr_t ret_value = SUCCEED; /* return value */ HDassert(dt); HDassert(elem); diff --git a/src/H5Z.c b/src/H5Z.c index 14b0400..9dc358c 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -43,10 +43,10 @@ typedef struct H5Z_stats_t { #endif /* H5Z_DEBUG */ typedef struct H5Z_object_t { - H5Z_filter_t filter_id; /* ID of the filter we're looking for */ - htri_t found; /* Whether we find an object using the filter */ + H5Z_filter_t filter_id; /* ID of the filter we're looking for */ + htri_t found; /* Whether we find an object using the filter */ #ifdef H5_HAVE_PARALLEL - hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ + hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ #endif /* H5_HAVE_PARALLEL */ } H5Z_object_t; @@ -339,12 +339,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zunregister + * Function: H5Zunregister * - * Purpose: This function unregisters a filter. + * Purpose: This function unregisters a filter. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -371,13 +371,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__unregister + * Function: H5Z__unregister * - * Purpose: Same as the public version except this one allows filters - * to be unset for predefined method numbers found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -518,15 +522,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_dset_cb + * Function: H5Z__check_unregister_dset_cb + * + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -555,7 +561,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -567,27 +573,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__flush_file_cb + * Function: H5Z__flush_file_cb * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened files and flush them. + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened files and flush them. * - * Return: FALSE if finishes flushing and moves on - * FAIL if there is an error + * Return: NON-NEGATIVE if finishes flushing and moves on + * NEGATIVE if there is an error *------------------------------------------------------------------------- */ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { - H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ - H5Z_object_t *object = (H5Z_object_t *)key; - int ret_value = FALSE; /* Return value */ + H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ + H5Z_object_t *object = (H5Z_object_t *)key; + int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ - HDassert(f); - HDassert(object); + HDassert(obj_ptr); + HDassert(key); /* Do a global flush if the file is opened for write */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { @@ -817,11 +823,11 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* 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) { @@ -829,7 +835,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* 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) { @@ -846,12 +852,12 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* 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_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ATOM, 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") } } } @@ -1519,13 +1525,13 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* 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") - } /* end if */ + } /* Delete filter */ else { size_t idx; /* Index of filter in pipeline */ @@ -1568,7 +1574,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)); + HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); } /* end else */ done: @@ -1596,7 +1602,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) /* 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) diff --git a/src/H5detect.c b/src/H5detect.c index aac58de..4424009 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -150,12 +150,13 @@ static H5JMP_BUF jbuf_g; #endif + /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * - * Purpose: Determine the precision and offset. + * Purpose: Determine the precision and offset. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -163,22 +164,22 @@ precision (detected_t *d) { unsigned int n; - if (0 == d->msize) { + if(0 == d->msize) { /* * An integer. The permutation can have negative values at the * beginning or end which represent padding of bytes. We must adjust * the precision and offset accordingly. */ - if (d->perm[0] < 0) { + if(d->perm[0] < 0) { /* * Lower addresses are padded. */ - for (n = 0; n < d->size && d->perm[n] < 0; n++) + for(n = 0; n < d->size && d->perm[n] < 0; n++) /*void*/; d->precision = 8 * (d->size - n); d->offset = 0; } - else if (d->perm[d->size - 1] < 0) { + else if(d->perm[d->size - 1] < 0) { /* * Higher addresses are padded. */ @@ -202,18 +203,18 @@ precision (detected_t *d) } } - + /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * - * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * Purpose: These macro takes a type like `int' and a base name like + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * - * DETECT_I is used for types that are larger than one byte, - * DETECT_BYTE is used for types that are exactly one byte. + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void + * Return: void * * Modifications: * @@ -276,15 +277,15 @@ precision (detected_t *d) DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_F + * 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. + * 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) { \ @@ -373,15 +374,15 @@ precision (detected_t *d) } \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_M + * Function: DETECT_M * - * Purpose: This macro takes only miscellaneous structures or pointer - * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * Purpose: This macro takes only miscellaneous structures or pointer + * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It + * constructs the names and decides the alignment in structure. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ #define DETECT_M(TYPE,VAR,INFO) { \ @@ -449,15 +450,16 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigsegv_handler + * Function: sigsegv_handler * - * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -481,15 +483,16 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigbus_handler + * Function: sigbus_handler * - * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -513,15 +516,16 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * - * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -543,13 +547,13 @@ sigill_handler(int H5_ATTR_UNUSED signo) } #endif - + /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * - * Purpose: Prints information about the detected data types. + * Purpose: Prints information about the detected data types. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -696,7 +700,7 @@ H5T__init_native(void)\n\ d[i].precision); /*precision */ /*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */ - if (0 == d[i].msize) { + if(0 == d[i].msize) { /* The part unique to fixed point types */ fprintf(rawoutstream, "\ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n", @@ -822,13 +826,13 @@ done:\n\ fprintf(rawoutstream, "/* sigill_handler called: %d times */\n", sigill_handler_called_g); } /* end print_results() */ - + /*------------------------------------------------------------------------- - * Function: iprint + * Function: iprint * - * Purpose: Prints information about the fields of a floating point format. + * Purpose: Prints information about the fields of a floating point format. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ @@ -837,17 +841,17 @@ iprint(detected_t *d) { unsigned int pass; - for (pass = (d->size - 1) / 4; ; --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) { + for(i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { fprintf(rawoutstream, "%4d", d->perm[i]); - if (i > pass * 4) + if(i > pass * 4) HDfputs(" ", stdout); - if (!i) + if(!i) break; } @@ -855,24 +859,24 @@ iprint(detected_t *d) * Print the bit fields */ fprintf(rawoutstream, "\n * "); - for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, + 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 && d->msize) { + for(j = 8; j > 0; --j) { + if(k == d->sign && d->msize) { HDfputc('S', rawoutstream); } - else if (k >= d->epos && k < d->epos + d->esize) { + else if(k >= d->epos && k < d->epos + d->esize) { HDfputc('E', rawoutstream); } - else if (k >= d->mpos && k < d->mpos + d->msize) { + else if(k >= d->mpos && k < d->mpos + d->msize) { HDfputc('M', rawoutstream); } - else if (d->msize) { + else if(d->msize) { HDfputc('?', rawoutstream); /*unknown floating point bit */ } - else if (d->sign) { + else if(d->sign) { HDfputc('I', rawoutstream); } else { @@ -880,27 +884,30 @@ iprint(detected_t *d) } --k; } - if (i > pass * 4) HDfputc(' ', rawoutstream); - if (!i) break; + if(i > pass * 4) + HDfputc(' ', rawoutstream); + if(!i) + break; } HDfputc('\n', rawoutstream); - if (!pass) break; + if(!pass) + break; } /* * Is there an implicit bit in the mantissa. */ - if (d->msize) { + if(d->msize) { fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /* * Alignment */ - if (0 == d->align) { + if(0 == d->align) { fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n"); } - else if (1 == d->align) { + else if(1 == d->align) { fprintf(rawoutstream, " * Alignment: none\n"); } else { @@ -909,17 +916,17 @@ iprint(detected_t *d) } - + /*------------------------------------------------------------------------- - * Function: byte_cmp + * 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. + * 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. + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. *------------------------------------------------------------------------- */ static int @@ -936,17 +943,17 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) return -1; } - + /*------------------------------------------------------------------------- - * Function: bit_cmp + * 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. + * 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. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -959,14 +966,14 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, unsigned char *b = (unsigned char *) _b; unsigned char aa, bb; - for (i = 0; i < nbytes; i++) { + for(i = 0; i < nbytes; i++) { HDassert(perm[i] < (int) nbytes); - if ((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) + 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; + for(j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { + if((aa & 1) != (bb & 1)) return i * 8 + j; } fprintf(stderr, "INTERNAL ERROR"); HDabort(); @@ -977,19 +984,19 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, return 0; } - + /*------------------------------------------------------------------------- - * Function: fix_order + * 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. + * 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. + * This function assumes that the mantissa byte ordering + * implies the total ordering. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -997,28 +1004,28 @@ fix_order(int n, int last, int *perm, const char **mesg) { int i; - if (last > 1) { + if(last > 1) { /* * We have at least three points to consider. */ - if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + if(perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { /* * Little endian. */ - if (mesg) + if(mesg) *mesg = "Little-endian"; - for (i = 0; i < n; i++) + for(i = 0; i < n; i++) perm[i] = i; } - else if (perm[last] > perm[last - 1] + else if(perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { /* * Big endian. */ - if (mesg) + if(mesg) *mesg = "Big-endian"; - for (i = 0; i < n; i++) + for(i = 0; i < n; i++) perm[i] = (n - 1) - i; } @@ -1030,9 +1037,9 @@ fix_order(int n, int last, int *perm, const char **mesg) * case - JKM & QAK) */ HDassert(0 == n % 2); - if (mesg) + if(mesg) *mesg = "VAX"; - for (i = 0; i < n; i += 2) { + for(i = 0; i < n; i += 2) { perm[i] = (n - 2) - i; perm[i + 1] = (n - 1) - i; } @@ -1045,34 +1052,31 @@ fix_order(int n, int last, int *perm, const char **mesg) } } - + /*------------------------------------------------------------------------- - * 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. + * Function: imp_bit * - * 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. + * 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 + * 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. * - * Modifications: - * Fixed a bug that occurs with non-implicit architectures. + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -1102,7 +1106,7 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ return (a[perm[major]] >> minor) & 0x01 ? 0 : 1; } - + /*------------------------------------------------------------------------- * Function: find_bias * @@ -1111,10 +1115,6 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ * * Return: The exponent bias. * - * Modifications: - * Fixed a bug with non-implicit architectures returning the - * wrong exponent bias. - * *------------------------------------------------------------------------- */ H5_ATTR_PURE static unsigned int @@ -1124,7 +1124,7 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) unsigned char mask; unsigned int b, shift = 0, nbits, bias = 0; - while (esize > 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; @@ -1137,13 +1137,13 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) return bias; } - + /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * - * Purpose: Prints the C file header for the generated file. + * Purpose: Prints the C file header for the generated file. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -1210,8 +1210,8 @@ bit.\n"; { size_t n; char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { + if((pwd = HDgetpwuid(HDgetuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); HDstrncpy(real_name, pwd->pw_gecos, n); real_name[n] = '\0'; @@ -1221,9 +1221,8 @@ bit.\n"; real_name[sizeof(real_name) - 1] = '\0'; } } - else { + else real_name[0] = '\0'; - } } #else real_name[0] = '\0'; @@ -1233,7 +1232,7 @@ bit.\n"; * The FQDM of this host or the empty string. */ #ifdef H5_HAVE_GETHOSTNAME - if (HDgethostname(host_name, sizeof(host_name)) < 0) { + if(HDgethostname(host_name, sizeof(host_name)) < 0) { host_name[0] = '\0'; } #else @@ -1248,23 +1247,23 @@ bit.\n"; 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]) { + if(pwd || real_name[0] || host_name[0]) { fprintf(rawoutstream, " *\t\t\t"); - if (real_name[0]) + if(real_name[0]) fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, rawoutstream); + if(pwd) HDfputs(pwd->pw_name, rawoutstream); #endif - if (host_name[0]) + if(host_name[0]) fprintf(rawoutstream, "@%s", host_name); - if (real_name[0]) + if(real_name[0]) fprintf(rawoutstream, ">"); HDfputc('\n', rawoutstream); } fprintf(rawoutstream, " *\n * Purpose:\t\t"); - for (s = purpose; *s; s++) { + for(s = purpose; *s; s++) { HDfputc(*s, rawoutstream); - if ('\n' == *s && s[1]) + if('\n' == *s && s[1]) fprintf(rawoutstream, " *\t\t\t"); } @@ -1273,19 +1272,19 @@ bit.\n"; fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n"); fprintf(rawoutstream, " *\n *"); - for (i = 0; i < 73; i++) + for(i = 0; i < 73; i++) HDfputc('-', rawoutstream); fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- - * Function: detect_C89_integers + * Function: detect_C89_integers * - * Purpose: Detect C89 integer types + * Purpose: Detect C89 integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1301,13 +1300,13 @@ detect_C89_integers(void) DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * - * Purpose: Detect C89 floating point types + * Purpose: Detect C89 floating point types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1317,13 +1316,13 @@ detect_C89_floats(void) DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 + * Function: detect_C99_integers8 * - * Purpose: Detect C99 8 bit integer types + * Purpose: Detect C99 8 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1373,13 +1372,13 @@ detect_C99_integers8(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 + * Function: detect_C99_integers16 * - * Purpose: Detect C99 16 bit integer types + * Purpose: Detect C99 16 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1405,13 +1404,13 @@ detect_C99_integers16(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * - * Purpose: Detect C99 32 bit integer types + * Purpose: Detect C99 32 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1437,13 +1436,13 @@ detect_C99_integers32(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * - * Purpose: Detect C99 64 bit integer types + * Purpose: Detect C99 64 bit integer types * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -1483,13 +1482,13 @@ detect_C99_integers64(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers + * Function: detect_C99_integers * - * Purpose: Detect C99 integer types + * Purpose: Detect C99 integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1503,13 +1502,13 @@ detect_C99_integers(void) detect_C99_integers64(); } - + /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * - * Purpose: Detect C99 floating point types + * Purpose: Detect C99 floating point types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1528,13 +1527,13 @@ detect_C99_floats(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_alignments + * Function: detect_alignments * - * Purpose: Detect structure alignments + * Purpose: Detect structure alignments * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1570,9 +1569,9 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) volatile int nfailures = 0; volatile int nsuccesses = 0; - for (i=0;i0 || nsuccesses != ntries) { + if(nfailures>0 || nsuccesses != ntries) { fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " "Found %d failures and %d successes\n", signum, ntries, nfailures, nsuccesses); @@ -1605,13 +1604,13 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) } #endif - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * - * Return: Success: 0 + * Return: Success: EXIT_SUCCESS * * Modifications: * Some compilers, e.g., Intel C v7.0, took a long time to compile @@ -1628,17 +1627,16 @@ main(int argc, char *argv[]) FILE *f; /* temporary holding place for the stream pointer * so that rawoutstream is changed only when succeeded */ - if (argc > 1) { + if(argc > 1) fname = argv[1]; - } + /* First check if filename is string "NULL" */ - if (fname != NULL) { + if(fname != NULL) { /* binary output */ - if ((f = HDfopen(fname, "w")) != NULL) { + if((f = HDfopen(fname, "w")) != NULL) rawoutstream = f; - } } - if (!rawoutstream) + if(!rawoutstream) rawoutstream = stdout; #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) @@ -1650,7 +1648,7 @@ main(int argc, char *argv[]) int nvpairs[2]; nvpairs[0] = SSIN_UACPROC; nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; - if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { + if(setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); } @@ -1659,15 +1657,15 @@ main(int argc, char *argv[]) #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ - if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { + if(verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS); } - if (verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { + if(verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigsegv_handler", SIGSEGV); } - if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { + if(verify_signal_handlers(SIGILL, sigill_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL); } @@ -1694,8 +1692,8 @@ main(int argc, char *argv[]) print_results (nd_g, d_g, na_g, m_g); - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) fprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; @@ -1703,3 +1701,4 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; } + diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index d4caabb..da7c8d9 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -40,6 +40,7 @@ static const char *FileHeader = "\n\ FILE *rawoutstream = NULL; + /*------------------------------------------------------------------------- * Function: insert_libhdf5_settings * @@ -104,7 +105,7 @@ insert_libhdf5_settings(FILE *flibinfo) #endif } /* insert_libhdf5_settings() */ - + /*------------------------------------------------------------------------- * Function: make_libinfo * @@ -122,7 +123,7 @@ make_libinfo(void) insert_libhdf5_settings(rawoutstream); } - + /*------------------------------------------------------------------------- * Function: print_header * @@ -228,7 +229,7 @@ information about the library build configuration\n"; fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- * Function: print_footer * @@ -243,13 +244,13 @@ print_footer(void) /* nothing */ } - + /*------------------------------------------------------------------------- * Function: main * * Purpose: Main entry point. * - * Return: Success: 0 + * Return: Success: EXIT_SUCCESS *------------------------------------------------------------------------- */ int @@ -257,19 +258,19 @@ 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 */ + * so that rawoutstream is changed only when succeeded + */ - if (argc > 1) { + if(argc > 1) fname = argv[1]; - } + /* First check if filename is string "NULL" */ - if (fname != NULL) { + if(fname != NULL) { /* binary output */ - if ((f = HDfopen(fname, "w")) != NULL) { + if((f = HDfopen(fname, "w")) != NULL) rawoutstream = f; - } } - if (!rawoutstream) + if(!rawoutstream) rawoutstream = stdout; print_header(); @@ -279,8 +280,8 @@ main(int argc, char *argv[]) print_footer(); - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) fprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; @@ -288,3 +289,4 @@ main(int argc, char *argv[]) HDexit(EXIT_SUCCESS); } + diff --git a/src/Makefile.am b/src/Makefile.am index bc5c09e..472dfc6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -113,7 +113,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ H5Topaque.c \ H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ + H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c @@ -138,8 +139,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ - H5Rpublic.h H5Spublic.h \ - H5Tpublic.h H5Zpublic.h + H5Rpublic.h H5Spublic.h H5Tpublic.h \ + H5Zpublic.h # install libhdf5.settings in lib directory settingsdir=$(libdir) -- cgit v0.12 From 265652fe5466dc9e30d7bdf60a24a355852f0bfe Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 21 Sep 2018 12:12:05 -0700 Subject: Normalization with vol_integration (property lists, file drivers, other misc). --- src/H5FD.c | 978 +++++++++++++++++++++++--------------------- src/H5FDint.c | 167 ++++---- src/H5FDmpi.c | 2 +- src/H5FDpkg.h | 7 +- src/H5FDprivate.h | 8 +- src/H5FDspace.c | 15 +- src/H5FS.c | 68 +-- src/H5FScache.c | 11 +- src/H5FSpkg.h | 16 +- src/H5FSsection.c | 297 +++++++------- src/H5G.c | 27 +- src/H5Gint.c | 44 +- src/H5Glink.c | 2 +- src/H5Gloc.c | 163 ++++---- src/H5Gname.c | 46 ++- src/H5Gobj.c | 3 +- src/H5Goh.c | 4 +- src/H5Gstab.c | 24 +- src/H5I.c | 13 +- src/H5Iprivate.h | 1 - src/H5Lexternal.c | 58 +-- src/H5Ocopy.c | 56 ++- src/H5P.c | 134 +++--- src/H5Pacpl.c | 42 +- src/H5Pdapl.c | 16 +- src/H5Pdcpl.c | 46 +-- src/H5Pdeprec.c | 4 +- src/H5Pdxpl.c | 46 +-- src/H5Pencdec.c | 2 +- src/H5Pfapl.c | 258 ++++++------ src/H5Pfcpl.c | 31 +- src/H5Pfmpl.c | 2 +- src/H5Pgcpl.c | 16 +- src/H5Pint.c | 589 +++++++++++++------------- src/H5Plapl.c | 14 +- src/H5Plcpl.c | 20 +- src/H5Pocpl.c | 24 +- src/H5Pocpypl.c | 6 +- src/H5Ppkg.h | 44 +- src/H5Pprivate.h | 1 - src/H5Pstrcpl.c | 2 +- src/H5Ptest.c | 6 +- test/testfiles/err_compat_1 | 4 +- 43 files changed, 1647 insertions(+), 1670 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index d74ea31..5585f37 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -23,22 +23,22 @@ /* Module Setup */ /****************/ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -58,8 +58,8 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FD_free_cls(H5FD_class_t *cls); -static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/); +static herr_t H5FD__free_cls(H5FD_class_t *cls); +static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags/*out*/); /*********************/ /* Package Variables */ @@ -94,21 +94,20 @@ static unsigned long H5FD_file_serial_no_g; /* File driver ID class */ static const H5I_class_t H5I_VFL_CLS[1] = {{ - H5I_VFL, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5FD_free_cls /* Callback routine for closing objects of this class */ + H5I_VFL, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5FD__free_cls /* Callback routine for closing objects of this class */ }}; /*------------------------------------------------------------------------- - * Function: H5FD__init_package + * Function: H5FD__init_package * - * Purpose: Initialize the virtual file layer. + * Purpose: Initialize the virtual file layer. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -131,16 +130,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_term_package + * Function: H5FD_term_package + * + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Return: Success: Positive if anything was done that might + * have affected other interfaces; zero + * otherwise. * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; zero - * otherwise. - * Failure: Never fails. + * Failure: Never fails. * *------------------------------------------------------------------------- */ @@ -171,26 +171,24 @@ H5FD_term_package(void) /*------------------------------------------------------------------------- - * Function: H5FD_free_cls + * Function: H5FD__free_cls * - * Purpose: Frees a file driver class struct and returns an indication of - * success. This function is used as the free callback for the - * virtual file layer object identifiers (cf H5FD__init_package). - * - * Return: Success: Non-negative + * Purpose: Frees a file driver class struct and returns an indication of + * success. This function is used as the free callback for the + * virtual file layer object identifiers (cf H5FD__init_package). * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5FD_free_cls(H5FD_class_t *cls) +H5FD__free_cls(H5FD_class_t *cls) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - /* Sanity check */ + /* Sanity checks */ HDassert(cls); /* If the file driver has a terminate callback, call it to give the file @@ -219,37 +217,37 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5FDregister(const H5FD_class_t *cls) { - hid_t ret_value; - H5FD_mem_t type; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", cls); /* Check arguments */ if(!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null class pointer is disallowed") if(!cls->open || !cls->close) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'open' and/or 'close' methods are not defined") if(!cls->get_eoa || !cls->set_eoa) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eoa' and/or 'set_eoa' methods are not defined") if(!cls->get_eof) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`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, FAIL, "`read' and/or `write' method is not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'read' and/or 'write' method is not defined") for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "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_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: FUNC_LEAVE_API(ret_value) @@ -268,7 +266,7 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -276,34 +274,35 @@ hid_t H5FD_register(const void *_cls, size_t size, hbool_t app_ref) { const H5FD_class_t *cls = (const H5FD_class_t *)_cls; - H5FD_class_t *saved = NULL; - H5FD_mem_t type; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5FD_class_t *saved = NULL; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) - /* Check arguments */ + /* 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); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { HDassert(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, FAIL, "memory allocation failed for file driver class struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for file driver class struct") HDmemcpy(saved, cls, size); /* Create the new class ID */ if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(saved) - H5MM_xfree(saved); + saved = (H5FD_class_t *)H5MM_xfree(saved); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_register() */ @@ -317,9 +316,7 @@ done: * this driver or files which are already opened under this * driver. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -333,11 +330,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) @@ -345,19 +342,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_class + * Function: H5FD_get_class * - * Purpose: Obtains a pointer to the driver struct containing all the - * callback pointers, etc. The PLIST_ID argument can be a file - * access property list, a data transfer property list, or a - * file driver identifier. + * Purpose: Obtains a pointer to the driver struct containing all the + * callback pointers, etc. The PLIST_ID argument can be a file + * access property list, a data transfer property list, or a + * file driver identifier. * - * Return: Success: Ptr to the driver information. The pointer is - * only valid as long as the driver remains - * registered or some file or property list - * exists which references the driver. + * Return: Success: Ptr to the driver information. The pointer is + * only valid as long as the driver remains + * registered or some file or property list + * exists which references the driver. * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -369,7 +366,7 @@ H5FD_get_class(hid_t id) FUNC_ENTER_NOAPI(NULL) if(H5I_VFL == H5I_get_type(id)) - ret_value = (H5FD_class_t *)H5I_object(id); + ret_value = (H5FD_class_t *)H5I_object(id); else { H5P_genplist_t *plist; /* Property list pointer */ @@ -394,29 +391,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_size + * Function: H5FD_sb_size * - * Purpose: Obtains the number of bytes required to store the driver file - * access data in the HDF5 superblock. + * Purpose: Obtains the number of bytes required to store the driver file + * access data in the HDF5 superblock. * - * Return: Success: Number of bytes required. + * Return: Success: Number of bytes required. May be zero if the + * driver has no data to store in the superblock. * - * Failure: 0 if an error occurs or if the driver has no - * data to store in the superblock. + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ hsize_t H5FD_sb_size(H5FD_t *file) { - hsize_t ret_value=0; + hsize_t ret_value = 0; FUNC_ENTER_NOAPI(0) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->sb_size) - ret_value = (file->cls->sb_size)(file); + ret_value = (file->cls->sb_size)(file); done: FUNC_LEAVE_NOAPI(ret_value) @@ -424,31 +424,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_encode + * Function: H5FD_sb_encode * - * Purpose: Encode driver-specific data into the output arguments. The - * NAME is a nine-byte buffer which should get an - * eight-character driver name and/or version followed by a null - * terminator. The BUF argument is a buffer to receive the - * encoded driver-specific data. The size of the BUF array is - * the size returned by the H5FD_sb_size() call. + * Purpose: Encode driver-specific data into the output arguments. The + * NAME is a nine-byte buffer which should get an + * eight-character driver name and/or version followed by a null + * terminator. The BUF argument is a buffer to receive the + * encoded driver-specific data. The size of the BUF array is + * the size returned by the H5FD_sb_size() call. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(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) @@ -456,12 +458,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__sb_decode + * Function: H5FD__sb_decode * - * Purpose: Decodes the driver information block. + * Purpose: Decodes the driver information block. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -472,11 +473,13 @@ H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_STATIC - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); - /* Decode driver information */ + /* 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) @@ -484,12 +487,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_load + * Function: H5FD_sb_load * - * Purpose: Validate and decode the driver information block. + * Purpose: Validate and decode the driver information block. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -500,7 +502,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(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. @@ -520,37 +524,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_get + * Function: H5FD_fapl_get + * + * Purpose: Gets the file access property list associated with a file. + * Usually the file will copy what it needs from the original + * file access property list when the file is created. The + * purpose of this function is to create a new file access + * property list based on the settings in the file, which may + * have been modified from the original file access property + * list. * - * Purpose: Gets the file access property list associated with a file. - * Usually the file will copy what it needs from the original - * file access property list when the file is created. The - * purpose of this function is to create a new file access - * property list based on the settings in the file, which may - * have been modified from the original file access property - * list. + * Return: Success: Pointer to a new file access property list + * with all members copied. If the file is + * closed then this property list lives on, and + * vice versa. * - * Return: Success: Pointer to a new file access property list - * with all members copied. If the file is - * closed then this property list lives on, and - * vice versa. + * This can be NULL if the file has no properties. * - * Failure: NULL, including when the file has no - * properties. + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ void * H5FD_fapl_get(H5FD_t *file) { - void *ret_value=NULL; + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) + /* Sanity checks */ HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->fapl_get) - ret_value = (file->cls->fapl_get)(file); + ret_value = (file->cls->fapl_get)(file); done: FUNC_LEAVE_NOAPI(ret_value) @@ -558,12 +566,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_close + * Function: H5FD_fapl_close * - * Purpose: Closes a driver for a dataset transfer property list + * Purpose: Closes a driver for a dataset transfer property list * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -574,7 +581,6 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) FUNC_ENTER_NOAPI(FAIL) - /* Check args */ if(driver_id > 0) { H5FD_class_t *driver; @@ -589,7 +595,7 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") } /* end if */ else - H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ + driver_info = H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ } /* end if */ } /* end if */ @@ -599,59 +605,59 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDopen + * Function: H5FDopen * - * Purpose: Opens a file named NAME for the type(s) of access described - * by the bit vector FLAGS according to a file access property - * list FAPL_ID (which may be the constant H5P_DEFAULT). The - * file should expect to handle format addresses in the range [0, - * MAXADDR] (if MAXADDR is the undefined address then the caller - * doesn't care about the address range). + * Purpose: Opens a file named NAME for the type(s) of access described + * by the bit vector FLAGS according to a file access property + * list FAPL_ID (which may be the constant H5P_DEFAULT). The + * file should expect to handle format addresses in the range [0, + * MAXADDR] (if MAXADDR is the undefined address then the caller + * doesn't care about the address range). * - * Possible values for the FLAGS bits are: + * Possible values for the FLAGS bits are: * - * H5F_ACC_RDWR: Open the file for read and write access. If - * this bit is not set then open the file for - * read only access. It is permissible to open a - * file for read and write access when only read - * access is requested by the library (the - * library will never attempt to write to a file - * which it opened with only read access). + * H5F_ACC_RDWR: Open the file for read and write access. If + * this bit is not set then open the file for + * read only access. It is permissible to open a + * file for read and write access when only read + * access is requested by the library (the + * library will never attempt to write to a file + * which it opened with only read access). * - * H5F_ACC_CREATE: Create the file if it doesn't already exist. - * However, see H5F_ACC_EXCL below. + * H5F_ACC_CREATE: Create the file if it doesn't already exist. + * However, see H5F_ACC_EXCL below. * - * H5F_ACC_TRUNC: Truncate the file if it already exists. This - * is equivalent to deleting the file and then - * creating a new empty file. + * H5F_ACC_TRUNC: Truncate the file if it already exists. This + * is equivalent to deleting the file and then + * creating a new empty file. * - * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file - * already exists then the open should fail. - * Note that this is unsupported/broken with - * some file drivers (e.g., sec2 across nfs) and - * will contain a race condition when used to - * perform file locking. + * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file + * already exists then the open should fail. + * Note that this is unsupported/broken with + * some file drivers (e.g., sec2 across nfs) and + * will contain a race condition when used to + * perform file locking. * - * The MAXADDR is the maximum address which will be requested by - * the library during an allocation operation. Usually this is - * the same value as the MAXADDR field of the class structure, - * but it can be smaller if the driver is being used under some - * other driver. + * The MAXADDR is the maximum address which will be requested by + * the library during an allocation operation. Usually this is + * the same value as the MAXADDR field of the class structure, + * but it can be smaller if the driver is being used under some + * other driver. * - * Note that when the driver `open' callback gets control that - * the public part of the file struct (the H5FD_t part) will be - * incomplete and will be filled in after that callback returns. + * Note that when the driver 'open' callback gets control that + * the public part of the file struct (the H5FD_t part) will be + * incomplete and will be filled in after that callback returns. * - * Return: Success: Pointer to a new file driver struct. + * Return: Success: Pointer to a new file driver struct. * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ H5FD_t * H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_t *ret_value=NULL; + H5FD_t *ret_value = NULL; FUNC_ENTER_API(NULL) H5TRACE4("*x", "*sIuia", name, flags, fapl_id, maxaddr); @@ -660,11 +666,12 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else - if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS)) + if(TRUE != H5P_isa_class(fapl_id,H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") + /* 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") done: FUNC_LEAVE_API(ret_value) @@ -672,13 +679,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_open + * Function: H5FD_open * - * Purpose: Private version of H5FDopen() + * Purpose: Private version of H5FDopen() * - * Return: Success: Pointer to a new file driver struct + * Return: Success: Pointer to a new file driver struct * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -695,9 +702,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) FUNC_ENTER_NOAPI(NULL) - /* Sanity check */ + /* 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))) @@ -709,9 +716,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* 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) @@ -731,13 +738,12 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) 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; - /* - * Fill in public fields. We must increment the reference count on the + /* Fill in public fields. We must increment the reference count on the * driver ID to prevent it from being freed while this file is open. */ file->driver_id = driver_prop.driver_id; @@ -751,7 +757,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment") /* Retrieve the VFL driver feature flags */ - if(H5FD_query(file, &(file->feature_flags)) < 0) + if(H5FD__query(file, &(file->feature_flags)) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") /* Increment the global serial number & assign it to this H5FD_t object */ @@ -775,32 +781,35 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDclose + * Function: H5FDclose * - * Purpose: Closes the file by calling the driver `close' callback, which - * should free all driver-private data and free the file struct. - * Note that the public part of the file struct (the H5FD_t part) - * will be all zero during the driver close callback like during - * the `open' callback. + * Purpose: Closes the file by calling the driver 'close' callback, which + * should free all driver-private data and free the file struct. + * Note that the public part of the file struct (the H5FD_t part) + * will be all zero during the driver close callback like during + * the 'open' callback. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FDclose(H5FD_t *file) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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") + /* 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) @@ -808,12 +817,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_close + * Function: H5FD_close * - * Purpose: Private version of H5FDclose() + * Purpose: Private version of H5FDclose() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -825,16 +833,16 @@ H5FD_close(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - /* check args */ - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(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") - /* - * Dispatch to the driver for actual close. If the driver fails to + /* 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); @@ -847,47 +855,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDcmp + * Function: H5FDcmp * - * Purpose: Compare the keys of two files using the file driver callback - * if the files belong to the same driver, otherwise sort the - * files by driver class pointer value. + * Purpose: Compare the keys of two files using the file driver callback + * if the files belong to the same driver, otherwise sort the + * files by driver class pointer value. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: Must never fail. If both file handles are - * invalid then they compare equal. If one file - * handle is invalid then it compares less than - * the other. If both files belong to the same - * driver and the driver doesn't provide a - * comparison callback then the file pointers - * themselves are compared. + * Failure: Must never fail. If both file handles are + * invalid then they compare equal. If one file + * handle is invalid then it compares less than + * the other. If both files belong to the same + * driver and the driver doesn't provide a + * comparison callback then the file pointers + * themselves are compared. * *------------------------------------------------------------------------- */ int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2) { - int ret_value; + int ret_value = -1; - FUNC_ENTER_API(-1) /*return value is arbitrary*/ + FUNC_ENTER_API(-1) /* return value is arbitrary */ H5TRACE2("Is", "*x*x", f1, f2); + /* Call private function */ ret_value = H5FD_cmp(f1, f2); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5FDcmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_cmp + * Function: H5FD_cmp * - * Purpose: Private version of H5FDcmp() + * Purpose: Private version of H5FDcmp() * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: Must never fail. + * Failure: Must never fail. * *------------------------------------------------------------------------- */ @@ -896,7 +905,7 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(-1) /*return value is arbitrary*/ + FUNC_ENTER_NOAPI(-1) /* return value is arbitrary */ if((!f1 || !f1->cls) && (!f2 || !f2->cls)) HGOTO_DONE(0) @@ -911,43 +920,50 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) /* Files are same driver; no cmp callback */ if(!f1->cls->cmp) { - if(f1f2) + if(f1 > f2) HGOTO_DONE(1) - HGOTO_DONE(0) + HGOTO_DONE(0) } + /* Dispatch to driver */ ret_value = (f1->cls->cmp)(f1, f2); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FDquery - * - * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h) + * Function: H5FDquery * - * Return: Success: non-negative + * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h) * - * Failure: negative + * Return: Success: 0 + * Failure: -1 * *------------------------------------------------------------------------- */ int -H5FDquery(const H5FD_t *f, unsigned long *flags/*out*/) +H5FDquery(const H5FD_t *file, unsigned long *flags/*out*/) { - int ret_value; + int ret_value = 0; - FUNC_ENTER_API(FAIL) - H5TRACE2("Is", "*xx", f, flags); + FUNC_ENTER_API((-1)) + H5TRACE2("Is", "*xx", file, flags); - HDassert(f); - HDassert(flags); + /* Check arguments */ + if(!file) + 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") + if(!flags) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "flags parameter cannot be NULL") - ret_value = H5FD_query(f, flags); + /* Call private function */ + if(H5FD__query(file, flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "unable to query feature flags") done: FUNC_LEAVE_API(ret_value) @@ -955,69 +971,72 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_query - * - * Purpose: Private version of H5FDquery() + * Function: H5FD_query * - * Return: Success: non-negative + * Purpose: Private version of H5FDquery() * - * Failure: negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/) +static herr_t +H5FD__query(const H5FD_t *file, unsigned long *flags/*out*/) { - int ret_value = 0; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC - HDassert(f); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); HDassert(flags); - /* Check for query driver and call it */ - if(f->cls->query) - ret_value = (f->cls->query)(f, 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") + } else *flags=0; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_query() */ /*------------------------------------------------------------------------- - * Function: H5FDalloc + * Function: H5FDalloc * - * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will - * be used according to the allocation class TYPE. First we try - * to satisfy the request from one of the free lists, according - * to the free list map provided by the driver. The free list - * array has one entry for each request type and the value of - * that array element can be one of four possibilities: + * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will + * be used according to the allocation class TYPE. First we try + * to satisfy the request from one of the free lists, according + * to the free list map provided by the driver. The free list + * array has one entry for each request type and the value of + * that array element can be one of four possibilities: * - * It can be the constant H5FD_MEM_DEFAULT (or zero) which - * indicates that the identity mapping is used. In other - * words, the request type maps to its own free list. + * It can be the constant H5FD_MEM_DEFAULT (or zero) which + * indicates that the identity mapping is used. In other + * words, the request type maps to its own free list. * - * It can be the request type itself, which has the same - * effect as the H5FD_MEM_DEFAULT value above. + * It can be the request type itself, which has the same + * effect as the H5FD_MEM_DEFAULT value above. * - * It can be the ID for another request type, which - * indicates that the free list for the specified type - * should be used instead. + * It can be the ID for another request type, which + * indicates that the free list for the specified type + * should be used instead. * - * It can be the constant H5FD_MEM_NOLIST which means that - * no free list should be used for this type of request. + * It can be the constant H5FD_MEM_NOLIST which means that + * no free list should be used for this type of request. * - * If the request cannot be satisfied from a free list then - * either the driver's `alloc' callback is invoked (if one was - * supplied) or the end-of-address marker is extended. The - * `alloc' callback is always called with the same arguments as - * the H5FDalloc(). + * If the request cannot be satisfied from a free list then + * either the driver's 'alloc' callback is invoked (if one was + * supplied) or the end-of-address marker is extended. The + * 'alloc' callback is always called with the same arguments as + * the H5FDalloc(). * - * Return: Success: The format address of the new file memory. + * Return: Success: The format address of the new file memory. * - * Failure: The undefined address HADDR_UNDEF + * Failure: The undefined address HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1029,13 +1048,15 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) FUNC_ENTER_API(HADDR_UNDEF) H5TRACE4("a", "*xMtih", file, type, dxpl_id, size); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + /* Check arguments */ + if(!file) + 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") 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 @@ -1045,9 +1066,9 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* 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; @@ -1058,32 +1079,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDfree + * Function: H5FDfree * - * Purpose: Frees format addresses starting with ADDR and continuing for - * SIZE bytes in the file FILE. The type of space being freed is - * specified by TYPE, which is mapped to a free list as - * described for the H5FDalloc() function above. If the request - * doesn't map to a free list then either the application `free' - * callback is invoked (if defined) or the memory is leaked. - * - * Return: Success: Non-negative + * Purpose: Frees format addresses starting with ADDR and continuing for + * SIZE bytes in the file FILE. The type of space being freed is + * specified by TYPE, which is mapped to a free list as + * described for the H5FDalloc() function above. If the request + * doesn't map to a free list then either the application 'free' + * callback is invoked (if defined) or the memory is leaked. * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xMtiah", file, type, dxpl_id, addr, size); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type") if(H5P_DEFAULT == dxpl_id) @@ -1095,9 +1116,9 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if(H5FD_free_real(file, type, addr - file->base_addr, size) < 0) + if(H5FD__free_real(file, type, addr - file->base_addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed") done: @@ -1124,13 +1145,15 @@ H5FDget_eoa(H5FD_t *file, H5FD_mem_t type) FUNC_ENTER_API(HADDR_UNDEF) H5TRACE2("a", "*xMt", file, type); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + /* Check arguments */ + if(!file) + 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") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") - /* The real work */ + /* 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") @@ -1171,15 +1194,17 @@ H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xMta", file, type, addr); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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(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") - /* The real work */ + /* 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") @@ -1190,23 +1215,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDget_eof + * Function: H5FDget_eof * - * Purpose: Returns the end-of-file address, which is the greater of the - * end-of-format address and the actual EOF marker. This - * function is called after an existing file is opened in order - * for the library to learn the true size of the underlying file - * and to determine whether the hdf5 data has been truncated. + * Purpose: Returns the end-of-file address, which is the greater of the + * end-of-format address and the actual EOF marker. This + * function is called after an existing file is opened in order + * for the library to learn the true size of the underlying file + * and to determine whether the hdf5 data has been truncated. * - * It is also used when a file is first opened to learn whether - * the file is empty or not. + * It is also used when a file is first opened to learn whether + * the file is empty or not. * - * It is permissible for the driver to return the maximum address - * for the file size if the file is not empty. + * It is permissible for the driver to return the maximum address + * for the file size if the file is not empty. * - * Return: Success: The EOF address. + * Return: Success: The EOF address. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1219,10 +1244,12 @@ H5FDget_eof(H5FD_t *file, H5FD_mem_t type) H5TRACE2("a", "*xMt", file, type); /* Check arguments */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + if(!file) + 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") - /* The real work */ + /* 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") @@ -1235,12 +1262,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_maxaddr + * Function: H5FD_get_maxaddr * - * Purpose: Private version of H5FDget_eof() + * Purpose: Private version of H5FDget_eof() * - * Return: Success: The maximum address allowed in the file. - * Failure: HADDR_UNDEF + * Return: Success: The maximum address allowed in the file. + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1251,6 +1278,7 @@ H5FD_get_maxaddr(const H5FD_t *file) FUNC_ENTER_NOAPI(HADDR_UNDEF) + /* Sanity checks */ HDassert(file); /* Set return value */ @@ -1262,12 +1290,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_feature_flags + * Function: H5FD_get_feature_flags * - * Purpose: Retrieve the feature flags for the VFD + * Purpose: Retrieve the feature flags for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1276,6 +1303,7 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(feature_flags); @@ -1287,12 +1315,11 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) /*------------------------------------------------------------------------- - * Function: H5FD_set_feature_flags + * Function: H5FD_set_feature_flags * - * Purpose: Set the feature flags for the VFD + * Purpose: Set the feature flags for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1301,6 +1328,7 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Set the file's feature flags */ @@ -1311,12 +1339,11 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) /*------------------------------------------------------------------------- - * Function: H5FD_get_fs_type_map + * Function: H5FD_get_fs_type_map * - * Purpose: Retrieve the free space type mapping for the VFD + * Purpose: Retrieve the free space type mapping for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1327,8 +1354,9 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) FUNC_ENTER_NOAPI(FAIL) - /* Sanity check */ - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); HDassert(type_map); /* Check for VFD class providing a type map retrieval rouine */ @@ -1347,18 +1375,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDread + * Function: H5FDread * - * Purpose: Reads SIZE bytes from FILE beginning at address ADDR - * according to the data transfer property list DXPL_ID (which may - * be the constant H5P_DEFAULT). The result is written into the - * buffer BUF. + * Purpose: Reads SIZE bytes from FILE beginning at address ADDR + * according to the data transfer property list DXPL_ID (which may + * be the constant H5P_DEFAULT). The result is written into the + * buffer BUF. * - * Return: Success: Non-negative. The read result is written into - * the BUF buffer which should be allocated by - * the caller. + * Return: Success: SUCCEED + * The read result is written into the BUF buffer + * which should be allocated by the caller. * - * Failure: Negative. The contents of BUF is undefined. + * Failure: FAIL + * The contents of BUF are undefined. * *------------------------------------------------------------------------- */ @@ -1366,14 +1395,18 @@ herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiazx", file, type, dxpl_id, addr, size, buf); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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(!buf) + 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) @@ -1381,16 +1414,14 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - if(!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* 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) @@ -1398,16 +1429,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDwrite + * Function: H5FDwrite * - * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according - * to the data transfer property list DXPL_ID (which may be the - * constant H5P_DEFAULT). The bytes to be written come from the - * buffer BUF. - * - * Return: Success: Non-negative + * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according + * to the data transfer property list DXPL_ID (which may be the + * constant H5P_DEFAULT). The bytes to be written come from the + * buffer BUF. * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1415,30 +1444,33 @@ herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiaz*x", file, type, dxpl_id, addr, size, buf); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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(!buf) + 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") - if(!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* The real work */ + /* 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) @@ -1446,17 +1478,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDflush - * - * Purpose: Notify driver to flush all cached data. If the driver has no - * flush method then nothing happens. - * - * Return: Success: Non-negative + * Function: H5FDflush * - * Failure: Negative + * Purpose: Notify driver to flush all cached data. If the driver has no + * flush method then nothing happens. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1468,9 +1495,12 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1480,9 +1510,9 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* 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) @@ -1490,12 +1520,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_flush + * Function: H5FD_flush * - * Purpose: Private version of H5FDflush() + * Purpose: Private version of H5FDflush() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1507,8 +1536,10 @@ H5FD_flush(H5FD_t *file, hbool_t closing) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(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") @@ -1518,12 +1549,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDtruncate + * Function: H5FDtruncate * - * Purpose: Notify driver to truncate the file back to the allocated size. + * Purpose: Notify driver to truncate the file back to the allocated size. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1535,9 +1565,11 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1547,9 +1579,9 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* 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) @@ -1559,22 +1591,22 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_truncate * - * Purpose: Private version of H5FDtruncate() + * Purpose: Private version of H5FDtruncate() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_truncate(H5FD_t *file, hbool_t closing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); /* Dispatch to driver */ if(file->cls->truncate && (file->cls->truncate)(file, H5CX_get_dxpl(), closing) < 0) @@ -1586,12 +1618,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDlock + * Function: H5FDlock * - * Purpose: Set a file lock + * Purpose: Set a file lock * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1603,13 +1634,15 @@ H5FDlock(H5FD_t *file, hbool_t rw) FUNC_ENTER_API(FAIL) H5TRACE2("e", "*xb", file, rw); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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") - /* The real work */ + /* Call private function */ if(H5FD_lock(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1618,12 +1651,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_lock + * Function: H5FD_lock * - * Purpose: Private version of H5FDlock() + * Purpose: Private version of H5FDlock() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1634,8 +1666,11 @@ H5FD_lock(H5FD_t *file, hbool_t rw) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->lock && (file->cls->lock)(file, rw) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed") @@ -1645,12 +1680,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDunlock + * Function: H5FDunlock * - * Purpose: Remove a file lock + * Purpose: Remove a file lock * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1662,13 +1696,15 @@ H5FDunlock(H5FD_t *file) FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* 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") - /* The real work */ + /* Call private function */ if(H5FD_unlock(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1676,12 +1712,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_unlock + * Function: H5FD_unlock * - * Purpose: Private version of H5FDunlock() + * Purpose: Private version of H5FDunlock() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1692,8 +1727,11 @@ H5FD_unlock(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->unlock && (file->cls->unlock)(file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed") @@ -1703,13 +1741,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_fileno + * Function: H5FD_get_fileno * - * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value - * (Mainly added to stop non-file routines from poking about in the - * H5FD_t data structure) + * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value + * (Mainly added to stop non-file routines from poking about in the + * H5FD_t data structure) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1718,6 +1756,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(filenum); @@ -1734,28 +1773,36 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) * Purpose: Returns a pointer to the file handle of low-level virtual * file driver. * - * Return: Non-negative if succeed; negative otherwise. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 + * Return: SUCCEED/FAIL * *-------------------------------------------------------------------------- */ herr_t -H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle) +H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) { - herr_t ret_value; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*xi**x", file, fapl, file_handle); + H5TRACE3("e", "*xi**x", file, fapl_id, file_handle); /* Check arguments */ - HDassert(file); - HDassert(file_handle); - - ret_value = H5FD_get_vfd_handle(file, fapl, file_handle); + 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(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") + if(!file_handle) + 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") done: + if(FAIL == ret_value) + *file_handle = NULL; + FUNC_LEAVE_API(ret_value) } /* end H5FDget_vfd_handle() */ @@ -1763,29 +1810,28 @@ done: /*-------------------------------------------------------------------------- * Function: H5FD_get_vfd_handle * - * Purpose: Retrieve the file handle for file driver. + * Purpose: Private version of H5FDget_vfd_handle() * - * Return: Non-negative if succeed; negative if fails. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 + * Return: SUCCEED/FAIL * *-------------------------------------------------------------------------- */ herr_t -H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle) +H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - /* Sanity check */ + /* Sanity checks */ HDassert(file); + HDassert(file->cls); HDassert(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") - if((file->cls->get_handle)(file, fapl, file_handle) < 0) + 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") done: @@ -1798,7 +1844,7 @@ done: * * Purpose: Set the base address for the file * - * Return: Non-negative if succeed; negative if fails. + * Return: SUCCEED (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1807,6 +1853,7 @@ 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)); @@ -1822,8 +1869,8 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr) * * Purpose: Get the base address for the file * - * Return: Success: The absolute base address of the file - * Failure: The undefined address (HADDR_UNDEF) + * Return: Success: The absolute base address of the file + * (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1832,6 +1879,7 @@ H5FD_get_base_addr(const H5FD_t *file) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Return the file's base address */ @@ -1844,7 +1892,7 @@ H5FD_get_base_addr(const H5FD_t *file) * * Purpose: Set "paged_aggr" for the file. * - * Return: Non-negative if succeed; negative if fails. + * Return: SUCCEED (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1853,6 +1901,7 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Indicate whether paged aggregation for handling file space is enabled or not */ @@ -1883,6 +1932,7 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", driver_id, flags); + /* Check arguments */ if(NULL == flags) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL") diff --git a/src/H5FDint.c b/src/H5FDint.c index 023ff57..ea8c4d8 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FDint.c - * Jan 17 2008 - * Quincey Koziol + * Created: H5FDint.c * - * Purpose: Internal routine for VFD operations + * Purpose: Internal routine for VFD operations * *------------------------------------------------------------------------- */ @@ -32,12 +30,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ /****************/ @@ -83,26 +81,26 @@ * signature can appear at address 0, or any power of two * beginning with 512. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) { - haddr_t addr, eoa, eof; + haddr_t addr = HADDR_UNDEF; + haddr_t eoa = HADDR_UNDEF; + haddr_t eof = HADDR_UNDEF; uint8_t buf[H5F_SIGNATURE_LEN]; - unsigned n, maxpow; + unsigned n; + unsigned maxpow; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ HDassert(file); + HDassert(sig_addr); /* Find the least N such that 2^N is larger than the file size */ eof = H5FD_get_eof(file, H5FD_MEM_SUPER); @@ -114,8 +112,7 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) addr >>= 1; maxpow = MAX(maxpow, 9); - /* - * Search for the file signature at format address zero followed by + /* Search for the file signature at format address zero followed by * powers of two larger than 9. */ for(n = 8; n < maxpow; n++) { @@ -126,17 +123,16 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature") if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) break; - } /* end for */ + } - /* - * If the signature was not found then reset the EOA value and return + /* If the signature was not found then reset the EOA value and return * HADDR_UNDEF. */ 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") *sig_addr = HADDR_UNDEF; - } /* end if */ + } else /* Set return value */ *sig_addr = addr; @@ -147,44 +143,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_read - * - * Purpose: Private version of H5FDread() + * Function: H5FD_read * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDread() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/) +H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { - hid_t dxpl_id; /* DXPL for operation */ - herr_t ret_value = SUCCEED; /* Return value */ + 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 && file->cls); + HDassert(file); + HDassert(file->cls); HDassert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); #ifndef H5_HAVE_PARALLEL - /* Do not return early for Parallel mode since the I/O could be a */ - /* collective transfer. */ - /* The no-op case */ + /* The no-op case + * + * Do not return early for Parallel mode since the I/O could be a + * collective transfer. + */ if(0 == size) HGOTO_DONE(SUCCEED) #endif /* H5_HAVE_PARALLEL */ - /* - * If the file is open for SWMR read access, allow access to data past + /* If the file is open for SWMR read access, allow access to data past * the end of the allocated space (the 'eoa'). This is done because the * eoa stored in the file's superblock might be out of sync with the * objects being written within the file by the application performing @@ -198,7 +191,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, 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) - } /* end if */ + } /* Dispatch to driver */ if((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0) @@ -210,45 +203,43 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_write - * - * Purpose: Private version of H5FDwrite() + * Function: H5FD_write * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDwrite() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf) +H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { - hid_t dxpl_id; /* DXPL for operation */ - haddr_t eoa = HADDR_UNDEF; /* EOA for file */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t dxpl_id; /* DXPL for operation */ + haddr_t eoa = HADDR_UNDEF; /* EOA for file */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); HDassert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); #ifndef H5_HAVE_PARALLEL - /* Do not return early for Parallel mode since the I/O could be a */ - /* collective transfer. */ - /* The no-op case */ + /* The no-op case + * + * Do not return early for Parallel mode since the I/O could be a + * collective transfer. + */ if(0 == size) 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) @@ -263,20 +254,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_set_eoa + * Function: H5FD_set_eoa * - * Purpose: Private version of H5FDset_eoa() + * Purpose: Private version of H5FDset_eoa() * * This function expects the EOA is a RELATIVE address, i.e. * relative to the base address. This is NOT the same as the * EOA stored in the superblock, which is an absolute * address. Object addresses are relative. * - * Return: Success: Non-negative - * Failure: Negative, no side effect - * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -292,7 +279,7 @@ H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) /* 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) @@ -300,20 +287,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_eoa + * Function: H5FD_get_eoa * - * Purpose: Private version of H5FDget_eoa() + * Purpose: Private version of H5FDget_eoa() * * This function returns the EOA as a RELATIVE address, i.e. * relative to the base address. This is NOT the same as the * EOA stored in the superblock, which is an absolute * address. Object addresses are relative. * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF + * Return: Success: First byte after allocated memory * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -328,7 +313,7 @@ H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) /* 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; @@ -339,23 +324,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_eof + * Function: H5FD_get_eof * - * Purpose: Private version of H5FDget_eof() + * Purpose: Private version of H5FDget_eof() * * This function returns the EOF as a RELATIVE address, i.e. * relative to the base address. This will be different * from the end of the physical file if there is a user * block. * - * Return: Success: The EOF address. + * Return: Success: The EOF address. * - * Failure: HADDR_UNDEF - * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * - * Modifications: + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -370,11 +350,11 @@ H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type) /* 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") - } /* end if */ + if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed") + } else - ret_value = file->maxaddr; + ret_value = file->maxaddr; /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; @@ -385,17 +365,14 @@ done: /*------------------------------------------------------------------------- -* Function: H5FD_driver_query -* -* Purpose: Similar to H5FD_query(), but intended for cases when we don't -* have a file available (e.g. before one is opened). Since we -* can't use the file to get the driver, the driver is passed in -* as a parameter. +* Function: H5FD_driver_query * -* Return: SUCCEED/FAIL +* Purpose: Similar to H5FD_query(), but intended for cases when we don't +* have a file available (e.g. before one is opened). Since we +* can't use the file to get the driver, the driver is passed in +* as a parameter. * -* Programmer: Jacob Gruber -* Wednesday, August 17, 2011 +* Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 4b42a73..7d58b7a 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -153,7 +153,7 @@ done: * * Return: Success: SUCCEED * - * Failure: Negative + * Failure: FAIL * * Programmer: John Mainzer * 4/4/17 diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index e51050e..22b5d17 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -30,7 +30,6 @@ #include "H5FDprivate.h" /* File drivers */ /* Other private headers needed by this file */ -#include "H5FLprivate.h" /* Free lists */ /**************************/ /* Package Private Macros */ @@ -50,10 +49,8 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, - haddr_t *align_addr, hsize_t *align_size); -H5_DLL herr_t H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - hsize_t size); +H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *align_addr, hsize_t *align_size); +H5_DLL herr_t H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size); /* Testing functions */ #ifdef H5FD_TESTING diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 0430064..c79d676 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -130,7 +130,7 @@ H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, H5_DLL herr_t H5FD_close(H5FD_t *file); H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2); H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/); -H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, +H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size); H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, haddr_t addr, hsize_t size); @@ -143,10 +143,8 @@ H5_DLL haddr_t H5FD_get_maxaddr(const H5FD_t *file); H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags); H5_DLL herr_t H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags); H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map); -H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - size_t size, void *buf/*out*/); -H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - size_t size, const void *buf); +H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); 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); diff --git a/src/H5FDspace.c b/src/H5FDspace.c index 69fcb96..e1f0cb2 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -274,7 +274,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_free_real + * Function: H5FD__free_real * * Purpose: Release space back to the VFD * @@ -287,11 +287,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) +H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check args */ HDassert(file); @@ -349,13 +349,13 @@ HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_free_real() */ +} /* end H5FD__free_real() */ /*------------------------------------------------------------------------- * Function: H5FD_free * - * Purpose: Wrapper for H5FD_free_real, to make certain EOA changes are + * Purpose: Wrapper for H5FD__free_real, to make certain EOA changes are * reflected in superblock. * * Note: When the metadata cache routines are updated to allow @@ -384,7 +384,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t addr, hsize_t size) HDassert(size > 0); /* Call the real 'free' routine */ - if(H5FD_free_real(file, type, addr, size) < 0) + if(H5FD__free_real(file, type, addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "real 'free' request failed") /* Mark EOA info dirty in cache, so change will get encoded */ @@ -415,8 +415,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, - hsize_t extra_requested) +H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, hsize_t extra_requested) { haddr_t eoa; /* End of allocated space in file */ htri_t ret_value = FALSE; /* Return value */ diff --git a/src/H5FS.c b/src/H5FS.c index 113c8ae..8fee634 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -58,8 +58,8 @@ /********************/ /* Section info routines */ -static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data); -static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_sect_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_node_cb(void *item, void *key, void *op_data); /*********************/ @@ -221,7 +221,7 @@ HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc); /* Increment the reference count on the free space manager header */ HDassert(fspace->rc <= 1); - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") fspace->alignment = alignment; @@ -545,7 +545,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end if */ /* Destroy section info */ - if(H5FS_sinfo_dest(fspace->sinfo) < 0) + if(H5FS__sinfo_dest(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space section info") } /* end else */ @@ -560,7 +560,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end else */ /* Decrement the reference count on the free space manager header */ - if(H5FS_decr(fspace) < 0) + if(H5FS__decr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") done: @@ -683,7 +683,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) /*------------------------------------------------------------------------- - * Function: H5FS_incr + * Function: H5FS__incr * * Purpose: Increment reference count on free space header * @@ -695,11 +695,11 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) *------------------------------------------------------------------------- */ herr_t -H5FS_incr(H5FS_t *fspace) +H5FS__incr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -719,11 +719,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_incr() */ +} /* end H5FS__incr() */ /*------------------------------------------------------------------------- - * Function: H5FS_decr + * Function: H5FS__decr * * Purpose: Decrement reference count on free space header * @@ -735,11 +735,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_decr(H5FS_t *fspace) +H5FS__decr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -766,11 +766,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_decr() */ +} /* end H5FS__decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS__dirty * * Purpose: Mark free space header as dirty * @@ -782,11 +782,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_dirty(H5FS_t *fspace) +H5FS__dirty(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE #ifdef QAK HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); #endif /* QAK */ @@ -802,7 +802,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_dirty() */ +} /* end H5FS__dirty() */ /*------------------------------------------------------------------------- @@ -875,7 +875,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace) fspace->alloc_sect_size = fspace->sect_size; /* Mark free-space header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Cache the free-space section info */ @@ -959,7 +959,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) } /* end if */ /* Mark free-space manager header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -1052,7 +1052,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS__sinfo_free_sect_cb * * Purpose: Free a size-tracking node for a bin * @@ -1064,12 +1064,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_section_info_t *sect = (H5FS_section_info_t *)_sect; /* Section to free */ const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)op_data; /* Free space manager for section */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(sect); HDassert(sinfo); @@ -1078,11 +1078,11 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) (*sinfo->fspace->sect_cls[sect->type].free)(sect); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_sect_cb() */ +} /* H5FS__sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb + * Function: H5FS__sinfo_free_node_cb * * Purpose: Free a size-tracking node for a bin * @@ -1094,27 +1094,27 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_node_t *fspace_node = (H5FS_node_t *)item; /* Temporary pointer to free space list node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fspace_node); HDassert(op_data); /* Release the skip list for sections of this size */ - H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data); + H5SL_destroy(fspace_node->sect_list, H5FS__sinfo_free_sect_cb, op_data); /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_node_cb() */ +} /* H5FS__sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS__sinfo_dest * * Purpose: Destroys a free space section info in memory. * @@ -1126,12 +1126,12 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ herr_t -H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) +H5FS__sinfo_dest(H5FS_sinfo_t *sinfo) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1143,7 +1143,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) /* Clear out lists of nodes */ for(u = 0; u < sinfo->nbins; u++) if(sinfo->bins[u].bin_list) { - H5SL_destroy(sinfo->bins[u].bin_list, H5FS_sinfo_free_node_cb, sinfo); + H5SL_destroy(sinfo->bins[u].bin_list, H5FS__sinfo_free_node_cb, sinfo); sinfo->bins[u].bin_list = NULL; } /* end if */ @@ -1160,7 +1160,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) * disappearing immediately) */ sinfo->fspace->sinfo = NULL; - if(H5FS_decr(sinfo->fspace) < 0) + if(H5FS__decr(sinfo->fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") sinfo->fspace = NULL; @@ -1169,7 +1169,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_sinfo_dest() */ +} /* end H5FS__sinfo_dest() */ herr_t H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count) diff --git a/src/H5FScache.c b/src/H5FScache.c index fa04ba1..ac0874e 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -926,7 +926,7 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU uint32_t computed_chksum; /* Computed metadata checksum value */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(image); @@ -981,7 +981,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, HDassert(dirty); /* Allocate a new free space section info */ - if(NULL == (sinfo = H5FS_sinfo_new(udata->f, fspace))) + if(NULL == (sinfo = H5FS__sinfo_new(udata->f, fspace))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* initialize old_sect_size */ @@ -1087,7 +1087,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && sinfo) - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info") FUNC_LEAVE_NOAPI(ret_value) @@ -1321,7 +1321,7 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing) H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(sinfo); @@ -1404,7 +1404,7 @@ H5FS__cache_sinfo_free_icr(void *_thing) HDassert(fspace->cache_info.is_pinned); /* Destroy free space info */ - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info") done: @@ -1512,3 +1512,4 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_serialize_node_cb() */ + diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index f160055..2c56ab6 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -215,24 +215,22 @@ H5FL_EXTERN(H5FS_t); /******************************/ /* Generic routines */ -H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, - H5AC_info_t *child_entry); -H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, - H5AC_info_t *child_entry); +H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); +H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); /* Free space manager header routines */ H5_DLL H5FS_t *H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata); -H5_DLL herr_t H5FS_incr(H5FS_t *fspace); -H5_DLL herr_t H5FS_decr(H5FS_t *fspace); -H5_DLL herr_t H5FS_dirty(H5FS_t *fspace); +H5_DLL herr_t H5FS__incr(H5FS_t *fspace); +H5_DLL herr_t H5FS__decr(H5FS_t *fspace); +H5_DLL herr_t H5FS__dirty(H5FS_t *fspace); /* Free space section routines */ -H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace); +H5_DLL H5FS_sinfo_t *H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace); /* Routines for destroying structures */ H5_DLL herr_t H5FS__hdr_dest(H5FS_t *hdr); -H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo); +H5_DLL herr_t H5FS__sinfo_dest(H5FS_sinfo_t *sinfo); /* Sanity check routines */ #ifdef H5FS_DEBUG_ASSERT diff --git a/src/H5FSsection.c b/src/H5FSsection.c index a58347f..27486f1 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -64,26 +64,26 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags); -static herr_t H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); -static herr_t H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +static herr_t H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); +static herr_t H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls); -static herr_t H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_unlink_rest(H5FS_t *fspace, +static herr_t H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); +static herr_t H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, +static herr_t H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, +static herr_t H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data); -static htri_t H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); -static herr_t H5FS_sect_serialize_size(H5FS_t *fspace); +static htri_t H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); +static herr_t H5FS__sect_serialize_size(H5FS_t *fspace); /*********************/ @@ -112,7 +112,7 @@ H5FL_DEFINE(H5FS_sinfo_t); /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS__sinfo_new * * Purpose: Create new section info structure * @@ -125,12 +125,12 @@ H5FL_DEFINE(H5FS_sinfo_t); *------------------------------------------------------------------------- */ H5FS_sinfo_t * -H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace) +H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) { H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ H5FS_sinfo_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(f); @@ -160,7 +160,7 @@ HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section bin array") /* Increment the reference count on the free space manager header */ - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") sinfo->fspace = fspace; @@ -183,11 +183,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_new() */ +} /* H5FS__sinfo_new() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS__sinfo_lock * * Purpose: Make certain the section info for the free space manager is * in memory. @@ -204,12 +204,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) +H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) { H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, fspace->addr, fspace->sinfo, fspace->sect_addr); @@ -280,7 +280,7 @@ HDfprintf(stderr, "%s: Creating new section info\n", FUNC); HDassert(fspace->ghost_sect_count == 0); /* Allocate and initialize free space section info */ - if(NULL == (fspace->sinfo = H5FS_sinfo_new(f, fspace))) + if(NULL == (fspace->sinfo = H5FS__sinfo_new(f, fspace))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create section info") /* Set initial size of section info to 0 */ @@ -298,11 +298,11 @@ HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->s HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_lock() */ +} /* H5FS__sinfo_lock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS__sinfo_unlock * * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. @@ -315,11 +315,11 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) +H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC, modified, fspace->addr, fspace->sect_addr); HDfprintf(stderr, "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n", FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); @@ -347,7 +347,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Assume that the modification will affect the statistics in the header * and mark that dirty also */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -442,7 +442,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* If we haven't already marked the header dirty, do so now */ if(!modified) - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") #ifdef H5FS_SINFO_DEBUG @@ -460,11 +460,11 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_unlock() */ +} /* H5FS__sinfo_unlock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS__sect_serialize_size * * Purpose: Determine serialized size of all sections in free space manager * @@ -476,17 +476,17 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_serialize_size(H5FS_t *fspace) +H5FS__sect_serialize_size(H5FS_t *fspace) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(fspace); #ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->sect_size); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->alloc_sect_size); -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->sect_size); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->alloc_sect_size); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); #endif /* QAK */ /* Compute the size of the buffer required to serialize all the sections */ @@ -498,8 +498,8 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_ser /* Count for each differently sized serializable section */ #ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); #endif /* QAK */ sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -523,11 +523,11 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ fspace->sect_size = fspace->sinfo->sect_prefix_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sect_serialize_size() */ +} /* H5FS__sect_serialize_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS__sect_increase * * Purpose: Increase the size of the serialized free space section info * on disk @@ -540,12 +540,12 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -577,18 +577,18 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); /* Update the free space sections' serialized size */ /* (if we're not deserializing the sections from disk) */ if(!(flags & H5FS_ADD_DESERIALIZING)) { - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end if */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_increase() */ +} /* H5FS__sect_increase() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS__sect_decrease * * Purpose: Decrease the size of the serialized free space section info * on disk @@ -601,11 +601,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) +H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -635,17 +635,17 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); fspace->sinfo->serial_size -= cls->serial_size; /* Update the free space sections' serialized size */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_decrease() */ +} /* H5FS__sect_decrease() */ /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS__size_node_decr * * Purpose: Decrement the number of sections of a particular size * @@ -657,12 +657,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -728,11 +728,11 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_size_node_decr() */ +} /* H5FS__size_node_decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_size + * Function: H5FS__sect_unlink_size * * Purpose: Remove a section node from size tracking data structures for * a free space manager @@ -745,7 +745,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node; /* Free list size node */ @@ -753,7 +753,7 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -777,16 +777,16 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, 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) + 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") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_size() */ +} /* H5FS__sect_unlink_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_rest + * Function: H5FS__sect_unlink_rest * * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed @@ -800,12 +800,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -826,7 +826,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC } /* end if */ /* Update section info & check if we need less room for the serialized free space sections */ - if(H5FS_sect_decrease(fspace, cls) < 0) + if(H5FS__sect_decrease(fspace, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Decrement amount of free space managed */ @@ -837,11 +837,11 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_rest() */ +} /* H5FS__sect_unlink_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS__sect_remove_real * * Purpose: Remove a section from the free space manager * @@ -853,12 +853,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) +H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -869,16 +869,16 @@ H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) cls = &fspace->sect_cls[sect->type]; /* Remove node from size tracked data structures */ - if(H5FS_sect_unlink_size(fspace->sinfo, cls, sect) < 0) + 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") /* Update rest of free space manager data structures for node removal */ - if(H5FS_sect_unlink_rest(fspace, cls, sect) < 0) + 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") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_remove_real() */ +} /* H5FS__sect_remove_real() */ /*------------------------------------------------------------------------- @@ -907,17 +907,17 @@ H5FS_sect_remove(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect) HDassert(sect); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) 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) + if(H5FS__sect_remove_real(fspace, sect) < 0) 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) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -925,7 +925,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS__sect_link_size * * Purpose: Add a section of free space to the free list bins * @@ -937,7 +937,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */ @@ -945,7 +945,7 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef QAK HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr); #endif /* QAK */ @@ -1028,11 +1028,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_size() */ +} /* H5FS__sect_link_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_rest + * Function: H5FS__sect_link_rest * * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures @@ -1045,12 +1045,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1070,7 +1070,7 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN } /* 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) + if(H5FS__sect_increase(fspace, cls, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Increment amount of free space managed */ @@ -1078,11 +1078,11 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_rest() */ +} /* H5FS__sect_link_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link + * Function: H5FS__sect_link * * Purpose: Link a section into the internal data structures * @@ -1094,12 +1094,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) +H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1113,14 +1113,14 @@ H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) #ifdef QAK HDfprintf(stderr, "%s: Check 1.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ - if(H5FS_sect_link_size(fspace->sinfo, cls, sect) < 0) + 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") #ifdef QAK HDfprintf(stderr, "%s: Check 2.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ /* Update rest of free space manager data structures for section addition */ - if(H5FS_sect_link_rest(fspace, cls, sect, flags) < 0) + 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") #ifdef QAK HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); @@ -1128,11 +1128,11 @@ HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link() */ +} /* H5FS__sect_link() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS__sect_merge * * Purpose: Attempt to merge a returned free space section with existing * free space. @@ -1145,7 +1145,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) +H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) { H5FS_section_class_t *sect_cls; /* Section's class */ hbool_t modified; /* Flag to indicate merge or shrink occurred */ @@ -1153,7 +1153,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) htri_t status; /* Status value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1203,7 +1203,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(tmp_sect_cls->merge); /* Remove 'less than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1249,7 +1249,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(sect_cls->merge); /* Remove 'greater than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1290,7 +1290,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* 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) + if(H5FS__sect_remove_real(fspace, *sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") remove_sect = FALSE; } /* end if */ @@ -1342,7 +1342,7 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_merge() */ +} /* H5FS__sect_merge() */ /*------------------------------------------------------------------------- @@ -1379,7 +1379,7 @@ HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->siz HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1396,7 +1396,7 @@ HDfprintf(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) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") } /* end if */ @@ -1405,7 +1405,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); * be NULL at this point - QAK) */ if(sect) - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") #ifdef H5FS_SINFO_DEBUG @@ -1418,7 +1418,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1475,7 +1475,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se 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) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1511,7 +1511,7 @@ if(_section_) H5FS_section_class_t *cls; /* Section's class */ /* Remove section from data structures */ - if(H5FS_sect_remove_real(fspace, sect) < 0) + if(H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Get class for section */ @@ -1537,7 +1537,7 @@ if(_section_) /* 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) + if(H5FS__sect_link(fspace, sect, 0) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") } /* end if */ } /* end if */ @@ -1561,7 +1561,7 @@ if(_section_) done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1601,13 +1601,13 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) 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) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") /* Check if section is shrunk and/or merged away completely */ @@ -1618,7 +1618,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, else { /* Check if section is merged */ if(sect->size > saved_fs_size) { - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") sinfo_modified = TRUE; HGOTO_DONE(TRUE) @@ -1627,7 +1627,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1635,7 +1635,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS__sect_find_node * * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. @@ -1648,7 +1648,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) +H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) { H5FS_node_t *fspace_node; /* Free list size node */ unsigned bin; /* Bin to put the free space section in */ @@ -1658,7 +1658,7 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) const H5FS_section_class_t *cls; /* Class of section */ hsize_t alignment; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1696,9 +1696,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* 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) + 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") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + 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") /* Indicate that we found a node for the request */ HGOTO_DONE(TRUE) @@ -1741,10 +1741,10 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); 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") /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) + 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") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + 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") /* @@ -1755,7 +1755,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); */ if(mis_align) { split_sect = cls->split(*node, frag_size); - if((H5FS_sect_link(fspace, split_sect, 0) < 0)) + 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") /* sanity check */ HDassert(split_sect->addr < (*node)->addr); @@ -1780,7 +1780,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_find_node() */ +} /* H5FS__sect_find_node() */ /*------------------------------------------------------------------------- @@ -1823,12 +1823,12 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #endif /* QAK */ if(fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) 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) + if((ret_value = H5FS__sect_find_node(fspace, request, node)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from bins") /* Decrement # of sections on free list, if we found an object */ @@ -1843,7 +1843,7 @@ HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1965,7 +1965,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c unsigned bin; /* Current bin we are on */ /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1985,7 +1985,7 @@ HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, FALSE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, FALSE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2054,7 +2054,7 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(new_class < fspace->nclasses); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2179,12 +2179,12 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC fspace->sinfo->serial_size += fspace->sect_cls[new_class].serial_size; /* Update current space used for free space sections */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) 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) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2343,13 +2343,12 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_shrink_eoa + * Function: H5FS_sect_try_shrink_eoa * - * Purpose: To shrink the last section on the merge list if the section - * is at EOF. + * Purpose: To shrink the last section on the merge list if the section + * is at EOF. * - * Return: Success: non-negative (TRUE/FALSE) - * Failure: negative + * Return: TRUE/FALSE/FAIL * * Programmer: Vailin Choi * @@ -2367,7 +2366,7 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Check arguments. */ HDassert(fspace); - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2382,30 +2381,30 @@ 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); - tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; - if(tmp_sect_cls->can_shrink) { + 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") - if(ret_value > 0) { - HDassert(tmp_sect_cls->shrink); + 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") + if(ret_value > 0) { + HDassert(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") + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "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") - } /* end if */ - } /* end if */ - } /* end if */ + if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") + } /* end if */ + } /* end if */ + } /* end if */ } /* end if */ done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, section_removed) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, section_removed) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2557,15 +2556,15 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, 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_alloc_size = H5FS_HEADER_SIZE(f); + hdr_alloc_size = H5FS_HEADER_SIZE(f); - /* if page allocation is enabled, extend the hdr_alloc_size to the - * next page boundary. + /* if page allocation is enabled, extend the hdr_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(hdr_alloc_size >= H5FS_HEADER_SIZE(f)); HDassert((hdr_alloc_size % f->shared->fs_page_size) == 0); @@ -2599,13 +2598,13 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, sinfo_alloc_size = fspace->sect_size; - /* if paged allocation is enabled, extend the sinfo_alloc_size to the - * next page boundary. + /* if paged allocation is enabled, extend the sinfo_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(sinfo_alloc_size >= fspace->sect_size); HDassert((sinfo_alloc_size % f->shared->fs_page_size) == 0); diff --git a/src/H5G.c b/src/H5G.c index cbf3a8e..e54e5cd 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -14,14 +14,12 @@ /*------------------------------------------------------------------------- * * Created: H5G.c - * Jul 18 1997 - * Robb Matzke * * Purpose: Symbol table functions. The functions that begin with - * `H5G_stab_' don't understand the naming system; they operate + * 'H5G_stab_' don't understand the naming system; they operate * on a single symbol table at a time. * - * The functions that begin with `H5G_node_' operate on the leaf + * The functions that begin with 'H5G_node_' operate on the leaf * nodes of a symbol table B-tree. They should be defined in * the H5Gnode.c file. * @@ -42,11 +40,11 @@ * +--------------+----------- +--------------------------------+ * | Location ID | Name | Meaning | * +--------------+------------+--------------------------------+ - * | File ID | "/foo/bar" | Find `foo' within `bar' within | + * | File ID | "/foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the specified| * | | | file. | * +--------------+------------+--------------------------------+ - * | File ID | "foo/bar" | Find `foo' within `bar' within | + * | File ID | "foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the specified| * | | | file. | * +--------------+------------+--------------------------------+ @@ -56,11 +54,11 @@ * | File ID | "." | The root group of the specified| * | | | the specified file. | * +--------------+------------+--------------------------------+ - * | Group ID | "/foo/bar" | Find `foo' within `bar' within | + * | Group ID | "/foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the file | * | | | containing the specified group.| * +--------------+------------+--------------------------------+ - * | Group ID | "foo/bar" | File `foo' within `bar' within | + * | Group ID | "foo/bar" | File 'foo' within 'bar' within | * | | | the specified group. | * +--------------+------------+--------------------------------+ * | Group ID | "/" | The root group of the file | @@ -83,13 +81,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ /****************/ diff --git a/src/H5Gint.c b/src/H5Gint.c index 8fd7514..51d3b91 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -32,13 +32,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -805,12 +805,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_iterate + * Function: H5G_iterate * * Purpose: Private function for iterating over links in a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Oct 3, 2005 @@ -860,7 +859,7 @@ done: if(gid > 0) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ + } else if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") @@ -1054,9 +1053,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_visit + * Function: H5G_visit * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1068,18 +1067,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * 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. + * 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. * - * - * - * Programmer: Quincey Koziol - * November 4 2007 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ @@ -1193,7 +1187,7 @@ done: if(gid > 0) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ + } else if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") diff --git a/src/H5Glink.c b/src/H5Glink.c index 509e511..82a2dcf 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -568,7 +568,7 @@ H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_ 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") - } /* end if */ + } done: if(obj_path_r) diff --git a/src/H5Gloc.c b/src/H5Gloc.c index f5a14a1..2f935e8 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -137,15 +137,11 @@ static herr_t H5G__loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name, /*------------------------------------------------------------------------- - * Function: H5G_loc + * Function: H5G_loc * - * Purpose: Given an object ID return a location for the object. + * Purpose: Given an object ID return a location for the object. * - * Return: Success: Group pointer. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 + * Returns: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -158,92 +154,94 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) switch(H5I_get_type(loc_id)) { case H5I_FILE: - { - H5F_t *f; + { + H5F_t *f = NULL; - /* Get the file struct */ - if(NULL == (f = (H5F_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") + /* Get the file struct */ + if(NULL == (f = (H5F_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") - /* 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") - } /* end case */ + /* 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") break; - - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - 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") + } case H5I_GROUP: - { - H5G_t *group; - - if(NULL == (group = (H5G_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") - if(NULL == (loc->oloc = H5G_oloc(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") - } /* end case */ + { + H5G_t *group = NULL; + + if(NULL == (group = (H5G_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") + if(NULL == (loc->oloc = H5G_oloc(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") break; + } case H5I_DATATYPE: - { - H5T_t *dt; - - if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") - if(NULL == (loc->oloc = H5T_oloc(dt))) - 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") - } /* end case */ + { + H5T_t *dt = NULL; + + if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") + if(NULL == (loc->oloc = H5T_oloc(dt))) + 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") break; - - case H5I_DATASPACE: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + } case H5I_DATASET: - { - H5D_t *dset; - - if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") - if(NULL == (loc->oloc = H5D_oloc(dset))) - 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") - } /* end case */ + { + H5D_t *dset = NULL; + + if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") + if(NULL == (loc->oloc = H5D_oloc(dset))) + 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") break; + } case H5I_ATTR: - { - H5A_t *attr; - - if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") - if(NULL == (loc->oloc = H5A_oloc(attr))) - 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") - } /* end case */ + { + H5A_t *attr = NULL; + + if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") + if(NULL == (loc->oloc = H5A_oloc(attr))) + 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") break; + } case H5I_REFERENCE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference") + case H5I_DATASPACE: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + 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") + + case H5I_VFL: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") + case H5I_UNINIT: case H5I_BADID: - case H5I_VFL: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid location ID") } /* end switch */ done: @@ -764,7 +762,7 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* 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) @@ -774,9 +772,9 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Add the new message */ if(udata->comment && *udata->comment) { /* Casting away const OK -QAK */ - comment.s = (char *)udata->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") + comment.s = (char *)udata->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") } /* end if */ done: @@ -854,20 +852,21 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Query object comment */ comment.s = NULL; if(NULL == H5O_msg_read(obj_loc->oloc, H5O_NAME_ID, &comment)) { - if(udata->comment && udata->bufsize > 0) + if(udata->comment && udata->bufsize > 0) udata->comment[0] = '\0'; - udata->comment_size = 0; - } /* end if */ + udata->comment_size = 0; + } else { if(udata->comment && udata->bufsize) - HDstrncpy(udata->comment, comment.s, udata->bufsize); - udata->comment_size = (ssize_t)HDstrlen(comment.s); - H5O_msg_reset(H5O_NAME_ID, &comment); - } /* end else */ + HDstrncpy(udata->comment, comment.s, udata->bufsize); + udata->comment_size = (ssize_t)HDstrlen(comment.s); + H5O_msg_reset(H5O_NAME_ID, &comment); + } done: /* Indicate that this callback didn't take ownership of the group * - * location for the object */ + * location for the object. + */ *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gname.c b/src/H5Gname.c index c1156ca..8aa0b45 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -1155,7 +1155,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, else { /* We pass NULL as link pointer when we need to search all IDs */ search_group = search_dataset = search_datatype = TRUE; - } /* end else */ + } /* Check if we need to operate on the objects affected */ if(search_group || search_dataset || search_datatype) { @@ -1166,26 +1166,26 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, src_file = H5F_PARENT(src_file); /* Set up common information for callback */ - names.src_file = src_file; - names.src_full_path_r = src_full_path_r; - names.dst_file = dst_file; - names.dst_full_path_r = dst_full_path_r; - names.op = op; + names.src_file = src_file; + names.src_full_path_r = src_full_path_r; + names.dst_file = dst_file; + names.dst_full_path_r = dst_full_path_r; + names.op = op; /* 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 */ @@ -1269,10 +1269,11 @@ done: * * Purpose: Tries to figure out the path to an object from it's address * - * Return: returns size of path name, and copies it into buffer - * pointed to by name if that buffer is big enough. - * 0 if it cannot find the path - * negative on failure. + * Return: Success: Returns size of path name, and copies it into buffer + * pointed to by name if that buffer is big enough. + * 0 if it cannot find the path + * + * Failure: -1 * * Programmer: Quincey Koziol * November 4 2007 @@ -1283,25 +1284,25 @@ ssize_t H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, char *name, size_t size) { - H5G_gnba_iter_t udata; /* User data for iteration */ - H5G_loc_t root_loc; /* Root group's location */ - hbool_t found_obj = FALSE; /* If we found the object */ - herr_t status; /* Status from iteration */ - ssize_t ret_value = -1; /* Return value */ + H5G_gnba_iter_t udata; /* User data for iteration */ + H5G_loc_t root_loc; /* Root group's location */ + hbool_t found_obj = FALSE; /* If we found the object */ + herr_t status; /* Status from iteration */ + ssize_t ret_value = -1; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Construct the link info for the file's root group */ if(H5G_loc(file, &root_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "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, (-1), "can't duplicate path string") found_obj = TRUE; } /* end if */ else { @@ -1311,7 +1312,7 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, /* Visit all the links in the file */ if((status = H5G_visit(file, "/", 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, (-1), "group traversal failed while looking for object name") else if(status > 0) found_obj = TRUE; } /* end else */ @@ -1342,3 +1343,4 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_get_name_by_addr() */ + diff --git a/src/H5Gobj.c b/src/H5Gobj.c index e93896c..15dbd79 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -36,7 +36,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ @@ -257,7 +256,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, * 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) { diff --git a/src/H5Goh.c b/src/H5Goh.c index 38570f9..ec3d30d 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -193,9 +193,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__group_open + * Function: H5O__group_open * - * Purpose: Open a group at a particular location + * Purpose: Open a group at a particular location * * Return: Success: Open object identifier * Failure: Negative diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 64c4054..9072b97 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -225,14 +225,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) @@ -534,7 +534,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, /* 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))) @@ -626,7 +626,7 @@ H5G__stab_count(const H5O_loc_t *oloc, hsize_t *num_objs) /* 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) @@ -757,7 +757,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* 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))) @@ -785,11 +785,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 */ ret_value = (ssize_t)HDstrlen(udata.name); @@ -979,7 +979,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* 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))) @@ -1007,11 +1007,11 @@ 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 */ @@ -1193,7 +1193,7 @@ H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) /* Get the B-tree & local heap info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") /* Set iteration information */ udata.common.idx = idx; @@ -1204,7 +1204,7 @@ H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) /* 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, H5G_UNKNOWN, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") /* If we don't know the type now, we almost certainly went out of bounds */ if(udata.type == H5G_UNKNOWN) diff --git a/src/H5I.c b/src/H5I.c index 6cb1947..293a0ea 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -128,6 +128,7 @@ static int H5I__inc_type_ref(H5I_type_t type); static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); +static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type); #ifdef H5I_DEBUG_OUTPUT static int H5I__debug_cb(void *_item, void *_key, void *_udata); static herr_t H5I__debug(H5I_type_t type); @@ -2055,7 +2056,7 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5I_get_file_id(obj_id, type)) < 0) + if ((ret_value = H5I__get_file_id(obj_id, type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } else @@ -2067,7 +2068,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_file_id + * Function: H5I__get_file_id * * Purpose: The private version of H5Iget_file_id(), obtains the file * ID given an object ID. @@ -2077,12 +2078,12 @@ done: * *------------------------------------------------------------------------- */ -hid_t -H5I_get_file_id(hid_t obj_id, H5I_type_t type) +static hid_t +H5I__get_file_id(hid_t obj_id, H5I_type_t type) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Process based on object type */ if (type == H5I_FILE) { @@ -2107,7 +2108,7 @@ H5I_get_file_id(hid_t obj_id, H5I_type_t type) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_file_id() */ +} /* end H5I__get_file_id() */ #ifdef H5I_DEBUG_OUTPUT diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 3bfde93..a10147d 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -72,7 +72,6 @@ H5_DLL void *H5I_subst(hid_t id, const void *new_object); H5_DLL void *H5I_object(hid_t id); H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL H5I_type_t H5I_get_type(hid_t id); -H5_DLL hid_t H5I_get_file_id(hid_t obj_id, H5I_type_t id_type); H5_DLL void *H5I_remove(hid_t id); H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref); H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref); diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 7c32309..1cab17d 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -102,7 +102,7 @@ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ * link access property list, appends that prefix to the * filename being opened. * - * Return: ID of the opened object on success/Negative on failure + * Return: ID of the opened object on success/H5I_INVALID_HID on failure * * Programmer: James Laird * Monday, July 10, 2006 @@ -129,8 +129,8 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, char *parent_group_name = NULL;/* Temporary pointer to group name */ char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ - H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ - char *elink_prefix; /* Pointer to elink prefix */ + H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ + char *elink_prefix = NULL; /* Pointer to elink prefix */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -140,9 +140,9 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check external link version & flags */ if(((*p >> 4) & 0x0F) > H5L_EXT_VERSION) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "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, FAIL, "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 */ @@ -152,19 +152,19 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 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, FAIL, "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, FAIL, "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, FAIL, "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 */ @@ -172,15 +172,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, 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, FAIL, "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, FAIL, "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_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") /* Make callback if it exists */ if(cb_info.func) { @@ -192,7 +192,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Query length of parent group name */ if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "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++; @@ -200,43 +200,43 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check if we need to allocate larger buffer */ if((size_t)group_name_len > sizeof(local_group_name)) { if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len))) - HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) + HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) } /* end if */ else parent_group_name = local_group_name; /* Get parent group name */ if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "unable to open external file, external link file name = '%s'", file_name) + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "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, FAIL, "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((ext_obj = H5O_open_name(&root_loc, obj_name, FALSE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Set return value */ ret_value = ext_obj; @@ -244,15 +244,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, done: /* Release resources */ if(fapl_id > 0 && H5I_dec_ref(fapl_id) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for file access property list") if(ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "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 >= 0 && H5I_dec_ref(ext_obj) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for external object") + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for external object") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -312,7 +312,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Lcreate_external * - * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. + * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. * * External links are links to objects in other HDF5 files. They * are allowed to "dangle" like soft links internal to a file. @@ -322,9 +322,9 @@ done: * LINK_NAME is interpreted relative to LINK_LOC_ID, which is * either a file ID or a group ID. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 18, 2005 * *------------------------------------------------------------------------- @@ -380,7 +380,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, /* Create an external link */ if(H5L__create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") done: H5MM_xfree(ext_link_buf); diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index fa57862..8a44902 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -195,10 +195,7 @@ H5FL_DEFINE(haddr_t); * hid_t lcpl_id IN: Properties which apply to the new hard link * * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Peter Cao - * June 4, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -216,19 +213,33 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Check arguments */ if(H5G_loc(src_loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") 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") + + /* 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") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to copy object */ + /* Copy the object */ if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") @@ -240,10 +251,9 @@ done: /*------------------------------------------------------------------------- * Function: H5O__copy * - * Purpose: Internal routine to copy an object + * Purpose: Private version of H5Ocopy * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 29, 2017 @@ -260,7 +270,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, htri_t dst_exists; /* Does destination name exist already? */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hbool_t obj_open = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -272,7 +282,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, /* Check if destination name already exists */ if((dst_exists = H5L_exists_tolerant(dst_loc, dst_name)) < 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(TRUE == dst_exists) HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") @@ -291,24 +301,6 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") obj_open = TRUE; - /* Get correct property lists */ - if(H5P_DEFAULT == lcpl_id) { - if((lcpl_id = H5P_get_default(H5P_CLS_LCRT)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default lcpl") - } /* end if */ - else - if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") - - /* Get object copy property list */ - if(H5P_DEFAULT == ocpypl_id) { - if((ocpypl_id = H5P_get_default(H5P_CLS_OCPY)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default ocpypl") - } /* end if */ - else - if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") - /* 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") diff --git a/src/H5P.c b/src/H5P.c index 733af42..72d7ae8 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -82,7 +82,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; hid_t id; IN: Property list or class ID to copy RETURNS Success: valid property list ID on success (non-negative) - Failure: negative + Failure: H5I_INVALID_HID (negative) DESCRIPTION Copy a property list or class and return the ID. This routine calls the class 'copy' callback after any property 'copy' callbacks are called @@ -97,37 +97,37 @@ hid_t H5Pcopy(hid_t id) { void *obj; /* Property object to copy */ - hid_t ret_value=FALSE; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", id); - if(H5P_DEFAULT==id) + if(H5P_DEFAULT == id) HGOTO_DONE(H5P_DEFAULT); /* Check arguments. */ if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property object"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not property object"); if(NULL == (obj = H5I_object(id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "property object doesn't exist"); /* Compare property lists */ if(H5I_GENPROP_LST == H5I_get_type(id)) { if((ret_value = H5P_copy_plist((H5P_genplist_t *)obj, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list"); } /* end if */ /* Must be property classes */ else { H5P_genclass_t *copy_class; /* Copy of class */ /* Copy the class */ - if((copy_class = H5P_copy_pclass((H5P_genclass_t *)obj)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property class"); + if((copy_class = H5P__copy_pclass((H5P_genclass_t *)obj)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property class"); /* Get an atom for the copied class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, copy_class, TRUE)) < 0) { - H5P_close_class(copy_class); - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + H5P__close_class(copy_class); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); } /* end if */ } /* end else */ @@ -162,7 +162,7 @@ done: void *close_data; IN: Pointer to user data to pass along to class close callback. RETURNS - Returns a valid property list class ID on success, NULL on failure. + Returns a valid property list class ID on success, H5I_INVALID_HID on failure. DESCRIPTION Allocates memory and attaches a class to the property list class hierarchy. GLOBAL VARIABLES @@ -179,39 +179,39 @@ H5Pcreate_class(hid_t parent, const char *name, { H5P_genclass_t *par_class = NULL; /* Pointer to the parent class */ H5P_genclass_t *pclass = NULL; /* Property list class created */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "i*sx*xx*xx*x", parent, name, cls_create, create_data, cls_copy, copy_data, cls_close, close_data); /* Check arguments. */ if(H5P_DEFAULT!=parent && (H5I_GENPROP_CLS!=H5I_get_type(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "unable to create 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") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") done: - if(ret_value < 0 && pclass) - H5P_close_class(pclass); + if(H5I_INVALID_HID == ret_value && pclass) + H5P__close_class(pclass); FUNC_LEAVE_API(ret_value) } /* H5Pcreate_class() */ @@ -226,7 +226,7 @@ done: hid_t H5Pcreate(cls_id) hid_t cls_id; IN: Property list class create list from RETURNS - Returns a valid property list ID on success, FAIL on failure. + Returns a valid property list ID on success, H5I_INVALID_HID on failure. DESCRIPTION Creates a property list of a given class. If a 'create' callback exists for the property list class, it is called before the @@ -243,18 +243,18 @@ hid_t H5Pcreate(hid_t cls_id) { H5P_genclass_t *pclass; /* Property list class to modify */ - hid_t ret_value; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", cls_id); /* 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, H5I_INVALID_HID, "not a property list class"); /* Create the new property list */ if((ret_value = H5P_create_id(pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list"); done: FUNC_LEAVE_API(ret_value) @@ -440,7 +440,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, /* 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) + 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") /* Check if the property class changed and needs to be substituted in the ID */ @@ -453,7 +453,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, HDassert(old_pclass == orig_pclass); /* Close the previous class */ - if(H5P_close_class(old_pclass) < 0) + if(H5P__close_class(old_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ @@ -738,7 +738,7 @@ H5Pexist(hid_t id, const char *name) if(H5I_GENPROP_CLS == H5I_get_type(id)) { if(NULL == (pclass = (H5P_genclass_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); - if((ret_value = H5P_exist_pclass(pclass, name)) < 0) + if((ret_value = H5P__exist_pclass(pclass, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property does not exist in class"); } /* end if */ else @@ -795,7 +795,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ - if((ret_value = H5P_get_size_plist(plist, name, size)) < 0) + if((ret_value = H5P__get_size_plist(plist, name, size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist"); } /* end if */ else @@ -804,7 +804,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ - if((ret_value = H5P_get_size_pclass(pclass, name, size)) < 0) + if((ret_value = H5P__get_size_pclass(pclass, name, size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist"); } /* end if */ else @@ -867,8 +867,8 @@ done: hid_t H5Pdecode(buf) void *buf; IN: buffer that holds the encoded plist RETURNS - Returns non-negative ID of new property list object on success, negative - on failure. + Success: ID of new property list object + Failure: H5I_INVALID_HID (negative) DESCRIPTION Decodes a property list from a binary buffer. The contents of the buffer contain the values for the correponding properties of the plist. The decode @@ -884,14 +884,14 @@ done: hid_t H5Pdecode(const void *buf) { - hid_t ret_value = SUCCEED; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", buf); /* Call the internal decode routine */ if((ret_value = H5P__decode(buf)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "unable to decode property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, H5I_INVALID_HID, "unable to decode property list"); done: FUNC_LEAVE_API(ret_value) @@ -908,7 +908,7 @@ done: hid_t plist_id; IN: Property list to query RETURNS Success: ID of class object - Failure: negative + Failure: H5I_INVALID_HID (negative) DESCRIPTION This routine retrieves the class of a property list. @@ -923,30 +923,30 @@ H5Pget_class(hid_t plist_id) { H5P_genplist_t *plist; /* Property list to query */ H5P_genclass_t *pclass=NULL; /* Property list class */ - hid_t ret_value=FAIL; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", plist_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, H5I_INVALID_HID, "not a property list"); /* Retrieve the property list class */ if((pclass = H5P_get_class(plist)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "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(pclass, H5P_MOD_INC_REF) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count"); + if(H5P__access_class(pclass, H5P_MOD_INC_REF) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID,"Can't increment class ID ref count"); /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); done: - if(ret_value<0 && pclass) - H5P_close_class(pclass); + if(H5I_INVALID_HID == ret_value && pclass) + H5P__close_class(pclass); FUNC_LEAVE_API(ret_value) } /* H5Pget_class() */ @@ -994,7 +994,7 @@ H5Pget_nprops(hid_t id, size_t *nprops) if(H5I_GENPROP_LST == H5I_get_type(id)) { if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); - if(H5P_get_nprops_plist(plist, nprops) < 0) + if(H5P__get_nprops_plist(plist, nprops) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query # of properties in plist"); } /* end if */ else @@ -1054,7 +1054,7 @@ H5Pequal(hid_t id1, hid_t id2) 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) + 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") /* Set return value */ @@ -1062,7 +1062,7 @@ H5Pequal(hid_t id1, hid_t id2) } /* end if */ /* Must be property classes */ else { - if(H5P_cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0) + if(H5P__cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0) ret_value = TRUE; } /* end else */ @@ -1236,13 +1236,13 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data) if(H5I_GENPROP_LST == H5I_get_type(id)) { /* Iterate over a property list */ - if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) + if((ret_value = H5P__iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list"); } /* end if */ else if(H5I_GENPROP_CLS == H5I_get_type(id)) { /* Iterate over a property class */ - if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) + if((ret_value = H5P__iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class"); } /* end if */ else @@ -1419,12 +1419,12 @@ H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name) /* Compare property lists */ if(H5I_GENPROP_LST == src_id_type) { - if(H5P_copy_prop_plist(dst_id, src_id, name) < 0) + if(H5P__copy_prop_plist(dst_id, src_id, name) < 0) 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) + if(H5P__copy_prop_pclass(dst_id, src_id, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes") } /* end else */ @@ -1470,7 +1470,7 @@ H5Punregister(hid_t pclass_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); /* Remove the property list from class */ - if((ret_value = H5P_unregister(pclass, name)) < 0) + if((ret_value = H5P__unregister(pclass, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to remove property from class"); done: @@ -1575,7 +1575,7 @@ done: hid_t pclass_id; IN: Property class to query RETURNS Success: ID of parent class object - Failure: NULL + Failure: H5I_INVALID_HID (negative) DESCRIPTION This routine retrieves an ID for the parent class of a property class. @@ -1589,30 +1589,30 @@ H5Pget_class_parent(hid_t pclass_id) { H5P_genclass_t *pclass; /* Property class to query */ H5P_genclass_t *parent = NULL; /* Parent's property class */ - hid_t ret_value; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", pclass_id); /* Check arguments. */ 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, 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, FAIL, "unable to query class of property list") + if(NULL == (parent = H5P__get_class_parent(pclass))) + 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, FAIL,"Can't increment class ID ref count") + 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") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") done: - if(ret_value < 0 && parent) - H5P_close_class(parent); + if(H5I_INVALID_HID == ret_value && parent) + H5P__close_class(parent); FUNC_LEAVE_API(ret_value) } /* H5Pget_class_parent() */ diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 4368dd6..530ede3 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pacpl.c - * January 2 2006 - * James Laird + * Created: H5Pacpl.c * - * Purpose: Attribute creation property list class routines + * Purpose: Attribute creation property list class routines * *------------------------------------------------------------------------- */ @@ -32,9 +30,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -63,21 +61,21 @@ /* Attribute creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_ACRT[1] = {{ - "attribute create", /* Class name for debugging */ - H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */ - - &H5P_CLS_STRING_CREATE_g, /* Parent class */ - &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */ - &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */ - &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */ - NULL, /* Default property registration routine */ - - NULL, /* Class creation callback */ - NULL, /* Class creation callback info */ - NULL, /* Class copy callback */ - NULL, /* Class copy callback info */ - NULL, /* Class close callback */ - NULL /* Class close callback info */ + "attribute create", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */ + + &H5P_CLS_STRING_CREATE_g, /* Parent class */ + &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */ + &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ }}; diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index da06297..00e598f 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -204,46 +204,46 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, + 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") /* 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, + 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") /* 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, + 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") /* Register the VDS view option */ - if(H5P_register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view, + 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") /* Register the VDS printf gap */ - if(H5P_register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &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") /* 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, + 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") /* 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, + 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") /* Register property for external file prefix */ - if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, + if(H5P__register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, 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") diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index cb13ff3..7e9fc52 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pdcpl.c - * February 26 1998 - * Robb Matzke + * Created: H5Pdcpl.c * - * Purpose: Dataset creation property list class routines + * Purpose: Dataset creation property list class routines * *------------------------------------------------------------------------- */ @@ -33,19 +31,19 @@ /***********/ /* 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 "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5Sprivate.h" /* Dataspaces */ -#include "H5Tprivate.h" /* Datatypes */ -#include "H5VMprivate.h" /* Vectors and arrays */ -#include "H5Zprivate.h" /* Data filters */ +#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 "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5Zprivate.h" /* Data filters */ /****************/ @@ -242,30 +240,30 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register the storage layout property */ - if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, + if(H5P__register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, NULL, 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") /* Register the fill value property */ - if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, + 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") /* 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, + 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") /* 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, + if(H5P__register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, NULL, H5D_CRT_EXT_FILE_LIST_SET, H5D_CRT_EXT_FILE_LIST_GET, 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") @@ -3206,10 +3204,10 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) H5T_path_t *tpath; /* Conversion information */ /* Retrieve pointer to datatype */ - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - /* Set the fill value */ + /* 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") fill.size = (ssize_t)H5T_get_size(type); diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 226d206..4a63b36 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -242,7 +242,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, /* 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, NULL, prp_close)) < 0) + if((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, 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 class"); /* Check if the property class changed and needs to be substituted in the ID */ @@ -255,7 +255,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, HDassert(old_pclass == orig_pclass); /* Close the previous class */ - if(H5P_close_class(orig_pclass) < 0) + if(H5P__close_class(orig_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index e6eed32..bfc1d93 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -271,131 +271,131 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the max. temp buffer size property */ - if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") - if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g, + 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") - 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, + 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") - 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, + 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") - 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* Register the EDC property */ - if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g, + 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") /* 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, + 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") /* 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, + 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") /* Register the data transform property */ - if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, + 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") diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 73c48d7..8b9962f 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -428,7 +428,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, /* 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) + 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") /* Encode a terminator for list of properties */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7ba9c11..5320da1 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -398,7 +398,7 @@ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF; static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */ static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer mininum raw data size */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_reg_prop * @@ -419,110 +419,110 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, + if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* Register the threshold for alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, + 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") /* Register the alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + if(H5P__register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, 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") /* Register the file close degree */ - if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, + 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") /* 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, + 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") /* 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, + 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") /* Register the private property of whether convert family to sec2 driver. 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_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_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 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, + 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") /* 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, + 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") /* 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, + 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") @@ -530,116 +530,116 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, + 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") /* 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, + 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") /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, + if(H5P__register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, NULL, H5F_ACS_FILE_IMAGE_INFO_SET, 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") /* Register the core VFD backing store write tracking flag */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, + if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the core VFD backing store page size */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, + if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* Register the metadata cache log location. */ - if(H5P_register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g, + if(H5P__register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g, NULL, NULL, NULL, H5F_ACS_MDC_LOG_LOCATION_ENC, 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") /* 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, + 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") /* 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, + 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") #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, + 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") /* 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, + 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") #endif /* H5_HAVE_PARALLEL */ /* Register the initial metadata cache image configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, + if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, NULL, 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") @@ -648,7 +648,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_alignment * @@ -706,7 +706,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_alignment * @@ -747,7 +747,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_alignment() */ - + /*------------------------------------------------------------------------- * Function: H5P_set_driver * @@ -795,7 +795,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_set_driver() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_driver * @@ -838,7 +838,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_driver() */ - + /*------------------------------------------------------------------------- * Function: H5P_peek_driver * @@ -882,7 +882,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_peek_driver() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_driver * @@ -923,7 +923,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_driver() */ - + /*------------------------------------------------------------------------- * Function: H5P_peek_driver_info * @@ -965,7 +965,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_peek_driver_info() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_driver_info * @@ -1005,7 +1005,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_driver_info() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_driver_copy * @@ -1071,7 +1071,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_driver_free * @@ -1123,7 +1123,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_free() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_create * @@ -1152,7 +1152,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_create() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_set * @@ -1185,7 +1185,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_set() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_get * @@ -1218,7 +1218,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_get() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_del * @@ -1247,7 +1247,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_del() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_copy * @@ -1276,7 +1276,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_cmp * @@ -1335,7 +1335,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_close * @@ -1364,7 +1364,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_family_offset * @@ -1403,7 +1403,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_family_offset() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_family_offset * @@ -1444,7 +1444,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_family_offset() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_multi_type * @@ -1483,7 +1483,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_multi_type() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_multi_type * @@ -1524,7 +1524,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_multi_type() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_cache * @@ -1578,7 +1578,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_cache() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_cache * @@ -1630,7 +1630,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_cache() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_image_config * @@ -1674,7 +1674,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_mdc_image_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_image_config * @@ -1725,7 +1725,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_image_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_config * @@ -1769,7 +1769,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_mdc_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_config * @@ -1820,7 +1820,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_gc_references * @@ -1873,7 +1873,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_gc_references * @@ -1916,7 +1916,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pset_fclose_degree * @@ -1952,7 +1952,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_fclose_degree() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_fclose_degree * @@ -1987,7 +1987,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_fclose_degree() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_meta_block_size * @@ -2038,7 +2038,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_meta_block_size * @@ -2082,7 +2082,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pset_sieve_buf_size * @@ -2133,7 +2133,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_sieve_buf_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_sieve_buf_size * @@ -2176,7 +2176,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_sieve_buf_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_small_data_block_size * @@ -2222,7 +2222,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_small_data_block_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_small_data_block_size * @@ -2261,7 +2261,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_small_data_block_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_libver_bounds * @@ -2403,14 +2403,14 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_libver_bounds() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_libver_bounds * - * Purpose: Returns the current settings for the library version format bounds - * from a file access property list. + * Purpose: Returns the current settings for the library version format bounds + * from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, January 3, 2008 @@ -2446,7 +2446,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_libver_bounds() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_elink_file_cache_size * @@ -2484,7 +2484,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_elink_file_cache_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_elink_file_cache_size * @@ -2523,7 +2523,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_file_cache_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_file_image * @@ -2604,7 +2604,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_file_image() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_file_image * @@ -2693,7 +2693,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_file_image */ - + /*------------------------------------------------------------------------- * Function: H5Pset_file_image_callbacks * @@ -2770,7 +2770,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_file_image_callbacks() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_file_image_callbacks * @@ -2826,7 +2826,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_file_image_callbacks() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_image_info_copy * @@ -2904,7 +2904,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_image_info_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_image_info_free * @@ -2959,7 +2959,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_image_info_free() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_cmp * @@ -3002,7 +3002,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_image_config_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_enc * @@ -3048,7 +3048,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_cache_image_config_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_dec * @@ -3100,7 +3100,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_image_config_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_set * @@ -3133,7 +3133,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_set() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_get * @@ -3166,7 +3166,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_get() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_del * @@ -3197,7 +3197,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_del() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_copy * @@ -3227,7 +3227,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_cmp * @@ -3286,7 +3286,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_close * @@ -3316,7 +3316,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_close() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_cmp * @@ -3428,7 +3428,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_config_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_enc * @@ -3573,7 +3573,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_cache_config_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_dec * @@ -3708,7 +3708,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_config_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_fclose_degree_enc * @@ -3746,7 +3746,7 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_fclose_degree_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_fclose_degree_dec * @@ -3781,7 +3781,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_fclose_degree_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_multi_type_enc * @@ -3819,7 +3819,7 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_multi_type_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_multi_type_dec * @@ -3854,7 +3854,7 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_multi_type_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_libver_type_enc * @@ -3966,7 +3966,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_core_write_tracking() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_core_write_tracking * @@ -4008,7 +4008,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_core_write_tracking() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_metadata_read_attempts * @@ -4051,7 +4051,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_metadata_read_attempts() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_metadata_read_attempts * @@ -4092,7 +4092,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_metadata_read_attempts() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_obj_flush_cb * @@ -4136,7 +4136,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_obj_flush_cb() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_obj_flush_cb * @@ -4177,7 +4177,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_obj_flush_cb() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_log_options * @@ -4229,7 +4229,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_mdc_log_options() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_log_options * @@ -4284,7 +4284,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_mdc_log_options() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_enc * @@ -4337,7 +4337,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_dec * @@ -4391,7 +4391,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_mdc_log_location_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_del * @@ -4414,7 +4414,7 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_del() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_copy * @@ -4436,7 +4436,7 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_cmp * @@ -4468,7 +4468,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_mdc_log_location_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_close * @@ -4491,7 +4491,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_evict_on_close * @@ -4539,7 +4539,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_evict_on_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_evict_on_close * @@ -4583,7 +4583,7 @@ done: } /* end H5Pget_evict_on_close() */ #ifdef H5_HAVE_PARALLEL - + /*------------------------------------------------------------------------- * Function: H5P__encode_coll_md_read_flag_t * @@ -4621,7 +4621,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__encode_coll_md_read_flag_t() */ - + /*------------------------------------------------------------------------- * Function: H5P__decode_coll_md_read_flag_t * @@ -4655,7 +4655,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__decode_coll_md_read_flag_t() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_all_coll_metadata_ops * @@ -4714,7 +4714,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_all_coll_metadata_ops() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_all_coll_metadata_ops * @@ -4772,7 +4772,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_all_coll_metadata_ops */ - + /*------------------------------------------------------------------------- * Function: H5Pset_coll_metadata_write * @@ -4811,7 +4811,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_coll_metadata_write() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_coll_metadata_write * @@ -4849,7 +4849,7 @@ done: } /* end H5Pget_coll_metadata_write() */ #endif /* H5_HAVE_PARALLEL */ - + /*------------------------------------------------------------------------- * Function: H5Pset_page_buffer_size * @@ -4897,7 +4897,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_page_buffer_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_page_buffer_size * diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index f90dae5..56af8b1 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -36,7 +36,6 @@ #include "H5Bprivate.h" /* B-tree subclass names */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ -#include "H5SMprivate.h" /* Shared object header messages */ #include "H5Ppkg.h" /* Property lists */ @@ -213,85 +212,85 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT /* Register the user block size */ - if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g, + 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") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g, + 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") /* 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, + 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") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index e858a79..1e39749 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -124,7 +124,7 @@ H5P_fmnt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT /* 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, + 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") diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 6f1fab1..e2fdcea 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -32,12 +32,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -133,13 +133,13 @@ H5P__gcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register group info property */ - if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, + 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") /* Register link info property */ - if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, + 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") diff --git a/src/H5Pint.c b/src/H5Pint.c index 6a0cc14..179f883 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -100,11 +100,23 @@ typedef herr_t (*H5P_do_pclass_op_t)(H5P_genplist_t *plist, const char *name, H5 /********************/ /* General helper routines */ -static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); -static herr_t H5P_free_prop(H5P_genprop_t *prop); -static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); +static H5P_genplist_t *H5P__create(H5P_genclass_t *pclass); +static H5P_genprop_t *H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, + const void *value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, + H5P_prp_close_func_t prp_close); +static H5P_genprop_t *H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); +static herr_t H5P__free_prop(H5P_genprop_t *prop); +static int H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); static herr_t H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op, H5P_do_pclass_op_t pclass_op, void *udata); +static int H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key); +static H5P_genprop_t *H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name); +static herr_t H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data); +static herr_t H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data); /*********************/ @@ -336,7 +348,7 @@ static const H5I_class_t H5I_GENPROPCLS_CLS[1] = {{ H5I_GENPROP_CLS, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5P_close_class /* Callback routine for closing objects of this class */ + (H5I_free_t)H5P__close_class /* Callback routine for closing objects of this class */ }}; /* Generic Property List ID class */ @@ -425,7 +437,7 @@ H5P__init_package(void) HDassert(lib_class->par_pclass || lib_class == H5P_CLS_ROOT); /* Allocate the new class */ - if(NULL == (*lib_class->pclass = H5P_create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, 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))) + if(NULL == (*lib_class->pclass = H5P__create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, 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") /* Call routine to register properties for class */ @@ -626,14 +638,14 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) 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))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") /* Copy the changed value into the new property */ HDmemcpy(pcopy->value, tmp_value, prop->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(slist, pcopy) < 0) + if(H5P__add_prop(slist, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list") done: @@ -644,7 +656,7 @@ done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__do_prop_cb1() */ @@ -652,11 +664,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_copy_pclass + H5P__copy_pclass PURPOSE Internal routine to copy a generic property class USAGE - hid_t H5P_copy_pclass(pclass) + hid_t H5P__copy_pclass(pclass) H5P_genclass_t *pclass; IN: Property class to copy RETURNS Success: valid property class ID on success (non-negative) @@ -671,13 +683,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_copy_pclass(H5P_genclass_t *pclass) +H5P__copy_pclass(H5P_genclass_t *pclass) { H5P_genclass_t *new_pclass = NULL; /* Property list class copied */ H5P_genprop_t *pcopy; /* Copy of property to insert into class */ H5P_genclass_t *ret_value=NULL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); @@ -686,7 +698,7 @@ H5P_copy_pclass(H5P_genclass_t *pclass) */ /* Create the new property list class */ - 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))) + 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") /* Copy the properties registered for this class */ @@ -697,11 +709,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) curr_node=H5SL_first(pclass->props); 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))) + 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") /* Insert the initialized property into the property list */ - if(H5P_add_prop(new_pclass->props,pcopy) < 0) + if(H5P__add_prop(new_pclass->props,pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class") /* Increment property count for class */ @@ -716,11 +728,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) ret_value=new_pclass; done: - if(ret_value==NULL && new_pclass) - H5P_close_class(new_pclass); + if(NULL == ret_value && new_pclass) + H5P__close_class(new_pclass); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_pclass() */ +} /* H5P__copy_pclass() */ /*-------------------------------------------------------------------------- @@ -733,7 +745,7 @@ done: hid_t old_plist_id; IN: Property list ID to copy RETURNS Success: valid property list ID on success (non-negative) - Failure: negative + Failure: H5I_INVALID_HID DESCRIPTION Copy a property list and return the ID. This routine calls the class 'copy' callback after any property 'copy' callbacks are called @@ -756,9 +768,9 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) H5SL_t *seen=NULL; /* Skip list containing properties already seen */ size_t nseen; /* Number of items 'seen' */ hbool_t has_parent_class; /* Flag to indicate that this property list's class has a parent */ - hid_t ret_value=FAIL; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(old_plist); @@ -768,7 +780,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, FAIL,"memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Set class state */ new_plist->pclass = old_plist->pclass; @@ -777,80 +789,80 @@ 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,FAIL,"can't create skip list for changed properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "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,FAIL,"can't create skip list for deleted properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "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 * 'create' callback called, if a property in the class hierarchy has * 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") + 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") nseen = 0; /* Cycle through the deleted properties & copy them into the new list's deleted section */ - if(H5SL_count(old_plist->del)>0) { - curr_node=H5SL_first(old_plist->del); + if(H5SL_count(old_plist->del) > 0) { + curr_node = H5SL_first(old_plist->del); while(curr_node) { char *new_name; /* Pointer to new name */ /* 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,FAIL,"memory allocation failed") + if((new_name = H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) + 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,FAIL,"can't insert property into deleted skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "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,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ /* Cycle through the properties and copy them also */ - if(H5SL_count(old_plist->props)>0) { - curr_node=H5SL_first(old_plist->props); + if(H5SL_count(old_plist->props) > 0) { + curr_node = H5SL_first(old_plist->props); while(curr_node) { /* Get a pointer to the node's property */ tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* 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, FAIL,"Can't copy 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") /* 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, FAIL,"Can't copy property") + H5P__free_prop(new_prop); + 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, FAIL,"Can't insert property into 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") } /* 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,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; /* Increment the number of properties in list */ new_plist->nprops++; /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ @@ -860,27 +872,27 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) */ tclass=old_plist->pclass; has_parent_class = (hbool_t)(tclass != NULL && tclass->parent != NULL && tclass->parent->nprops > 0); - while(tclass!=NULL) { + while(tclass != NULL) { if(tclass->nprops>0) { /* Walk through the properties in the old class */ - curr_node=H5SL_first(tclass->props); + curr_node = H5SL_first(tclass->props); while(curr_node!=NULL) { /* Get pointer to property from node */ tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Only "copy" properties we haven't seen before */ - if(nseen==0 || H5SL_search(seen,tmp->name) == NULL) { + if(nseen == 0 || H5SL_search(seen,tmp->name) == NULL) { /* Call property copy callback, if it exists */ 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, FAIL,"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,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; } /* end if */ @@ -889,24 +901,24 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) } /* end if */ /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ /* 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, FAIL, "Can't increment class ref count") + 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") /* Get an atom for the property list */ if((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ - new_plist->plist_id=new_plist_id; + new_plist->plist_id = new_plist_id; /* Call the class callback (if it exists) now that we have the property list ID * (up through chain of parent classes also) @@ -917,7 +929,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, FAIL,"Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") } /* end if */ } /* end if */ @@ -933,10 +945,10 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) done: /* Release the list of 'seen' properties */ - if(seen!=NULL) + if(seen != NULL) H5SL_close(seen); - if(ret_value<0 && new_plist) + if(H5I_INVALID_HID == ret_value && new_plist) H5P_close(new_plist); FUNC_LEAVE_NOAPI(ret_value) @@ -945,11 +957,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_dup_prop + H5P__dup_prop PURPOSE Internal routine to duplicate a property USAGE - H5P_genprop_t *H5P_dup_prop(oprop) + H5P_genprop_t *H5P__dup_prop(oprop) H5P_genprop_t *oprop; IN: Pointer to property to copy H5P_prop_within_t type; IN: Type of object the property will be inserted into RETURNS @@ -963,12 +975,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) +H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) { H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(oprop); HDassert(type != H5P_PROP_WITHIN_UNKNOWN); @@ -1037,16 +1049,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_dup_prop() */ +} /* H5P__dup_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_create_prop + H5P__create_prop PURPOSE Internal routine to create a new property USAGE - H5P_genprop_t *H5P_create_prop(name,size,type,value,prp_create,prp_set, + H5P_genprop_t *H5P__create_prop(name,size,type,value,prp_create,prp_set, prp_get,prp_delete,prp_close, prp_encode, prp_decode) const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes @@ -1074,7 +1086,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, +H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, const void *value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -1085,7 +1097,7 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(name); HDassert((size > 0 && value != NULL) || (size == 0)); @@ -1141,16 +1153,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create_prop() */ +} /* H5P__create_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_add_prop + H5P__add_prop PURPOSE Internal routine to insert a property into a property skip list USAGE - herr_t H5P_add_prop(slist, prop) + herr_t H5P__add_prop(slist, prop) H5SL_t *slist; IN/OUT: Pointer to skip list of properties H5P_genprop_t *prop; IN: Pointer to property to insert RETURNS @@ -1163,11 +1175,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop) +H5P__add_prop(H5SL_t *slist, H5P_genprop_t *prop) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(slist); HDassert(prop); @@ -1179,7 +1191,7 @@ H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_add_prop() */ +} /* H5P__add_prop() */ /*-------------------------------------------------------------------------- @@ -1244,11 +1256,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_find_prop_pclass + H5P__find_prop_pclass PURPOSE Internal routine to check for a property in a class skip list USAGE - H5P_genprop_t *H5P_find_prop_class(pclass, name) + H5P_genprop_t *H5P__find_prop_class(pclass, name) H5P_genclass *pclass; IN: Pointer generic property class to check const char *name; IN: Name of property to check for RETURNS @@ -1261,11 +1273,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) +H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pclass); HDassert(name); @@ -1276,16 +1288,16 @@ H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_find_prop_pclass() */ +} /* H5P__find_prop_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_free_prop + H5P__free_prop PURPOSE Internal routine to destroy a property node USAGE - herr_t H5P_free_prop(prop) + herr_t H5P__free_prop(prop) H5P_genprop_t *prop; IN: Pointer to property to destroy RETURNS Returns non-negative on success, negative on failure. @@ -1298,9 +1310,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_prop(H5P_genprop_t *prop) +H5P__free_prop(H5P_genprop_t *prop) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(prop); @@ -1315,16 +1327,16 @@ H5P_free_prop(H5P_genprop_t *prop) prop = H5FL_FREE(H5P_genprop_t, prop); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_free_prop() */ +} /* H5P__free_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_free_prop_cb + H5P__free_prop_cb PURPOSE Internal routine to properties from a property skip list USAGE - herr_t H5P_free_prop_cb(item, key, op_data) + herr_t H5P__free_prop_cb(item, key, op_data) void *item; IN/OUT: Pointer to property void *key; IN/OUT: Pointer to property key void *_make_cb; IN: Whether to make property callbacks or not @@ -1339,12 +1351,12 @@ H5P_free_prop(H5P_genprop_t *prop) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) +H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) { H5P_genprop_t *tprop=(H5P_genprop_t *)item; /* Temporary pointer to property */ hbool_t make_cb = *(hbool_t *)op_data; /* Whether to make property 'close' callback */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(tprop); @@ -1353,19 +1365,19 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) (tprop->close)(tprop->name, tprop->size, tprop->value); /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(tprop); + H5P__free_prop(tprop); FUNC_LEAVE_NOAPI(0) -} /* H5P_free_prop_cb() */ +} /* H5P__free_prop_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_free_del_name_cb + H5P__free_del_name_cb PURPOSE Internal routine to free 'deleted' property name USAGE - herr_t H5P_free_del_name_cb(item, key, op_data) + herr_t H5P__free_del_name_cb(item, key, op_data) void *item; IN/OUT: Pointer to deleted name void *key; IN/OUT: Pointer to key void *op_data; IN: Operator callback data (unused) @@ -1379,11 +1391,11 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) +H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) { char *del_name=(char *)item; /* Temporary pointer to deleted name */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(del_name); @@ -1391,17 +1403,17 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * H5MM_xfree(del_name); FUNC_LEAVE_NOAPI(0) -} /* H5P_free_del_name_cb() */ +} /* H5P__free_del_name_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_access_class + H5P__access_class PURPOSE - Internal routine to increment or decrement list & class dependencies on a + Internal routine to increment or decrement list & class dependancies on a property list class USAGE - herr_t H5P_access_class(pclass,mod) + herr_t H5P__access_class(pclass,mod) H5P_genclass_t *pclass; IN: Pointer to class to modify H5P_class_mod_t mod; IN: Type of modification to class RETURNS @@ -1417,9 +1429,9 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) +H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); @@ -1473,27 +1485,27 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) if(pclass->props) { hbool_t make_cb = FALSE; - H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); + H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb); } /* end if */ pclass = H5FL_FREE(H5P_genclass_t, pclass); /* Reduce the number of dependent classes on parent class also */ if(par_class != NULL) - H5P_access_class(par_class, H5P_MOD_DEC_CLS); + H5P__access_class(par_class, H5P_MOD_DEC_CLS); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_access_class() */ +} /* H5P__access_class() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path_cb + H5P__open_class_path_cb PURPOSE Internal callback routine to check for duplicated names in parent class. USAGE - int H5P_open_class_path_cb(obj, id, key) + int H5P__open_class_path_cb(obj, id, key) H5P_genclass_t *obj; IN: Pointer to class hid_t id; IN: ID of object being looked at const void *key; IN: Pointer to information used to compare @@ -1509,13 +1521,13 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) REVISION LOG --------------------------------------------------------------------------*/ static int -H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) +H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) { H5P_genclass_t *obj = (H5P_genclass_t *)_obj; /* Pointer to the class for this ID */ H5P_check_class_t *key = (H5P_check_class_t *)_key; /* Pointer to key information for comparison */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(obj); HDassert(H5I_GENPROP_CLS == H5I_get_type(id)); @@ -1531,16 +1543,16 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_open_class_path_cb() */ +} /* end H5P__open_class_path_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_create_class + H5P__create_class PURPOSE Internal routine to create a new property list class. USAGE - H5P_genclass_t H5P_create_class(par_class, name, type, + H5P_genclass_t H5P__create_class(par_class, name, type, cls_create, create_data, cls_close, close_data) H5P_genclass_t *par_class; IN: Pointer to parent class const char *name; IN: Name of class we are creating @@ -1568,7 +1580,7 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, +H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data) @@ -1576,7 +1588,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t H5P_genclass_t *pclass = NULL; /* Property list class created */ H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE HDassert(name); /* Allow internal classes to break some rules */ @@ -1614,7 +1626,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t /* Increment parent class's derived class value */ if(par_class != NULL) { - if(H5P_access_class(par_class, H5P_MOD_INC_CLS) < 0) + 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") } /* end if */ @@ -1630,22 +1642,22 @@ done: if(pclass->props) { hbool_t make_cb = FALSE; - H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); + H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb); } /* end if */ pclass = H5FL_FREE(H5P_genclass_t, pclass); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create_class() */ +} /* H5P__create_class() */ /*-------------------------------------------------------------------------- NAME - H5P_create + H5P__create PURPOSE Internal routine to create a new property list of a property list class. USAGE - H5P_genplist_t *H5P_create(class) + H5P_genplist_t *H5P__create(class) H5P_genclass_t *class; IN: Property list class create list from RETURNS Returns a pointer to the newly created property list on success, @@ -1665,7 +1677,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genplist_t * -H5P_create(H5P_genclass_t *pclass) +H5P__create(H5P_genclass_t *pclass) { H5P_genclass_t *tclass; /* Temporary class pointer */ H5P_genplist_t *plist = NULL; /* New property list created */ @@ -1673,7 +1685,7 @@ H5P_create(H5P_genclass_t *pclass) H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */ H5P_genplist_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pclass); @@ -1748,7 +1760,7 @@ H5P_create(H5P_genclass_t *pclass) } /* end while */ /* Increment the number of property lists derived from class */ - if(H5P_access_class(plist->pclass,H5P_MOD_INC_LST) < 0) + if(H5P__access_class(plist->pclass,H5P_MOD_INC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment class ref count") /* Set return value */ @@ -1766,7 +1778,7 @@ done: if(plist->props) { unsigned make_cb=1; - H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); + H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb); } /* end if */ /* Close the deleted property skip list */ @@ -1779,7 +1791,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create() */ +} /* H5P__create() */ /*-------------------------------------------------------------------------- @@ -1791,7 +1803,7 @@ done: hid_t H5P_create_id(pclass) H5P_genclass_t *pclass; IN: Property list class create list from RETURNS - Returns a valid property list ID on success, FAIL on failure. + Returns a valid property list ID on success, H5I_INVALID_HID on failure. DESCRIPTION Creates a property list of a given class. If a 'create' callback exists for the property list class, it is called before the @@ -1812,20 +1824,20 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) hid_t plist_id = FAIL; /* Property list ID */ hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(pclass); /* Create the new property list */ - if((plist=H5P_create(pclass)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list") + if((plist = H5P__create(pclass)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") /* Get an atom for the property list */ if((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ - plist->plist_id=plist_id; + plist->plist_id = plist_id; /* Call the class callback (if it exists) now that we have the property list ID * (up through chain of parent classes also) @@ -1836,7 +1848,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, FAIL,"Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") } /* end if */ } /* end if */ @@ -1848,10 +1860,10 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) plist->class_init = TRUE; /* Set the return value */ - ret_value=plist_id; + ret_value = plist_id; done: - if(ret_value<0 && plist) + if(H5I_INVALID_HID == ret_value && plist) H5P_close(plist); FUNC_LEAVE_NOAPI(ret_value) @@ -1860,11 +1872,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_register_real + H5P__register_real PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register_real(class, name, size, default, prp_create, prp_set, + herr_t H5P__register_real(class, name, size, default, prp_create, prp_set, prp_get, prp_close, prp_encode, prp_decode) H5P_genclass_t *class; IN: Property list class to modify const char *name; IN: Name of property to register @@ -2043,7 +2055,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, +H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -2054,7 +2066,7 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, H5P_genprop_t *new_prop = NULL; /* Temporary property pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(0 == pclass->plists); @@ -2067,13 +2079,13 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, 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, + 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") /* Insert property into property list class */ - if(H5P_add_prop(pclass->props, new_prop) < 0) + if(H5P__add_prop(pclass->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -2084,20 +2096,20 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, done: if(ret_value < 0) - if(new_prop && H5P_free_prop(new_prop) < 0) + if(new_prop && H5P__free_prop(new_prop) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_register_real() */ +} /* H5P__register_real() */ /*-------------------------------------------------------------------------- NAME - H5P_register + H5P__register PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) + herr_t H5P__register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) H5P_genclass_t **class; IN: Property list class to modify const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes @@ -2275,7 +2287,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, +H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -2287,7 +2299,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, H5P_genclass_t *new_class = NULL; /* New class pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(ppclass); @@ -2297,7 +2309,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, * been created since the last modification was made to the class. */ if(pclass->plists > 0 || pclass->classes > 0) { - if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name, + 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))) @@ -2313,11 +2325,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, H5P_genprop_t *pcopy; /* Property copy */ /* 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))) + 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") /* Insert the initialized property into the property class */ - if(H5P_add_prop(new_class->props, pcopy) < 0) + if(H5P__add_prop(new_class->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -2333,7 +2345,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, } /* end if */ /* Really register the property in the class */ - if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, + 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") @@ -2343,11 +2355,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, done: if(ret_value < 0) - if(new_class && H5P_close_class(new_class) < 0) + if(new_class && H5P__close_class(new_class) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close new property class") FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_register() */ +} /* H5P__register() */ /*-------------------------------------------------------------------------- @@ -2570,13 +2582,13 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, /* Ok to add to property list */ /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, + 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") /* Insert property into property list class */ - if(H5P_add_prop(plist->props, new_prop) < 0) + if(H5P__add_prop(plist->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") /* Increment property count for class */ @@ -2584,7 +2596,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, done: if(ret_value < 0) - if(new_prop && H5P_free_prop(new_prop) < 0) + if(new_prop && H5P__free_prop(new_prop) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") FUNC_LEAVE_NOAPI(ret_value) @@ -2764,20 +2776,20 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop 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))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") HDmemcpy(pcopy->value, udata->value, pcopy->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props, pcopy) < 0) + if(H5P__add_prop(plist->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__poke_pclass_cb() */ @@ -2970,13 +2982,13 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, prp_value = udata->value; /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") HDmemcpy(pcopy->value, prp_value, pcopy->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props, pcopy) < 0) + if(H5P__add_prop(plist->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") done: @@ -2987,7 +2999,7 @@ done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__set_pclass_cb() */ @@ -3109,11 +3121,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_exist_pclass + H5P__exist_pclass PURPOSE Internal routine to query the existance of a property in a property class. USAGE - herr_t H5P_exist_pclass(pclass, name) + herr_t H5P__exist_pclass(pclass, name) H5P_genclass_t *pclass; IN: Property class to check const char *name; IN: Name of property to check for RETURNS @@ -3129,11 +3141,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) +H5P__exist_pclass(H5P_genclass_t *pclass, const char *name) { htri_t ret_value = FAIL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); HDassert(name); @@ -3159,16 +3171,16 @@ H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_exist_pclass() */ +} /* H5P__exist_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_get_size_plist + H5P__get_size_plist PURPOSE Internal routine to query the size of a property in a property list. USAGE - herr_t H5P_get_size_plist(plist, name) + herr_t H5P__get_size_plist(plist, name) const H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query size_t *size; OUT: Size of property @@ -3185,12 +3197,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) +H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(plist); HDassert(name); @@ -3205,16 +3217,16 @@ H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_size_plist() */ +} /* H5P__get_size_plist() */ /*-------------------------------------------------------------------------- NAME - H5P_get_size_pclass + H5P__get_size_pclass PURPOSE Internal routine to query the size of a property in a property class. USAGE - herr_t H5P_get_size_pclass(pclass, name) + herr_t H5P__get_size_pclass(pclass, name) H5P_genclass_t *pclass; IN: Property class to check const char *name; IN: Name of property to query size_t *size; OUT: Size of property @@ -3231,36 +3243,36 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) +H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(name); HDassert(size); /* Find property */ - if((prop=H5P_find_prop_pclass(pclass,name)) == NULL) + if((prop = H5P__find_prop_pclass(pclass,name)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Get property size */ - *size=prop->size; + *size = prop->size; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_size_pclass() */ +} /* H5P__get_size_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_get_nprops_plist + H5P__get_nprops_plist PURPOSE Internal routine to query the number of properties in a property list USAGE - herr_t H5P_get_nprops_plist(plist, nprops) + herr_t H5P__get_nprops_plist(plist, nprops) H5P_genplist_t *plist; IN: Property list to check size_t *nprops; OUT: Number of properties in the property list RETURNS @@ -3275,9 +3287,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) +H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(plist); HDassert(nprops); @@ -3286,7 +3298,7 @@ H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) *nprops = plist->nprops; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_get_nprops_plist() */ +} /* H5P__get_nprops_plist() */ /*-------------------------------------------------------------------------- @@ -3337,11 +3349,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_cmp_prop + H5P__cmp_prop PURPOSE Internal routine to compare two generic properties USAGE - int H5P_cmp_prop(prop1, prop2) + int H5P__cmp_prop(prop1, prop2) H5P_genprop_t *prop1; IN: 1st property to compare H5P_genprop_t *prop1; IN: 2nd property to compare RETURNS @@ -3358,12 +3370,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) +H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) { int cmp_value; /* Value from comparison */ int ret_value = 0; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(prop1); HDassert(prop2); @@ -3432,16 +3444,16 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_prop() */ +} /* H5P__cmp_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_cmp_class + H5P__cmp_class PURPOSE Internal routine to compare two generic property classes USAGE - int H5P_cmp_class(pclass1, pclass2) + int H5P__cmp_class(pclass1, pclass2) H5P_genclass_t *pclass1; IN: 1st property class to compare H5P_genclass_t *pclass2; IN: 2nd property class to compare RETURNS @@ -3458,13 +3470,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) +H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) { H5SL_node_t *tnode1, *tnode2; /* Temporary pointer to property nodes */ int cmp_value; /* Value from comparison */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass1); HDassert(pclass2); @@ -3528,7 +3540,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) /* Compare the two properties */ prop1 = (H5P_genprop_t *)H5SL_item(tnode1); prop2 = (H5P_genprop_t *)H5SL_item(tnode2); - if((cmp_value = H5P_cmp_prop(prop1, prop2)) != 0) + if((cmp_value = H5P__cmp_prop(prop1, prop2)) != 0) HGOTO_DONE(cmp_value); /* Advance the pointers */ @@ -3538,7 +3550,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_class() */ +} /* H5P__cmp_class() */ /*-------------------------------------------------------------------------- @@ -3588,7 +3600,7 @@ H5P__cmp_plist_cb(H5P_genprop_t *prop, void *_udata) 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) + if((udata->cmp_value = H5P__cmp_prop(prop, prop2)) != 0) HGOTO_DONE(H5_ITER_STOP); } /* end if */ else { @@ -3604,11 +3616,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_cmp_plist + H5P__cmp_plist PURPOSE Internal routine to compare two generic property lists USAGE - herr_t H5P_cmp_plist(plist1, plist2, cmp_ret) + herr_t H5P__cmp_plist(plist1, plist2, cmp_ret) H5P_genplist_t *plist1; IN: 1st property list to compare H5P_genplist_t *plist2; IN: 2nd property list to compare int *cmp_ret; OUT: Comparison value for two property lists @@ -3627,14 +3639,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, +H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int *cmp_ret) { H5P_plist_cmp_ud_t udata; /* User data for callback */ int idx = 0; /* Index of property to begin with */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(plist1); HDassert(plist2); @@ -3665,7 +3677,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, udata.plist2 = plist2; /* Iterate over properties in first property list */ - if((ret_value = H5P_iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0) + 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") if(ret_value != 0) { *cmp_ret = udata.cmp_value; @@ -3673,7 +3685,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, } /* end if */ /* Check the parent classes */ - if((*cmp_ret = H5P_cmp_class(plist1->pclass, plist2->pclass)) != 0) + if((*cmp_ret = H5P__cmp_class(plist1->pclass, plist2->pclass)) != 0) HGOTO_DONE(SUCCEED); /* Property lists must be equal, set comparison value to 0 */ @@ -3681,7 +3693,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_plist() */ +} /* H5P__cmp_plist() */ /*-------------------------------------------------------------------------- @@ -3718,7 +3730,7 @@ H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) HDassert(pclass2); /* Compare property classes */ - if(H5P_cmp_class(pclass1, pclass2) == 0) { + if(H5P__cmp_class(pclass1, pclass2) == 0) { HGOTO_DONE(TRUE); } else { /* Check if the class is derived, and walk up the chain, if so */ @@ -3931,11 +3943,11 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata) /*-------------------------------------------------------------------------- NAME - H5P_iterate_plist + H5P__iterate_plist PURPOSE Internal routine to iterate over the properties in a property list USAGE - int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data) + int H5P__iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data) const H5P_genplist_t *plist; IN: Property list to iterate over hbool_t iter_all_prop; IN: Whether to iterate over all properties (TRUE), or just non-default (i.e. changed) @@ -3984,7 +3996,7 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, +H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, H5P_iterate_int_t cb_func, void *udata) { H5P_genclass_t *tclass; /* Temporary class pointer */ @@ -3993,7 +4005,7 @@ H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, int curr_idx = 0; /* Current iteration index */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(plist); @@ -4042,7 +4054,7 @@ done: H5SL_close(seen); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_iterate_plist() */ +} /* H5P__iterate_plist() */ /*-------------------------------------------------------------------------- @@ -4098,11 +4110,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_iterate_pclass + H5P__iterate_pclass PURPOSE Internal routine to iterate over the properties in a property class USAGE - herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data) + herr_t H5P__iterate_pclass(pclass, idx, cb_func, iter_data) const H5P_genpclass_t *pclass; IN: Property list class to iterate over int *idx; IN/OUT: Index of the property to begin with H5P_iterate_t cb_func; IN: Function pointer to function to be @@ -4148,14 +4160,14 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, +H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx, H5P_iterate_int_t cb_func, void *udata) { H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */ int curr_idx = 0; /* Current iteration index */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(pclass); @@ -4178,7 +4190,7 @@ done: *idx = curr_idx; FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_iterate_pclass() */ +} /* H5P__iterate_pclass() */ /*-------------------------------------------------------------------------- @@ -4450,7 +4462,7 @@ H5P__del_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, 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); + H5P__free_prop(prop); /* Decrement the number of properties in list */ plist->nprops--; @@ -4586,11 +4598,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_copy_prop_plist + H5P__copy_prop_plist PURPOSE Internal routine to copy a property from one list to another USAGE - herr_t H5P_copy_prop_plist(dst_plist, src_plist, name) + herr_t H5P__copy_prop_plist(dst_plist, src_plist, name) hid_t dst_id; IN: ID of destination property list or class hid_t src_id; IN: ID of source property list or class const char *name; IN: Name of property to copy @@ -4616,7 +4628,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) +H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) { H5P_genplist_t *dst_plist; /* Pointer to destination property list */ H5P_genplist_t *src_plist; /* Pointer to source property list */ @@ -4624,7 +4636,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *new_prop=NULL; /* Pointer to new property */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(name); @@ -4642,7 +4654,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) 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) + if((new_prop = H5P__dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") /* Call property copy callback, if it exists */ @@ -4652,7 +4664,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) } /* end if */ /* Insert the initialized property into the property list */ - if(H5P_add_prop(dst_plist->props,new_prop) < 0) + if(H5P__add_prop(dst_plist->props,new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list") /* Increment the number of properties in list */ @@ -4664,7 +4676,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) prop = H5P__find_prop_plist(src_plist, name); /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, + 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") @@ -4676,7 +4688,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) } /* end if */ /* Insert property into property list class */ - if(H5P_add_prop(dst_plist->props, new_prop) < 0) + if(H5P__add_prop(dst_plist->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -4685,22 +4697,22 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) done: /* Cleanup, if necessary */ - if(ret_value<0) { - if(new_prop!=NULL) - H5P_free_prop(new_prop); + if(ret_value < 0) { + if(new_prop != NULL) + H5P__free_prop(new_prop); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_prop_plist() */ +} /* H5P__copy_prop_plist() */ /*-------------------------------------------------------------------------- NAME - H5P_copy_prop_pclass + H5P__copy_prop_pclass PURPOSE Internal routine to copy a property from one class to another USAGE - herr_t H5P_copy_prop_pclass(dst_pclass, src_pclass, name) + herr_t H5P__copy_prop_pclass(dst_pclass, src_pclass, name) H5P_genclass_t *dst_pclass; IN: Pointer to destination class H5P_genclass_t *src_pclass; IN: Pointer to source class const char *name; IN: Name of property to copy @@ -4724,7 +4736,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) +H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) { H5P_genclass_t *src_pclass; /* Source property class, containing property to copy */ H5P_genclass_t *dst_pclass; /* Destination property class */ @@ -4732,7 +4744,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(name); @@ -4744,19 +4756,19 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) 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))) + if(NULL == (prop = H5P__find_prop_pclass(src_pclass, name))) 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)) { + if(H5P__exist_pclass(dst_pclass, name)) { /* Delete the old property from the destination class */ - if(H5P_unregister(dst_pclass, name) < 0) + if(H5P__unregister(dst_pclass, name) < 0) 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, + 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") @@ -4770,7 +4782,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) HDassert(old_dst_pclass == orig_dst_pclass); /* Close the previous class */ - if(H5P_close_class(old_dst_pclass) < 0) + if(H5P__close_class(old_dst_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ @@ -4778,16 +4790,16 @@ done: /* Cleanup, if necessary */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_prop_pclass() */ +} /* H5P__copy_prop_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_unregister + H5P__unregister PURPOSE Internal routine to remove a property from a property list class. USAGE - herr_t H5P_unregister(pclass, name) + herr_t H5P__unregister(pclass, name) H5P_genclass_t *pclass; IN: Property list class to modify const char *name; IN: Name of property to remove RETURNS @@ -4803,12 +4815,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_unregister(H5P_genclass_t *pclass, const char *name) +H5P__unregister(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(name); @@ -4822,7 +4834,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) 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); + H5P__free_prop(prop); /* Decrement the number of registered properties in class */ pclass->nprops--; @@ -4832,7 +4844,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_unregister() */ +} /* H5P__unregister() */ /*-------------------------------------------------------------------------- @@ -4982,18 +4994,18 @@ H5P_close(void *_plist) } /* end while */ /* Decrement class's dependent property list value! */ - if(H5P_access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) + if(H5P__access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count") /* Free the list of 'seen' properties */ H5SL_close(seen); - seen=NULL; + seen = NULL; /* Free the list of deleted property names */ - H5SL_destroy(plist->del,H5P_free_del_name_cb,NULL); + H5SL_destroy(plist->del, H5P__free_del_name_cb, NULL); /* Free the properties */ - H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); + H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb); /* Destroy property list object */ plist = H5FL_FREE(H5P_genplist_t, plist); @@ -5046,11 +5058,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_get_class_path + H5P__get_class_path PURPOSE Internal routine to query the full path of a generic property list class USAGE - char *H5P_get_class_name(pclass) + char *H5P__get_class_name(pclass) H5P_genclass_t *pclass; IN: Property list class to check RETURNS Success: Pointer to a malloc'ed string containing the full path of class @@ -5066,11 +5078,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ char * -H5P_get_class_path(H5P_genclass_t *pclass) +H5P__get_class_path(H5P_genclass_t *pclass) { char *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); @@ -5079,7 +5091,7 @@ H5P_get_class_path(H5P_genclass_t *pclass) char *par_path; /* Parent class's full path */ /* Get the parent class's path */ - par_path = H5P_get_class_path(pclass->parent); + par_path = H5P__get_class_path(pclass->parent); if(par_path != NULL) { size_t ret_str_len; @@ -5104,16 +5116,16 @@ H5P_get_class_path(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_path() */ +} /* H5P__get_class_path() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path + H5P__open_class_path PURPOSE Internal routine to open [a copy of] a class with its full path name USAGE - H5P_genclass_t *H5P_open_class_path(path) + H5P_genclass_t *H5P__open_class_path(path) const char *path; IN: Full path name of class to open [copy of] RETURNS Success: Pointer to a generic property class object @@ -5127,7 +5139,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_open_class_path(const char *path) +H5P__open_class_path(const char *path) { char *tmp_path = NULL; /* Temporary copy of the path */ char *curr_name; /* Pointer to current component of path name */ @@ -5136,7 +5148,7 @@ H5P_open_class_path(const char *path) H5P_check_class_t check_info; /* Structure to hold the information for checking duplicate names */ H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(path); @@ -5157,8 +5169,8 @@ H5P_open_class_path(const char *path) check_info.new_class = NULL; /* 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") + 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") else if(NULL == check_info.new_class) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") @@ -5175,13 +5187,13 @@ H5P_open_class_path(const char *path) check_info.new_class = NULL; /* 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) + 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") else if(NULL == check_info.new_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))) + if(NULL == (ret_value = H5P__copy_pclass(check_info.new_class))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class") done: @@ -5189,16 +5201,16 @@ done: H5MM_xfree(tmp_path); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_open_class_path() */ +} /* H5P__open_class_path() */ /*-------------------------------------------------------------------------- NAME - H5P_get_class_parent + H5P__get_class_parent PURPOSE Internal routine to query the parent class of a generic property class USAGE - H5P_genclass_t *H5P_get_class_parent(pclass) + H5P_genclass_t *H5P__get_class_parent(pclass) H5P_genclass_t *pclass; IN: Property class to check RETURNS Success: Pointer to the parent class of a property class @@ -5212,11 +5224,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_get_class_parent(const H5P_genclass_t *pclass) +H5P__get_class_parent(const H5P_genclass_t *pclass) { H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); @@ -5224,16 +5236,16 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) ret_value = pclass->parent; FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_parent() */ +} /* H5P__get_class_parent() */ /*-------------------------------------------------------------------------- NAME - H5P_close_class + H5P__close_class PURPOSE Internal routine to close a property list class. USAGE - herr_t H5P_close_class(class) + herr_t H5P__close_class(class) H5P_genclass_t *class; IN: Property list class to close RETURNS Returns non-negative on success, negative on failure. @@ -5245,7 +5257,7 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_close_class(void *_pclass) +H5P__close_class(void *_pclass) { H5P_genclass_t *pclass = (H5P_genclass_t *)_pclass; herr_t ret_value = SUCCEED; /* Return value */ @@ -5255,12 +5267,12 @@ H5P_close_class(void *_pclass) HDassert(pclass); /* Decrement the reference count & check if the object should go away */ - if(H5P_access_class(pclass, H5P_MOD_DEC_REF) < 0) + if(H5P__access_class(pclass, H5P_MOD_DEC_REF) < 0) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't decrement ID ref count") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_close_class() */ +} /* H5P__close_class() */ /*------------------------------------------------------------------------- @@ -5269,7 +5281,7 @@ done: * Purpose: Create a new property list, of a given type * * Return: Success: ID of new property list - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Thursday, August 2, 2012 @@ -5291,9 +5303,9 @@ H5P__new_plist_of_type(H5P_plist_type_t type) /* Check arguments */ if(type == H5P_TYPE_USER) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't create user property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "can't create user property list"); if(type == H5P_TYPE_ROOT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "shouldn't be creating root class property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "shouldn't be creating root class property list"); /* Instantiate a property list of the proper type */ switch(type) { @@ -5374,11 +5386,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, FAIL, "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, FAIL, "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) @@ -5394,7 +5406,7 @@ done: * H5P_genplist_t data structure) * * Return: Success: Non-negative ID of property list. - * Failure: negative. + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * April 22, 2014 @@ -5440,32 +5452,3 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ - -/*------------------------------------------------------------------------- - * Function: H5P_get_default - * - * Purpose: Get the default property list ID, for a property class. - * - * Return: Success: Non-negative ID of property list. - * Failure: negative. - * - * Programmer: Quincey Koziol - * December 29, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5P_get_default(const H5P_libclass_t *libclass) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_NOAPI(H5I_INVALID_HID) - - HDassert(libclass); - - ret_value = *libclass->def_plist_id; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_default() */ - diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 18b81ac..bedeed9 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -194,38 +194,38 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register property for number of links traversed */ - if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, + 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") /* Register property for external link prefix */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, NULL, H5L_ACS_ELINK_PREFIX_SET, H5L_ACS_ELINK_PREFIX_GET, 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") /* 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, + 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") /* 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, + 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") /* 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, + 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") #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, + 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") @@ -569,7 +569,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_ if(obj1 && obj2) { herr_t status; - status = H5P_cmp_plist(obj1, obj2, &ret_value); + status = H5P__cmp_plist(obj1, obj2, &ret_value); HDassert(status >= 0); } /* end if */ diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 6508a82..1d45bed 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Plcpl.c - * May 8 2006 - * Peter Cao + * Created: H5Plcpl.c * - * Purpose: Link creation property list class routines + * Purpose: Link creation property list class routines * *------------------------------------------------------------------------- */ @@ -32,11 +30,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -120,12 +118,12 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Register create intermediate groups property */ - if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, + 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") diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index be41e32..c2bf6cb 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -165,25 +165,25 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register max. compact attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, + 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") /* 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, + 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") /* 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, + 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") /* Register the pipeline property */ - if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, + 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") @@ -899,7 +899,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, filter = &pline.filter[idx]; /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) + 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") /* Set return value */ @@ -952,7 +952,7 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags 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) + 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") done: @@ -1118,7 +1118,7 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_filter_by_id() */ +} /* end H5P_filter_in_pline() */ /*------------------------------------------------------------------------- @@ -1292,7 +1292,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_filter + * Function: H5P__get_filter * * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id * @@ -1304,12 +1304,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, +H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/, unsigned *filter_config /*out*/) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(filter); @@ -1364,7 +1364,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, H5Z_get_filter_info(filter->id, filter_config); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_get_filter() */ +} /* end H5P__get_filter() */ /*------------------------------------------------------------------------- @@ -1893,7 +1893,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, filter = &pline.filter[idx]; /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) + 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") /* Set return value */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 47bba05..666a945 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -161,20 +161,20 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register copy options property */ - if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, + 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") /* 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, &H5O_def_merge_comm_dtype_list_g, + if(H5P__register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET, H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC, 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") /* 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, + 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") diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 19ff7f9..13f3b13 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -129,48 +129,48 @@ struct H5Z_filter_info_t; /******************************/ /* Private functions, not part of the publicly documented API */ -H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, +H5_DLL H5P_genclass_t *H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data); -H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass); -H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, +H5_DLL H5P_genclass_t *H5P__copy_pclass(H5P_genclass_t *pclass); +H5_DLL herr_t H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t size, +H5_DLL herr_t H5P__register(H5P_genclass_t **pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); -H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); -H5_DLL htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name); -H5_DLL herr_t H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, +H5_DLL herr_t H5P__add_prop(H5SL_t *props, H5P_genprop_t *prop); +H5_DLL herr_t H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); +H5_DLL htri_t H5P__exist_pclass(H5P_genclass_t *pclass, const char *name); +H5_DLL herr_t H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size); -H5_DLL herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, +H5_DLL herr_t H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size); -H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); -H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); -H5_DLL herr_t H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, +H5_DLL herr_t H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); +H5_DLL int H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); +H5_DLL herr_t H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int *cmp_ret); -H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, +H5_DLL int H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, H5P_iterate_int_t iter_func, void *iter_data); -H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, +H5_DLL int H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx, H5P_iterate_int_t iter_func, void *iter_data); -H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); -H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); -H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); -H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass); -H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path); -H5_DLL H5P_genclass_t *H5P_get_class_parent(const H5P_genclass_t *pclass); -H5_DLL herr_t H5P_close_class(void *_pclass); +H5_DLL herr_t H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); +H5_DLL herr_t H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); +H5_DLL herr_t H5P__unregister(H5P_genclass_t *pclass, const char *name); +H5_DLL char *H5P__get_class_path(H5P_genclass_t *pclass); +H5_DLL H5P_genclass_t *H5P__open_class_path(const char *path); +H5_DLL H5P_genclass_t *H5P__get_class_parent(const H5P_genclass_t *pclass); +H5_DLL herr_t H5P__close_class(void *_pclass); H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name); H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type); @@ -194,7 +194,7 @@ H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, siz H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ -H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, +H5_DLL herr_t H5P__get_filter(const struct H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 1a2bb95..7792671 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -190,7 +190,6 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); -H5_DLL hid_t H5P_get_default(const H5P_libclass_t *pclass); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index fb91356..45343c6 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -130,7 +130,7 @@ H5P__strcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register character encoding */ - if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g, + 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") diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 075040d..114b37b 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -68,7 +68,7 @@ H5P__get_class_path_test(hid_t pclass_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class"); /* Get the property list class path */ - if(NULL == (ret_value = H5P_get_class_path(pclass))) + if(NULL == (ret_value = H5P__get_class_path(pclass))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class") done: @@ -109,7 +109,7 @@ H5P__open_class_path_test(const char *path) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid class path"); /* Open the property list class */ - if(NULL == (pclass = H5P_open_class_path(path))) + if(NULL == (pclass = H5P__open_class_path(path))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path"); /* Get an atom for the class */ @@ -118,7 +118,7 @@ H5P__open_class_path_test(const char *path) done: if(H5I_INVALID_HID == ret_value && pclass) - H5P_close_class(pclass); + H5P__close_class(pclass); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__open_class_path_test() */ diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index e8ea044..d81dba1 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -15,7 +15,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): not a location ID major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid object ID + #001: (file name) line (number) in H5G_loc(): invalid location ID major: Invalid arguments to routine minor: Bad value @@ -43,7 +43,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): not a location ID major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid object ID + #001: (file name) line (number) in H5G_loc(): invalid location ID major: Invalid arguments to routine minor: Bad value -- cgit v0.12 From 30cd579a149acb063e258aac89bbe7fef3f5ac0a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 24 Sep 2018 08:35:13 -0700 Subject: H5S adjust callbacks now return an herr_t instead of void. --- src/H5S.c | 4 ++-- src/H5Sall.c | 10 +++++----- src/H5Shyper.c | 8 ++++---- src/H5Snone.c | 10 +++++----- src/H5Spkg.h | 2 +- src/H5Spoint.c | 12 ++++++------ src/H5Sprivate.h | 2 +- src/H5Sselect.c | 12 +++++++----- 8 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/H5S.c b/src/H5S.c index 88c2f72..4c11268 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1974,7 +1974,7 @@ done: /*------------------------------------------------------------------------- * Function: H5S_set_extent * - * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend + * Purpose: Modify the dimensions of a dataspace. * * Return: Success: Non-negative * Failure: Negative @@ -2055,7 +2055,7 @@ H5S_has_extent(const H5S_t *ds) /*------------------------------------------------------------------------- * Function: H5S_set_extent_real * - * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend + * Purpose: Modify the dimensions of a dataspace. * * Return: Success: Non-negative * Failure: Negative diff --git a/src/H5Sall.c b/src/H5Sall.c index 28395b1..3b77b98 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -46,7 +46,7 @@ static int H5S__all_unlim_dim(const H5S_t *space); static htri_t H5S__all_is_contiguous(const H5S_t *space); static htri_t H5S__all_is_single(const H5S_t *space); static htri_t H5S__all_is_regular(const H5S_t *space); -static void H5S__all_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -785,11 +785,11 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Adjust an "all" selection by subtracting an offset USAGE - void H5S__all_adjust_u(space, offset) + herr_t H5S__all_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves selection by subtracting an offset from it. GLOBAL VARIABLES @@ -797,7 +797,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) { FUNC_ENTER_STATIC_NOERR @@ -806,7 +806,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off HDassert(space); HDassert(offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S__all_adjust_u() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 7a6d1be..ed3fa45 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -92,7 +92,7 @@ static herr_t H5S__hyper_num_elem_non_unlim(const H5S_t *space, static htri_t H5S__hyper_is_contiguous(const H5S_t *space); static htri_t H5S__hyper_is_single(const H5S_t *space); static htri_t H5S__hyper_is_regular(const H5S_t *space); -static void H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -4203,7 +4203,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a hyperslab selection by subtracting an offset from it. GLOBAL VARIABLES @@ -4211,7 +4211,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) { FUNC_ENTER_STATIC_NOERR @@ -4238,7 +4238,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst); } /* end if */ - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_adjust_u() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index a46a71a..a8aaf7e 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -47,7 +47,7 @@ static int H5S__none_unlim_dim(const H5S_t *space); static htri_t H5S_none_is_contiguous(const H5S_t *space); static htri_t H5S_none_is_single(const H5S_t *space); static htri_t H5S_none_is_regular(const H5S_t *space); -static void H5S_none_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S_none_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -744,11 +744,11 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Adjust an "none" selection by subtracting an offset USAGE - void H5S_none_adjust_u(space, offset) + herr_t H5S_none_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves selection by subtracting an offset from it. GLOBAL VARIABLES @@ -756,7 +756,7 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -765,7 +765,7 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off HDassert(space); HDassert(offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_none_adjust_u() */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 6ded287..d895f40 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -161,7 +161,7 @@ typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space); /* Method to determine if current selection is "regular" */ typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space); /* Method to adjust a selection by an offset */ -typedef void (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset); +typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset); /* Method to construct single element projection onto scalar dataspace */ typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset); /* Method to construct selection projection onto/into simple dataspace */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index fb8e311..9924920 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -48,7 +48,7 @@ static int H5S__point_unlim_dim(const H5S_t *space); static htri_t H5S_point_is_contiguous(const H5S_t *space); static htri_t H5S_point_is_single(const H5S_t *space); static htri_t H5S_point_is_regular(const H5S_t *space); -static void H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -686,7 +686,7 @@ done: static htri_t H5S_point_is_valid (const H5S_t *space) { - H5S_pnt_node_t *curr; /* Point information nodes */ + H5S_pnt_node_t *curr; /* Point information nodes */ unsigned u; /* Counter */ htri_t ret_value = TRUE; /* Return value */ @@ -1354,11 +1354,11 @@ H5S_point_is_regular(const H5S_t *space) PURPOSE Adjust a "point" selection by subtracting an offset USAGE - void H5S_point_adjust_u(space, offset) + herr_t H5S_point_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a point selection by subtracting an offset from it. GLOBAL VARIABLES @@ -1366,7 +1366,7 @@ H5S_point_is_regular(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) { H5S_pnt_node_t *node; /* Point node */ @@ -1396,7 +1396,7 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) node = node->next; } /* end while */ - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_adjust_u() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 15ce75d..32ac51a 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -259,7 +259,7 @@ H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); -H5_DLL void H5S_select_adjust_u(H5S_t *space, const hsize_t *offset); +H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset); H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset); H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); H5_DLL herr_t H5S_select_project_intersection(const H5S_t *src_space, diff --git a/src/H5Sselect.c b/src/H5Sselect.c index ec74523..2ce3f10 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -893,11 +893,11 @@ H5S_select_is_regular(const H5S_t *space) PURPOSE Adjust a selection by subtracting an offset USAGE - void H5S_select_adjust_u(space, offset) + herr_t H5S_select_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a selection by subtracting an offset from it. GLOBAL VARIABLES @@ -908,18 +908,20 @@ H5S_select_is_regular(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void +herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) { + herr_t ret_value = FAIL; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(space); HDassert(offset); - (*space->select.type->adjust_u)(space, offset); + ret_value = (*space->select.type->adjust_u)(space, offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_select_adjust_u() */ -- cgit v0.12 From a56b4db4ae25d30e6e7eb96f27d7b91e35148591 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 24 Sep 2018 12:23:41 -0700 Subject: Remainder of vol_normalization changes (dataset, attribute, files, objects). --- src/H5A.c | 532 ++++++++++---------- src/H5Adense.c | 174 +++---- src/H5Adeprec.c | 131 ++--- src/H5Aint.c | 192 ++++---- src/H5Apkg.h | 1 + src/H5D.c | 544 +++++++++++---------- src/H5Dbtree.c | 9 +- src/H5Dbtree2.c | 2 +- src/H5Dchunk.c | 73 ++- src/H5Ddbg.c | 29 +- src/H5Ddeprec.c | 134 +++--- src/H5Dfill.c | 2 +- src/H5Dint.c | 134 +++--- src/H5Dio.c | 59 ++- src/H5Dlayout.c | 4 +- src/H5Dmpio.c | 3 +- src/H5Doh.c | 10 +- src/H5Dpkg.h | 22 +- src/H5Dscatgath.c | 12 +- src/H5Dsingle.c | 8 +- src/H5Dvirtual.c | 8 +- src/H5F.c | 772 ++++++++++++++++++++---------- src/H5Fdeprec.c | 34 +- src/H5Fint.c | 638 ++++++++++++------------ src/H5Fio.c | 6 +- src/H5Fmount.c | 4 +- src/H5Fmpi.c | 12 +- src/H5Fpkg.h | 27 +- src/H5Fprivate.h | 5 +- src/H5Fsfile.c | 54 +-- src/H5Fsuper.c | 115 ++--- src/H5Fsuper_cache.c | 1 - src/H5G.c | 238 +++++---- src/H5Gcompact.c | 33 +- src/H5Gdense.c | 5 +- src/H5Gdeprec.c | 157 +++--- src/H5Gint.c | 68 +-- src/H5Gname.c | 2 +- src/H5Gpkg.h | 1 - src/H5Gprivate.h | 6 +- src/H5Gtraverse.c | 50 +- src/H5L.c | 557 +++++++++++---------- src/H5Lprivate.h | 15 + src/H5O.c | 244 +++++----- src/H5Oalloc.c | 134 +++--- src/H5Oattr.c | 110 ++--- src/H5Oattribute.c | 322 +++++++------ src/H5Obogus.c | 2 +- src/H5Ocache.c | 20 +- src/H5Ochunk.c | 58 +-- src/H5Ocont.c | 38 +- src/H5Ocopy.c | 54 +-- src/H5Odbg.c | 125 +++-- src/H5Odeprec.c | 40 +- src/H5Odtype.c | 14 +- src/H5Ofill.c | 6 +- src/H5Oflush.c | 137 +++--- src/H5Oginfo.c | 4 +- src/H5Oint.c | 166 ++++--- src/H5Olinfo.c | 12 +- src/H5Omessage.c | 84 ++-- src/H5Omtime.c | 4 +- src/H5Opkg.h | 43 +- src/H5Oprivate.h | 12 +- src/H5Oshared.c | 107 +++-- src/H5Oshared.h | 24 +- src/H5Ostab.c | 44 +- src/H5Otest.c | 6 +- src/H5Ounknown.c | 6 +- tools/test/h5dump/errfiles/tattr-3.err | 2 +- tools/test/h5dump/errfiles/tqmarkfile.err | 4 +- tools/testfiles/tstarfile.ddl | 4 +- 72 files changed, 3443 insertions(+), 3266 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index a0408c3..6f810be 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -16,22 +16,21 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* Suppress error about including H5Opkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspace functions */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspace functions */ /****************/ @@ -123,7 +122,7 @@ H5A__init_package(void) * Create attribute ID type. */ if(H5I_register_type(H5I_ATTR_CLS) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Mark "top" of interface as initialized, too */ H5A_top_package_initialize_s = TRUE; @@ -216,33 +215,38 @@ H5A_term_package(void) /*-------------------------------------------------------------------------- - NAME - H5Acreate2 - PURPOSE - Creates an attribute on an object - USAGE - hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, - aapl_id) - hid_t loc_id; IN: Object (dataset or group) to be attached to - const char *attr_name; IN: Name of attribute to locate and open - hid_t type_id; IN: ID of datatype for attribute - hid_t space_id; IN: ID of dataspace for attribute - hid_t acpl_id; IN: ID of creation property list (currently not used) - hid_t aapl_id; IN: Attribute access property list - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function creates an attribute which is attached to the object - specified with 'loc_id'. The name specified with 'attr_name' for - each attribute for an object must be unique for that object. The 'type_id' - and 'space_id' are created with the H5T and H5S interfaces respectively. - The 'aapl_id' property list is currently unused, but will be used in the - future for optional attribute access properties. The attribute ID returned - from this function must be released with H5Aclose or resource leaks will - develop. - ---------------------------------------------------------------------------*/ + * Function: H5Acreate2 + * + * Purpose: Creates an attribute on an object + * + * Usage: + * hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, + * aapl_id) + * + * Description: This function creates an attribute which is attached to the + * object specified with 'loc_id'. The name specified with + * 'attr_name' for each attribute for an object must be unique + * for that object. The 'type_id' and 'space_id' are created + * with the H5T and H5S interfaces respectively. The 'aapl_id' + * property list is currently unused, but will be used in the + * future for optional attribute access properties. The + * attribute ID returned from this function must be released + * with H5Aclose or resource leaks will develop. + * + * Parameters: + * hid_t loc_id; IN: Object (dataset or group) to be attached to + * const char *attr_name; IN: Name of attribute to locate and open + * hid_t type_id; IN: ID of datatype for attribute + * hid_t space_id; IN: ID of dataspace for attribute + * hid_t acpl_id; IN: ID of creation property list (currently not used) + * hid_t aapl_id; IN: Attribute access property list + * + * Return: Success: An ID for the created attribute + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id) @@ -251,41 +255,44 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); - /* check arguments */ + /* 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, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") + if(!attr_name) + 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") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") 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, H5I_INVALID_HID, "not a dataspace") /* 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 access property list info") - /* Go do the real work for attaching the attribute to the object */ + /* Create the attribute */ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate2() */ @@ -308,7 +315,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - Non-negative on success/Negative on failure + Non-negative on success/H5I_INVALID_HID on failure DESCRIPTION This function creates an attribute which is attached to the object @@ -330,27 +337,27 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); - /* check arguments */ + /* 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, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") 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, H5I_INVALID_HID, "not a dataspace") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) @@ -358,22 +365,23 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } - /* Create the attribute on the object */ + /* Create the attribute */ if(NULL == (attr = H5A__create_by_name(&loc, obj_name, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate_by_name() */ @@ -390,7 +398,7 @@ done: const char *attr_name; IN: Name of attribute to locate and open hid_t aapl_id; IN: Attribute access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -403,36 +411,38 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, attr_name, aapl_id); - /* check arguments */ + /* 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, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + if(!attr_name) + 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") /* 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, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Read in attribute from object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open(&loc, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to load attribute info from object header for 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen() */ @@ -451,7 +461,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -465,47 +475,48 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*s*sii", loc_id, obj_name, attr_name, aapl_id, lapl_id); - /* check arguments */ + /* 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, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") /* 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, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Set lapl_id and add to context */ if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } - /* Open the attribute on the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute") /* Register the attribute and get an ID for it */ if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) -} /* H5Aopen_by_name() */ +} /* end H5Aopen_by_name() */ /*-------------------------------------------------------------------------- @@ -524,7 +535,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -538,47 +549,48 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "i*sIiIohii", loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); - /* check arguments */ + /* 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, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "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, FAIL, "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, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified") /* 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, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Set lapl_id and add to context */ if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } - /* Open the attribute in the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_idx() */ @@ -603,26 +615,26 @@ done: herr_t H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { - H5A_t *attr; /* Attribute object for ID */ + H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(attr_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") - /* Go write the actual data to the attribute */ + /* Write the attribute data */ if((ret_value = H5A__write(attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") @@ -650,22 +662,22 @@ done: herr_t H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { - H5A_t *attr; /* Attribute object for ID */ + H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") - /* Go write the actual data to the attribute */ + /* Read the attribute data */ if((ret_value = H5A__read(attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") @@ -683,7 +695,7 @@ done: hid_t H5Aget_space (attr_id) hid_t attr_id; IN: Attribute to get dataspace of RETURNS - A dataspace ID on success, negative on failure + A dataspace ID on success, H5I_INVALID_HID on failure DESCRIPTION This function retrieves a copy of the dataspace for an attribute. @@ -693,18 +705,20 @@ done: hid_t H5Aget_space(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; /* Return value */ + H5A_t *attr = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Get the dataspace */ if((ret_value = H5A_get_space(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") + done: FUNC_LEAVE_API(ret_value) } /* H5Aget_space() */ @@ -719,7 +733,7 @@ done: hid_t H5Aget_type (attr_id) hid_t attr_id; IN: Attribute to get datatype of RETURNS - A datatype ID on success, negative on failure + A datatype ID on success, H5I_INVALID_HID on failure DESCRIPTION This function retrieves a copy of the datatype for an attribute. @@ -729,18 +743,19 @@ done: hid_t H5Aget_type(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; /* Return value */ + H5A_t *attr = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Get the datatype */ if((ret_value = H5A__get_type(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: FUNC_LEAVE_API(ret_value) @@ -757,7 +772,7 @@ done: hid_t attr_id; IN: Attribute to get name of RETURNS This function returns the ID of a copy of the attribute's creation - property list, or negative on failure. + property list, or H5I_INVALID_HID on failure. ERRORS @@ -769,20 +784,21 @@ done: hid_t H5Aget_create_plist(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; + H5A_t *attr = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); - /* Get attribute and default attribute creation property list*/ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Get the acpl */ if((ret_value = H5A__get_create_plist(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") done: FUNC_LEAVE_API(ret_value) @@ -813,21 +829,21 @@ done: ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) { - H5A_t *my_attr; /* Attribute object for ID */ - ssize_t ret_value; + H5A_t *attr = NULL; /* Attribute object for ID */ + ssize_t ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf); /* check arguments */ - if(NULL == (my_attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute") if(!buf && buf_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero") - /* Call private function in turn */ - if(0 > (ret_value = H5A__get_name(my_attr, buf_size, buf))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") + /* Get the attribute name */ + if((ret_value = H5A__get_name(attr, buf_size, buf)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: FUNC_LEAVE_API(ret_value) @@ -866,15 +882,15 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* 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(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") 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") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) @@ -887,12 +903,12 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Get the length of the name */ ret_value = (ssize_t)HDstrlen(attr->shared->name); - /* Copy the name into the user's buffer, if given */ + /* Get the name and store in the user's buffer */ if(name) { HDstrncpy(name, attr->shared->name, MIN((size_t)(ret_value + 1), size)); if((size_t)ret_value >= size) name[size - 1]='\0'; - } /* end if */ + } done: /* Release resources */ @@ -929,11 +945,11 @@ H5Aget_storage_size(hid_t attr_id) FUNC_ENTER_API(0) H5TRACE1("h", "i", attr_id); - /* Check args */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") - /* Set return value */ + /* Get the storage size */ ret_value = attr->shared->data_size; done: @@ -963,13 +979,13 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", attr_id, ainfo); - /* Check args */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Get the attribute information */ if(H5A__get_info(attr, 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") done: FUNC_LEAVE_API(ret_value) @@ -1002,13 +1018,13 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* 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(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") 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") @@ -1022,7 +1038,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Get the attribute information */ if(H5A__get_info(attr, 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") done: /* Release resources */ @@ -1061,15 +1077,15 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* 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(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") 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") @@ -1083,7 +1099,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Get the attribute information */ if(H5A__get_info(attr, 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") done: /* Release resources */ @@ -1095,12 +1111,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Arename + * Function: H5Arename * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * October 23, 2002 @@ -1117,25 +1132,25 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) /* check arguments */ if(!old_name || !new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil") 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") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_name, new_name)) { H5G_loc_t loc; /* Object location */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* 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") + /* 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") - /* Call private attribute rename routine */ + /* Rename the attribute */ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } /* end if */ + } done: FUNC_LEAVE_API(ret_value) @@ -1143,12 +1158,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Arename_by_name + * Function: H5Arename_by_name * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 20, 2007 @@ -1167,13 +1181,13 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_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(!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(!old_attr_name || !*old_attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") if(!new_attr_name || !*new_attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1183,13 +1197,14 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, 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") + /* Get the location object */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Call private attribute rename routine */ + /* Rename the attribute */ if(H5A__rename_by_name(loc, obj_name, old_attr_name, new_attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } /* end if */ + } done: FUNC_LEAVE_API(ret_value) @@ -1248,15 +1263,15 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /* 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") - /* Call attribute iteration routine */ + /* Iterate over attributes */ if((ret_value = H5A__iterate(loc_id, idx_type, order, idx, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: FUNC_LEAVE_API(ret_value) @@ -1312,7 +1327,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ - herr_t ret_value; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, @@ -1320,23 +1335,23 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* 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(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") 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") - /* Call attribute iteration by name routine */ + /* Iterate over attributes */ if((ret_value = H5A__iterate_by_name(&loc, obj_name, idx_type, order, idx, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1361,24 +1376,26 @@ herr_t H5Adelete(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); - /* check arguments */ + /* 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(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name) + 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") /* 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") - /* Delete the attribute from the location */ + /* Delete the attribute */ if(H5O__attr_remove(loc.oloc, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1413,21 +1430,21 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id); - /* check arguments */ + /* 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(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") 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") - /* Delete the attribute from the location */ + /* Delete the attribute */ if(H5A__delete_by_name(&loc, obj_name, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1472,15 +1489,15 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* 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(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") 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) @@ -1495,21 +1512,17 @@ done: } /* H5Adelete_by_idx() */ -/*-------------------------------------------------------------------------- - NAME - H5Aclose - PURPOSE - Close an attribute ID - USAGE - herr_t H5Aclose (attr_id) - hid_t attr_id; IN: Attribute to release access to - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function releases an attribute from use. Further use of the - attribute ID will result in undefined behavior. ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5Aclose + * + * Purpose: Closes access to an attribute and releases resources used by + * it. It is illegal to subsequently use that same dataset + * ID in calls to other attribute functions. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ herr_t H5Aclose(hid_t attr_id) { @@ -1518,7 +1531,7 @@ H5Aclose(hid_t attr_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", attr_id); - /* check arguments */ + /* Check arguments */ if(NULL == H5I_object_verify(attr_id, H5I_ATTR)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") @@ -1554,12 +1567,12 @@ H5Aexists(hid_t obj_id, const char *attr_name) FUNC_ENTER_API(FAIL) H5TRACE2("t", "i*s", obj_id, attr_name); - /* check arguments */ - if (H5I_ATTR == H5I_get_type(obj_id)) + /* Check arguments */ + if(H5I_ATTR == H5I_get_type(obj_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if (H5G_loc(obj_id, &loc) < 0) + if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!attr_name || !*attr_name) + if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ @@ -1595,20 +1608,21 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id); /* check arguments */ - if (H5I_ATTR == H5I_get_type(loc_id)) + if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if (H5G_loc(loc_id, &loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!obj_name || !*obj_name) + if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") - if (!attr_name || !*attr_name) + if(!attr_name || !*attr_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, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - if ((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0) + /* Check existence of attribute */ + if((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adense.c b/src/H5Adense.c index 3701022..5bed82d 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -164,11 +164,11 @@ typedef struct H5A_bt2_ud_rmbi_t { /*------------------------------------------------------------------------- - * Function: H5A__dense_create + * Function: H5A__dense_create * - * Purpose: Creates dense attribute storage structures for an object + * Purpose: Creates dense attribute storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -188,9 +188,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); @@ -286,11 +284,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_fnd_cb + * Function: H5A__dense_fnd_cb * - * Purpose: Callback when an attribute is located in an index + * Purpose: Callback when an attribute is located in an index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -305,9 +303,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) FUNC_ENTER_STATIC_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(attr); HDassert(user_attr); @@ -320,11 +316,11 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) /*------------------------------------------------------------------------- - * Function: H5A__dense_open + * Function: H5A__dense_open * - * Purpose: Open an attribute in dense storage structures for an object + * Purpose: Open an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -345,9 +341,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name); @@ -411,11 +405,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_insert + * Function: H5A__dense_insert * - * Purpose: Insert an attribute into dense storage structures for an object + * Purpose: Insert an attribute into dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -439,9 +433,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(attr); @@ -570,13 +562,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_write_bt2_cb2 + * Function: H5A__dense_write_bt2_cb2 * - * Purpose: v2 B-tree 'modify' callback to update the record for a creation - * order index + * Purpose: v2 B-tree 'modify' callback to update the record for a creation + * order index * - * Return: Success: 0 - * Failure: 1 + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, February 20, 2007 @@ -591,9 +582,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_STATIC_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(record); HDassert(new_heap_id); @@ -608,12 +597,11 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) /*------------------------------------------------------------------------- - * Function: H5A__dense_write_bt2_cb + * Function: H5A__dense_write_bt2_cb * - * Purpose: v2 B-tree 'modify' callback to update the data for an attribute + * Purpose: v2 B-tree 'modify' callback to update the data for an attribute * - * Return: Success: 0 - * Failure: 1 + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -632,9 +620,7 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(record); HDassert(op_data); @@ -722,11 +708,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_write + * Function: H5A__dense_write * - * Purpose: Modify an attribute in dense storage structures for an object + * Purpose: Modify an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -747,9 +733,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(H5F_addr_defined(ainfo->fheap_addr)); @@ -820,12 +804,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_copy_fh_cb + * Function: H5A__dense_copy_fh_cb * - * Purpose: Callback for fractal heap operator, to make copy of attribute + * Purpose: Callback for fractal heap operator, to make copy of attribute * for calling routine * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -864,11 +848,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_rename + * Function: H5A__dense_rename * - * Purpose: Rename an attribute in dense storage structures for an object + * Purpose: Rename an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -892,9 +876,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(old_name); @@ -996,7 +978,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, 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) @@ -1018,11 +1000,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_iterate_bt2_cb + * Function: H5A__dense_iterate_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage iterator + * Purpose: v2 B-tree callback for dense attribute storage iterator * - * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP + * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1030,7 +1012,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static int H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) { const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */ @@ -1114,11 +1096,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_iterate + * Function: H5A__dense_iterate * - * Purpose: Iterate over attributes in dense storage structures for an object + * Purpose: Iterate over attributes in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1140,9 +1122,7 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(H5F_addr_defined(ainfo->fheap_addr)); @@ -1251,11 +1231,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_bt2_cb + * Function: H5A__dense_remove_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage record removal + * Purpose: v2 B-tree callback for dense attribute storage record removal * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1315,11 +1295,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove + * Function: H5A__dense_remove * - * Purpose: Remove an attribute from the dense storage of an object + * Purpose: Remove an attribute from the dense storage of an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1340,9 +1320,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name && *name); @@ -1398,18 +1376,18 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) 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); + H5O_msg_free_real(H5O_MSG_ATTR, attr_copy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_remove() */ /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_by_idx_bt2_cb + * Function: H5A__dense_remove_by_idx_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage record removal by index + * Purpose: v2 B-tree callback for dense attribute storage record removal by index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1530,12 +1508,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_by_idx + * Function: H5A__dense_remove_by_idx * - * Purpose: Remove an attribute from the dense storage of an object, - * according to the order within an index + * Purpose: Remove an attribute from the dense storage of an object, + * according to the order within an index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1556,9 +1534,7 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); @@ -1660,12 +1636,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_exists + * Function: H5A__dense_exists * - * Purpose: Check if an attribute exists in dense storage structures for + * Purpose: Check if an attribute exists in dense storage structures for * an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1685,9 +1661,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name); @@ -1749,11 +1723,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_delete_bt2_cb + * Function: H5A__dense_delete_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage deletion + * Purpose: v2 B-tree callback for dense attribute storage deletion * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1806,18 +1780,18 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata) done: /* Release resources */ if(attr) - H5O__msg_free_real(H5O_MSG_ATTR, attr); + H5O_msg_free_real(H5O_MSG_ATTR, attr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_delete_bt2_cb() */ /*------------------------------------------------------------------------- - * Function: H5A__dense_delete + * Function: H5A__dense_delete * - * Purpose: Delete all dense storage structures for attributes on an object + * Purpose: Delete all dense storage structures for attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1834,9 +1808,7 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 99c1c0c..e88c8c3 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -36,13 +36,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ /****************/ @@ -95,7 +95,7 @@ hid_t space_id; IN: ID of dataspace for attribute hid_t acpl_id; IN: ID of creation property list (currently not used) RETURNS - Non-negative on success/Negative on failure + Non-negative on success/H5I_INVALID_HID on failure DESCRIPTION This function creates an attribute which is attached to the object @@ -111,50 +111,51 @@ --------------------------------------------------------------------------*/ hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, - hid_t acpl_id) + hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_id); - /* check arguments */ + /* 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, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") 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, H5I_INVALID_HID, "not a dataspace") /* 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") - /* Go do the real work for attaching the attribute to the dataset */ + /* Create the attribute */ if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: - /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) -} /* H5Acreate1() */ +} /* end H5Acreate1() */ /*-------------------------------------------------------------------------- @@ -167,7 +168,7 @@ done: hid_t loc_id; IN: Object (dataset or group) to be attached to const char *name; IN: Name of attribute to locate and open RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -184,32 +185,32 @@ H5Aopen_name(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); - /* check arguments */ + /* 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, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - /* Open the attribute on the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_name(&loc, ".", name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute: '%s'", name) /* Register the attribute and get an ID for it */ if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: - /* Cleanup on failure */ - if(ret_value < 0) + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ @@ -225,7 +226,7 @@ done: hid_t loc_id; IN: Object that attribute is attached to unsigned idx; IN: Index (0-based) attribute to open RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -242,30 +243,30 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "iIu", loc_id, idx); - /* check arguments */ + /* 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(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") - /* Open the attribute in the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: - /* Cleanup on failure */ - if(ret_value < 0) + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ @@ -292,34 +293,34 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5O_loc_t *loc; /* Object location for attribute */ - void *obj; - int ret_value; + H5O_loc_t *loc; /* Object location for attribute */ + void *obj; + int ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", loc_id); - /* check arguments */ if(H5I_BADID == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "bad location ID") if(H5I_FILE == H5I_get_type(loc_id) || 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, (-1), "location is not valid for an attribute") if(NULL == (obj = H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom") + HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, (-1), "illegal object atom") + switch(H5I_get_type (loc_id)) { case H5I_DATASET: if(NULL == (loc = H5D_oloc((H5D_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object") break; case H5I_DATATYPE: if(NULL == (loc = H5T_oloc((H5T_t*)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "target datatype is not committed") break; case H5I_GROUP: if(NULL == (loc = H5G_oloc((H5G_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object") break; case H5I_UNINIT: @@ -336,12 +337,12 @@ H5Aget_num_attrs(hid_t loc_id) case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target") - } /*lint !e788 All appropriate cases are covered */ + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "inappropriate attribute target") + } /* Look up the # of attributes for the object */ if((ret_value = H5O__attr_count(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, (-1), "can't get attribute count for object") done: FUNC_LEAVE_API(ret_value) @@ -388,14 +389,14 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data); /* 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") /* Call attribute iteration routine */ if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) diff --git a/src/H5Aint.c b/src/H5Aint.c index 4c7568a..8268a01 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -87,7 +87,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata); @@ -137,7 +136,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); *------------------------------------------------------------------------- */ H5A_t * -H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, +H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -150,7 +149,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, /* Check args */ HDassert(loc); - HDassert(name); + HDassert(attr_name); HDassert(type); HDassert(space); @@ -159,7 +158,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((exists = H5O__attr_exists(loc->oloc, name)) < 0) + if((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") @@ -194,7 +193,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, } /* end else */ /* Copy the attribute name */ - attr->shared->name = H5MM_xstrdup(name); + attr->shared->name = H5MM_xstrdup(attr_name); /* Copy datatype */ if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL))) @@ -232,9 +231,9 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * 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" @@ -365,12 +364,12 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -514,11 +513,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__open_by_name + * Function: H5A__open_by_name * - * Purpose: Open an attribute in an object header, according to it's name + * Purpose: Open an attribute in an object header, according to it's name * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 11, 2006 @@ -922,8 +921,9 @@ H5A__get_type(H5A_t *attr) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") done: - if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") + 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") FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1017,21 +1017,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__copy + * Function: H5A__copy * - * Purpose: Copies attribute OLD_ATTR. + * Purpose: Copies attribute OLD_ATTR. * - * Return: Success: Pointer to a new copy of the OLD_ATTR argument. + * Return: Success: Pointer to a new copy of the OLD_ATTR argument. * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modification:Raymond Lu - * 4 June 2008 - * Changed some attribute information to be shared. - * *------------------------------------------------------------------------- */ H5A_t * @@ -1084,18 +1080,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__free + * Function: H5A__free * - * Purpose: Frees all memory associated with an attribute, but does not + * Purpose: Frees all memory associated with an attribute, but does not * free the H5A_t structure (which should be done in H5T_close). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, November 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1114,12 +1108,12 @@ H5A__free(H5A_t *attr) } if(attr->shared->dt) { if(H5T_close_real(attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") + HGOTO_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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") attr->shared->ds = NULL; } if(attr->shared->data) @@ -1131,21 +1125,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__close_cb + * Function: H5A__close_cb * - * Purpose: Frees an attribute and all associated memory. + * Purpose: Called when the ref count reaches zero on the attribute's ID * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Sunday, February 18, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5A__close_cb(H5A_t *attr) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1153,9 +1144,9 @@ H5A__close_cb(H5A_t *attr) HDassert(attr); HDassert(attr->shared); - /* Call the actual close routine */ + /* Close the attribute */ if(H5A__close(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1163,11 +1154,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__close + * Function: H5A__close * - * Purpose: Frees an attribute and all associated memory. + * Purpose: Frees an attribute and all associated memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -1310,12 +1301,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__exists_by_name + * Function: H5A__exists_by_name * - * Purpose: Private version of H5Aexists_by_name + * Purpose: Private version of H5Aexists_by_name * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -1423,11 +1413,10 @@ done: * Purpose: Builds a table containing a sorted list of attributes for * an object * - * Note: Used for building table of attributes in non-native iteration + * Note: Used for building table of attributes in non-native iteration * order for an index * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 18, 2006 @@ -1526,17 +1515,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_build_table + * Function: H5A__dense_build_table * * Purpose: Builds a table containing a sorted list of attributes for * an object * - * Note: Used for building table of attributes in non-native iteration + * Note: Used for building table of attributes in non-native iteration * order for an index. Uses the "name" index to retrieve records, - * but the 'idx_type' index for sorting them. + * but the 'idx_type' index for sorting them. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 11, 2006 @@ -1783,13 +1771,12 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, /*------------------------------------------------------------------------- - * Function: H5A__attr_iterate_table + * Function: H5A__attr_iterate_table * * Purpose: Iterate over table containing a list of attributes for an object, * making appropriate callbacks * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 18, 2006 @@ -1866,12 +1853,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__attr_release_table + * Function: H5A__attr_release_table * - * Purpose: Release table containing a list of attributes for an object + * Purpose: Release table containing a list of attributes for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 11, 2006 @@ -1913,8 +1899,8 @@ done: * Purpose: Retrieves the "attribute info" message for an object. Also * sets the number of attributes correctly, if it isn't set up yet. * - * Return: Success: TRUE/FALSE whether message was found & retrieved - * Failure: FAIL if error occurred + * Return: Success: TRUE/FALSE whether message was found & retrieved + * Failure: FAIL if error occurred * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1978,8 +1964,7 @@ done: * Chooses the oldest version possible, unless the * file's low bound indicates otherwise. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -2137,9 +2122,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s * 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. @@ -2326,7 +2311,7 @@ done: * an object may have a reference attribute that points to the * object itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * March 6, 2005 @@ -2477,8 +2462,7 @@ done: * * Purpose: Copy all dense attributes from SRC to DST. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * xcao@hdfgroup.org @@ -2521,12 +2505,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__rename_by_name + * Function: H5A__rename_by_name * * Purpose: Private version of H5Arename_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 20, 2007 @@ -2545,19 +2528,22 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na FUNC_ENTER_PACKAGE - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* 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") - 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") + /* Avoid thrashing things if the names are the same */ + if(HDstrcmp(old_attr_name, new_attr_name)) { + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* 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") + 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") + } /* end if */ done: /* Release resources */ @@ -2569,12 +2555,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__iterate_common + * Function: H5A__iterate_common * * Purpose: Internal common version of H5Aiterate * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2605,12 +2590,11 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /*------------------------------------------------------------------------- - * Function: H5A__iterate + * Function: H5A__iterate * * Purpose: Private version of H5Aiterate2 * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2636,17 +2620,16 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5A__iterate() */ +} /* end H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5A__iterate_old + * Function: H5A__iterate_old * * Purpose: Private version of H5Aiterate1 * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2689,8 +2672,7 @@ done: * * Purpose: Private version of H5Aiterate_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2722,12 +2704,12 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ loc_found = TRUE; /* Open the object */ - if((obj_loc_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((obj_loc_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Build attribute operator info */ - attr_op.op_type = H5A_ATTR_OP_APP2; - attr_op.u.app_op2 = op; + attr_op.op_type = H5A_ATTR_OP_APP2; + attr_op.u.app_op2 = op; /* Call attribute iteration routine */ if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) @@ -2738,12 +2720,12 @@ done: if(obj_loc_id > 0) { if(H5I_dec_app_ref(obj_loc_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - } /* end if */ + } else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* H5A__iterate_by_name() */ +} /* end H5A__iterate_by_name() */ /*------------------------------------------------------------------------- @@ -2751,8 +2733,7 @@ done: * * Purpose: Private version of H5Adelete_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2798,8 +2779,7 @@ done: * * Purpose: Private version of H5Adelete_by_idx * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 0bb6d8f..85f0254 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -191,6 +191,7 @@ H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name); H5_DLL H5A_t *H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr); H5_DLL hid_t H5A__get_type(H5A_t *attr); H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo); diff --git a/src/H5D.c b/src/H5D.c index 0ea7e4a..af99a1f 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -21,12 +21,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 "H5Iprivate.h" /* IDs */ +#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 "H5Iprivate.h" /* IDs */ /****************/ @@ -73,31 +73,28 @@ H5FL_BLK_EXTERN(type_conv); /*------------------------------------------------------------------------- - * Function: H5Dcreate2 + * Function: H5Dcreate2 * - * 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). + * 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, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, dataspaces, 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. + * 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: FAIL - * - * Programmer: Quincey Koziol - * Thursday, April 5, 2007 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -105,88 +102,91 @@ hid_t H5Dcreate2(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) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t ret_value; /* Return value */ + H5D_t *dset = NULL; /* New dataset's info */ + H5G_loc_t loc; /* Object location to insert dataset into */ + const H5S_t *space; /* Dataspace for dataset */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") + 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") if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") - /* Get correct property list */ + /* 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, FAIL, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list") - /* Get correct 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, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list 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") - /* Create the new dataset & get its ID */ + /* Create the dataset */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") + + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate2() */ /*------------------------------------------------------------------------- - * Function: H5Dcreate_anon + * Function: H5Dcreate_anon * - * 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). + * 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, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, dataspaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. * * The resulting ID should be linked into the file with * H5Olink or it will be deleted when closed. * - * 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 linked into - * the group hierarchy before being closed or - * it will be deleted. The dataset should be - * closed when the caller is no longer interested - * in it. - * - * Failure: FAIL + * 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 linked into + * the group hierarchy before being closed or + * it will be deleted. The dataset should be + * closed when the caller is no longer interested + * in it. * - * Programmer: James Laird - * Tuesday, January 24, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -197,35 +197,35 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") 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, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list 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") - /* build and open the new dataset */ + /* Create the dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") - /* Register the new dataset to get an ID for it */ + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: /* Release the dataset's object header, if it was created */ @@ -234,36 +234,34 @@ done: /* Get the new dataset's object location */ if(NULL == (oloc = H5D_oloc(dset))) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "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, FAIL, "unable to decrement refcount on newly created object") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on newly created object") } /* end if */ /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "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() */ /*------------------------------------------------------------------------- - * Function: H5Dopen2 + * Function: H5Dopen2 * - * 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. + * 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. * * Takes a dataset access property list * - * Return: Success: A new dataset ID - * Failure: FAIL + * Return: Success: Object ID of the dataset * - * Programmer: James Laird - * Thursday, July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -272,16 +270,18 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, dapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + 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") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0) @@ -289,17 +289,16 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "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 = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") - + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -307,14 +306,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Dclose * - * Purpose: Closes access to a dataset (DATASET_ID) and releases - * resources used by it. It is illegal to subsequently use that - * same dataset ID in calls to other dataset functions. + * Purpose: Closes access to a dataset and releases resources used by + * it. It is illegal to subsequently use that same dataset + * ID in calls to other dataset functions. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -328,10 +324,9 @@ H5Dclose(hid_t dset_id) /* Check args */ if(NULL == H5I_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 ID") - /* - * Decrement the counter on the dataset. It will be freed if the count + /* 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) @@ -343,36 +338,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_space - * - * Purpose: Returns a copy of the file dataspace for a dataset. + * Function: H5Dget_space * - * Return: Success: ID for a copy of the dataspace. The data - * space should be released by calling - * H5Sclose(). + * Purpose: Returns a copy of the file dataspace for a dataset. * - * Failure: FAIL + * Return: Success: ID for a copy of the dataspace. The data + * space should be released by calling + * H5Sclose(). * - * Programmer: Robb Matzke - * Wednesday, January 28, 1998 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Dget_space(hid_t dset_id) { - H5D_t *dset = NULL; - hid_t ret_value; + H5D_t *dset = NULL; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Get the dataspace */ if((ret_value = H5D__get_space(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") done: FUNC_LEAVE_API(ret_value) @@ -380,35 +373,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_space_status - * - * Purpose: Returns the status of dataspace allocation. + * Function: H5Dget_space_status * - * Return: - * Success: Non-negative + * Purpose: Returns the status of dataspace allocation. * - * Failture: Negative - * - * Programmer: Raymond Lu + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) { - H5D_t *dset = NULL; - herr_t ret_value = SUCCEED; + H5D_t *dset = NULL; /* Dataset structure */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Ds", dset_id, allocation); - /* Check arguments */ + /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - /* Read dataspace address and return */ + /* Get dataspace status */ if(H5D__get_space_status(dset, allocation) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: FUNC_LEAVE_API(ret_value) @@ -416,36 +404,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_type + * Function: H5Dget_type * - * Purpose: Returns a copy of the file datatype for a dataset. + * Purpose: Returns a copy of the file datatype for a dataset. * - * Return: Success: ID for a copy of the datatype. The data - * type should be released by calling - * H5Tclose(). + * Return: Success: ID for a copy of the datatype. The data + * type should be released by calling + * H5Tclose(). * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Dget_type(hid_t dset_id) { - H5D_t *dset; /* Dataset */ - hid_t ret_value; /* Return value */ + H5D_t *dset; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* get the datatype */ if((ret_value = H5D__get_type(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: FUNC_LEAVE_API(ret_value) @@ -453,15 +439,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_create_plist + * Function: H5Dget_create_plist * - * Purpose: Returns a copy of the dataset creation property list. + * Purpose: Returns a copy of the dataset creation property list. * - * Return: Success: ID for a copy of the dataset creation - * property list. The template should be - * released by calling H5P_close(). + * Return: Success: ID for a copy of the dataset creation + * property list. The template should be + * released by calling H5P_close(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Tuesday, February 3, 1998 @@ -472,17 +458,18 @@ hid_t H5Dget_create_plist(hid_t dset_id) { H5D_t *dataset; /* Dataset structure */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Get the dataset creation property list */ if((ret_value = H5D_get_create_plist(dataset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") done: FUNC_LEAVE_API(ret_value) @@ -490,32 +477,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_access_plist + * Function: H5Dget_access_plist * - * Purpose: Returns a copy of the dataset creation property list. + * Purpose: Returns a copy of the dataset access property list. * * Description: H5Dget_access_plist returns the dataset access property - * list identifier of the specified dataset. + * list identifier of the specified dataset. * - * 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 - * 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 - * list. + * 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 + * 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 + * list. * - * All link access properties in the returned list will be set to the - * default values. + * All link access properties in the returned list will be set to the + * default values. * - * Return: Success: ID for a copy of the dataset access - * property list. The template should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the dataset access + * property list. The template should be + * released by calling H5Pclose(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Neil Fortner * Wednesday, October 29, 2008 @@ -526,17 +513,18 @@ hid_t H5Dget_access_plist(hid_t dset_id) { H5D_t *dset; /* Dataset structure */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Get the dataset access property list */ if((ret_value = H5D_get_access_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") done: FUNC_LEAVE_API(ret_value) @@ -544,39 +532,36 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_storage_size + * Function: H5Dget_storage_size * - * Purpose: Returns the amount of storage that is required for the - * dataset. For chunked datasets this is the number of allocated - * chunks times the chunk size. + * Purpose: Returns the amount of storage that is required for the + * dataset. For chunked datasets this is the number of allocated + * chunks times the chunk size. * - * Return: Success: The amount of storage space allocated for the - * dataset, not counting meta data. The return - * value may be zero if no data has been stored. + * Return: Success: The amount of storage space allocated for the + * dataset, not counting meta data. The return + * value may be zero if no data has been stored. * - * Failure: Zero - * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 + * Failure: Zero * *------------------------------------------------------------------------- */ hsize_t H5Dget_storage_size(hid_t dset_id) { - H5D_t *dset; /* Dataset to query */ - hsize_t ret_value; /* Return value */ + H5D_t *dset; /* Dataset for this operation */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_API(0) H5TRACE1("h", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") - /* Set return value */ + /* Get the storage size */ if(H5D__get_storage_size(dset, &ret_value) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") done: FUNC_LEAVE_API(ret_value) @@ -584,33 +569,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_offset + * Function: H5Dget_offset * - * Purpose: Returns the address of dataset in file. + * Purpose: Returns the address of dataset in file. * - * Return: Success: the address of dataset + * Return: Success: The address of dataset * - * Failure: HADDR_UNDEF - * - * Programmer: Raymond Lu - * November 6, 2002 + * Failure: HADDR_UNDEF (can also be a valid return value!) * *------------------------------------------------------------------------- */ haddr_t H5Dget_offset(hid_t dset_id) { - H5D_t *dset; /* Dataset to query */ - haddr_t ret_value; /* Return value */ + H5D_t *dset; /* Dataset for this operation */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_API(HADDR_UNDEF) H5TRACE1("a", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") - /* Set return value */ + /* Get the offset */ ret_value = H5D__get_offset(dset); done: @@ -740,7 +722,7 @@ H5Dvlen_reclaim(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") if(!(H5S_has_extent(space))) @@ -793,7 +775,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size) { H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0}; - H5D_t *dset; /* Dataset for operation */ + H5D_t *dset; /* Dataset for this operation */ H5S_t *fspace = NULL; /* Dataset's dataspace */ H5S_t *mspace = NULL; /* Memory dataspace */ char bogus; /* bogus value to pass to H5Diterate() */ @@ -810,7 +792,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, H5I_DATATYPE != H5I_get_type(type_id) || size == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(NULL == (dset = (H5D_t *)H5I_object(dataset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_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))) @@ -820,16 +802,20 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, /* Save the dataset */ vlen_bufsize.dset = dset; + vlen_bufsize.fspace_id = H5I_INVALID_HID; + vlen_bufsize.mspace_id = H5I_INVALID_HID; /* 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") - vlen_bufsize.fspace = fspace; + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") + if((vlen_bufsize.fspace_id = H5I_register(H5I_DATASPACE, fspace, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file dataspace") /* 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") - vlen_bufsize.mspace = mspace; + if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register memory dataspace") /* Grab the temporary buffers required */ if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1))) @@ -845,9 +831,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.size = 0; /* Call H5S_select_iterate with args, etc. */ - dset_op.op_type = H5S_SEL_ITER_OP_APP; - dset_op.u.app_op.op = H5D__vlen_get_buf_size; - dset_op.u.app_op.type_id = type_id; + dset_op.op_type = H5S_SEL_ITER_OP_APP; + dset_op.u.app_op.op = H5D__vlen_get_buf_size; + dset_op.u.app_op.type_id = type_id; ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); @@ -856,10 +842,17 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, *size = vlen_bufsize.size; done: - if(fspace && H5S_close(fspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - if(mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + if(ret_value < 0) { + if(fspace && H5S_close(fspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release file dataspace") + if(mspace && H5S_close(mspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release memory dataspace") + } + + if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing file dataspace id") + if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing memory dataspace id") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) @@ -870,40 +863,37 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dset_extent - * - * Purpose: Modifies the dimensions of a dataset. - * Can change to a smaller dimension. + * Function: H5Dset_extent * - * Return: Non-negative on success, negative on failure + * Purpose: Modifies the dimensions of a dataset. + * Can change to a smaller dimension. * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * April 9, 2002 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") if(!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") + 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") - /* Private function */ + /* Set the extent */ if(H5D__set_extent(dset, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: FUNC_LEAVE_API(ret_value) @@ -915,25 +905,22 @@ done: * * Purpose: Flushes all buffers associated with a dataset. * - * Return: Non-negative on success, negative on failure - * - * Programmer: Mike McGreevy - * May 19, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dflush(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* return value */ + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + 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) @@ -941,7 +928,7 @@ H5Dflush(hid_t dset_id) /* Flush dataset information cached in memory */ if(H5D__flush(dset, dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: FUNC_LEAVE_API(ret_value) @@ -953,31 +940,28 @@ done: * * Purpose: Refreshes all buffers associated with a dataset. * - * Return: Non-negative on success, negative on failure - * - * Programmer: Mike McGreevy - * July 21, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Drefresh(hid_t dset_id) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ - + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + 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") - /* Call private function to refresh the dataset object */ + /* Refresh the dataset object */ if((H5D__refresh(dset_id, dset)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") @@ -990,12 +974,13 @@ done: * Function: H5Dformat_convert (Internal) * * Purpose: For chunked: - * Convert the chunk indexing type to version 1 B-tree if not - * For compact/contiguous: - * Downgrade layout version to 3 if greater than 3 - * For virtual: no conversion + * Convert the chunk indexing type to version 1 B-tree if not + * For compact/contiguous: + * Downgrade layout version to 3 if greater than 3 + * For virtual: + * No conversion * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * Feb 2015 @@ -1005,15 +990,15 @@ done: herr_t H5Dformat_convert(hid_t dset_id) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + 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) @@ -1065,17 +1050,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type) +H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ - + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Dk", did, idx_type); + H5TRACE2("e", "i*Dk", dset_id, idx_type); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + 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") /* Should be a chunked dataset */ if(dset->shared->layout.type != H5D_CHUNKED) @@ -1095,7 +1082,10 @@ done: * * Purpose: Returns the size of an allocated chunk. * - * Return: Non-negative on success, negative on failure + * Intended for use with the H5D(O)read_chunk API call so + * the caller can construct an appropriate buffer. + * + * Return: SUCCEED/FAIL * * Programmer: Matthew Strong (GE Healthcare) * 20 October 2016 @@ -1105,24 +1095,24 @@ done: herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes) { - H5D_t *dset = NULL; - herr_t ret_value = SUCCEED; + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes); /* Check arguments */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - if( NULL == offset ) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") - if( NULL == chunk_nbytes ) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + 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") + if(NULL == chunk_nbytes) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") if(H5D_CHUNKED != dset->shared->layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") - /* Call private function */ + /* Get the dataset creation property list */ if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 8abfe27..b61aed4 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -685,13 +685,12 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key /* decode */ UINT32DECODE(raw, key->nbytes); UINT32DECODE(raw, key->filter_mask); - for(u = 0; u < layout->ndims; u++) - { - if (layout->dim[u] == 0) + for(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) /* Retrieve coordinate offset */ - UINT64DECODE(raw, tmp_offset); + UINT64DECODE(raw, tmp_offset); HDassert(0 == (tmp_offset % layout->dim[u])); /* Convert to a scaled offset */ @@ -943,7 +942,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) diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index d60e79e..b32f395 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -1547,7 +1547,7 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info) 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) + if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0) 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/src/H5Dchunk.c b/src/H5Dchunk.c index 16d7530..30a9a3b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -551,7 +551,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, /* 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") - } /* end if */ + } /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) @@ -648,8 +648,8 @@ 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") - } /* end if */ - } /* end if */ + } + } /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) @@ -1300,11 +1300,9 @@ done: 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") - if(file_space_normalized == TRUE) { - /* (Casting away const OK -QAK) */ - if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) + if(file_space_normalized == TRUE) + if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */ HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_io_init() */ @@ -1503,7 +1501,8 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection") /* Move selection back to have correct offset in chunk */ - H5S_SELECT_ADJUST_U(fm->single_space, coords); + 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 */ @@ -1615,7 +1614,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } /* end if */ /* Move selection back to have correct offset in chunk */ - H5S_SELECT_ADJUST_U(tmp_fchunk, coords); + if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) { + (void)H5S_close(tmp_fchunk); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") + } /* Add temporary chunk to the list of chunks */ @@ -1814,7 +1816,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) } /* end for */ /* Adjust the selection */ - if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */ + if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection") /* Get the next chunk node in the skip list */ @@ -3183,8 +3185,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, - hbool_t flush) +H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) { H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); herr_t ret_value = SUCCEED; /* Return value */ @@ -4199,13 +4200,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ while(!carry) { hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ - /* Look up this chunk */ - if(H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + /* Look up this chunk */ + if(H5D__chunk_lookup(dset, scaled, &udata) < 0) + 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 != layout->storage.u.chunk.idx_type) - HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) { + HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + } /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -4233,7 +4235,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* Check to make sure the buffer is large enough. It is * possible (though ill-advised) for the filter to shrink the - * buffer. */ + * buffer. + */ if(fb_info.fill_buf_size < orig_chunk_size) { 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") @@ -4467,10 +4470,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) HGOTO_DONE(SUCCEED) } /* end if */ - /* - * Initialize structures needed to lock chunks into cache - */ - /* 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. */ @@ -6517,31 +6516,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") } /* end block */ - if(old_chunk && H5F_addr_defined(old_chunk->offset)) { - /* Sanity check */ + if(old_chunk && H5F_addr_defined(old_chunk->offset)) { + /* Sanity check */ HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset)); /* Check for chunk being same size */ - if(new_chunk->length != old_chunk->length) { - /* Release previous chunk */ - /* Only free the old location if not doing SWMR writes - otherwise + if(new_chunk->length != old_chunk->length) { + /* Release previous chunk */ + /* Only free the old location if not doing SWMR writes - otherwise * we must keep the old chunk around in case a reader has an * outdated version of the B-tree node */ - 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") - alloc_chunk = TRUE; - } /* end if */ + 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") + alloc_chunk = TRUE; + } /* end if */ else { - /* Don't need to reallocate chunk, but send its address back up */ + /* Don't need to reallocate chunk, but send its address back up */ if(!H5F_addr_defined(new_chunk->offset)) new_chunk->offset = old_chunk->offset; - } /* end else */ - } /* end if */ + } /* end else */ + } /* end if */ else { HDassert(!H5F_addr_defined(new_chunk->offset)); - alloc_chunk = TRUE; + alloc_chunk = TRUE; } /* end else */ } /* end if */ else { @@ -6646,7 +6645,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "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) + 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") /* Pass the chunk through the pipeline */ diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 347e34c..7220868 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -21,11 +21,11 @@ /***********/ /* 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 "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ /****************/ @@ -60,17 +60,12 @@ /*------------------------------------------------------------------------- - * Function: H5Ddebug + * Function: H5Ddebug * - * Purpose: Prints various information about a dataset. This function is - * not to be documented in the API at this time. + * Purpose: Prints various information about a dataset. This function is + * not to be documented in the API at this time. * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, April 28, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -85,13 +80,13 @@ H5Ddebug(hid_t dset_id) /* Check args */ if(NULL == (dset = (H5D_t *)H5I_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); + (void)H5D__chunk_dump_index(dset, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); + HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 0f1bfee..ed520c4 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -80,28 +80,28 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Dcreate1 + * 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). + * 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, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * 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. + * 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: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, December 3, 1997 @@ -112,29 +112,31 @@ hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ - hid_t ret_value; /* Return value */ + H5G_loc_t loc; /* Object location to insert dataset into */ + H5D_t *dset = NULL; /* New dataset's info */ + const H5S_t *space; /* Dataspace for dataset */ + hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + 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") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") 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, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list 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) @@ -142,32 +144,32 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Build and open the new dataset */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") - /* Register the new dataset to get an ID for it */ + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: - if(ret_value < 0) + if (H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate1() */ /*------------------------------------------------------------------------- - * Function: H5Dopen1 + * 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. + * 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 + * Note: Deprecated in favor of H5Dopen2 * - * Return: Success: A new dataset ID - * Failure: FAIL + * Return: Success: A new dataset ID + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -179,44 +181,46 @@ H5Dopen1(hid_t loc_id, const char *name) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + 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") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") - /* Register an atom for the dataset */ + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ /*------------------------------------------------------------------------- - * Function: H5Dextend + * 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. + * 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 + * Note: Deprecated in favor of H5Dset_extent * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Friday, January 30, 1998 @@ -226,19 +230,19 @@ done: herr_t H5Dextend(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Pointer to dataset to modify */ - hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset; /* Pointer to dataset to modify */ + hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ + unsigned u; /* 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 == (dset = (H5D_t *)H5I_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") if(!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Make certain that the dataset dimensions don't decrease */ /* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */ @@ -254,7 +258,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) /* Increase size */ if(H5D__set_extent(dset, dset_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dfill.c b/src/H5Dfill.c index e42e551..619f699 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -174,7 +174,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, - const H5T_t *buf_type, const H5S_t *space) + const H5T_t *buf_type, const H5S_t *space) { H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */ hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 2d4985e..9af391e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -22,8 +22,8 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ #include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ @@ -48,18 +48,17 @@ /* General stuff */ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); -static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, - const H5T_t *type); +static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); 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, hid_t dapl_id, - const char *prefix_type, char **file_prefix); +static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *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__append_flush_setup(H5D_t *dset, hid_t dapl_id); -static herr_t H5D__close_cb(H5D_t *dataset); +static herr_t H5D__close_cb(H5D_t *dset); + /*********************/ /* Package Variables */ @@ -281,6 +280,37 @@ H5D_term_package(void) /*------------------------------------------------------------------------- + * Function: H5D__close_cb + * + * Purpose: Called when the ref count reaches zero on the dataset's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__close_cb(H5D_t *dset) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(dset); + HDassert(dset->oloc.file); + HDassert(dset->shared); + HDassert(dset->shared->fo_count > 0); + + /* Close the dataset */ + if(H5D_close(dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5D__create_named * * Purpose: Internal routine to create a new dataset. @@ -505,7 +535,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) 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 */ + * 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") @@ -520,7 +551,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* 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") - } /* end if */ + } /* Not a custom datatype, just use it directly */ else { if(H5I_inc_ref(type_id, FALSE) < 0) @@ -529,7 +560,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Use existing datatype */ dset->shared->type_id = type_id; dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */ - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -569,7 +600,7 @@ H5D__cache_dataspace_info(const H5D_t *dset) 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") dset->shared->curr_power2up[u] = scaled_power2up; - } /* end for */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -685,7 +716,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type") fill_prop->fill_defined = TRUE; - } /* end if */ + } else if(fill_status == H5D_FILL_VALUE_UNDEFINED) fill_prop->fill_defined = FALSE; else @@ -848,7 +879,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type */ if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) prefix = HDgetenv("HDF5_VDS_PREFIX"); - else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) + else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); else HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") @@ -1300,7 +1331,7 @@ done: dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); - } /* end if */ + } H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); @@ -1561,36 +1592,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__close_cb - * - * Purpose: Callback routine for closing a dataset ID. Closes the dataset - * object that was attached to the ID. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__close_cb(H5D_t *dataset) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* check args */ - HDassert(dataset && dataset->oloc.file && dataset->shared); - HDassert(dataset->shared->fo_count > 0); - - /* Call actual dataset close routine */ - if(H5D_close(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__close_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5D_close * * Purpose: Insures that all data has been saved to the file, closes the @@ -1726,8 +1727,7 @@ H5D_close(H5D_t *dataset) 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") - /* - * Release datatype, dataspace and creation property list -- there isn't + /* Release datatype, dataspace and creation property list -- there isn't * much we can do if one of these fails, so we just continue. */ free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) || @@ -1761,6 +1761,7 @@ H5D_close(H5D_t *dataset) */ dataset->oloc.file = NULL; dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); + } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -1798,7 +1799,7 @@ done: * Function: H5D_mult_refresh_close * * Purpose: Closing down the needed information when the dataset has - * multiple opens. (From H5O_refresh_metadata_close()) + * multiple opens. (From H5O__refresh_metadata_close()) * * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- @@ -2275,13 +2276,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_offset + * Function: H5D__get_offset + * + * Purpose: Private function for H5D__get_offset. Returns the address + * of dataset in file. * - * Purpose: Private function for H5D__get_offset. Returns the address - * of dataset in file. + * Return: Success: The address of dataset + * + * Failure: HADDR_UNDEF (but also a valid value) * - * Return: Success: the address of dataset - * Failure: HADDR_UNDEF *------------------------------------------------------------------------- */ haddr_t @@ -2301,7 +2304,8 @@ H5D__get_offset(const H5D_t *dset) case H5D_CONTIGUOUS: /* If dataspace hasn't been allocated or dataset is stored in - * an external file, the value will be HADDR_UNDEF. */ + * 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)) /* 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); @@ -2311,7 +2315,7 @@ H5D__get_offset(const H5D_t *dset) case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type") - } /*lint !e788 All appropriate cases are covered */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -2419,6 +2423,8 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, { H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data; H5T_t *dt; /* Datatype for operation */ + H5S_t *mspace; /* Memory dataspace for operation */ + H5S_t *fspace; /* File dataspace for operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2434,12 +2440,18 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") + /* Get the memory dataspace from the ID */ + if(NULL == (mspace = (H5S_t *)H5I_object_verify(vlen_bufsize->mspace_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + /* Select point to read in */ - if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "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->fl_tbuf) < 0) + if(H5D__read(vlen_bufsize->dset, type_id, mspace, fspace, vlen_bufsize->fl_tbuf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: @@ -2509,11 +2521,11 @@ done: herr_t H5D__set_extent(H5D_t *dset, const hsize_t *size) { - hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ - htri_t changed; /* Whether the dataspace changed size */ - size_t u, v; /* Local index variable */ + hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ + htri_t changed; /* Whether the dataspace changed size */ + size_t u, v; /* Local index variable */ unsigned dim_idx; /* Dimension index */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -2649,7 +2661,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) 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") - } /* end if */ + } /*------------------------------------------------------------------------- * Remove chunk information in the case of chunked datasets * This removal takes place only in case we are shrinking the dateset @@ -3255,7 +3267,7 @@ H5D_get_access_plist(const H5D_t *dset) if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, 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") diff --git a/src/H5Dio.c b/src/H5Dio.c index ed384ca..88a9e4b 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -21,14 +21,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Sprivate.h" /* Dataspace */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Sprivate.h" /* Dataspace */ #ifdef H5_HAVE_PARALLEL /* Remove this if H5R_DATASET_REGION is no longer used in this file */ @@ -50,8 +50,7 @@ /* Local Prototypes */ /********************/ -static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, - hsize_t *offset_copy/*out*/); +/* Setup/teardown routines */ 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); static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, @@ -83,14 +82,17 @@ H5FL_DEFINE(H5D_chunk_map_t); /*------------------------------------------------------------------------- * Function: H5D__get_offset_copy * - * Purpose: Gets a copy of the user's offset array that is guaraneteed - * to be suitable for use by the library. + * Purpose: Copies an offset buffer and performs bounds checks on the + * values. + * + * This helper function ensures that the offset buffer given + * by the user is suitable for use with the rest of the library. * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy) { unsigned u; @@ -102,7 +104,6 @@ H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_c HDassert(offset); HDassert(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 calloc call). @@ -127,14 +128,13 @@ done: } /* end H5D__get_offset_copy() */ - /*------------------------------------------------------------------------- - * Function: H5Dread + * Function: H5Dread * * Purpose: Reads (part of) a DSET from the file into application * memory BUF. The part of the dataset to read is defined with - * MEM_SPACE_ID and FILE_SPACE_ID. The data points are + * MEM_SPACE_ID and FILE_SPACE_ID. The data points are * converted from their file type to the MEM_TYPE_ID specified. * Additional miscellaneous data transfer properties can be * passed to this function with the PLIST_ID argument. @@ -152,7 +152,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -194,7 +194,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Read raw data */ + /* Read the 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") @@ -219,9 +219,9 @@ herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf) { - H5D_t *dset = NULL; + H5D_t *dset = NULL; hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); @@ -289,7 +289,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -303,13 +303,13 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5D_t *dset = NULL; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); - /* Get dataset pointer and ensure it's associated with a file */ + /* Get dataset pointer */ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") if (NULL == dset->oloc.file) @@ -356,10 +356,10 @@ herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf) { - H5D_t *dset = NULL; + H5D_t *dset = NULL; hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = SUCCEED; /* Return value */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); @@ -981,8 +981,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, type_info->dst_type_id = mem_type_id; } /* end else */ - /* - * Locate the type conversion function and dataspace conversion + /* Locate the type conversion function and dataspace conversion * functions, and set up the element numbering information. If a data * type conversion is necessary then register datatype atoms. Data type * conversion is necessary if the user has set the `need_bkg' to a high @@ -1249,7 +1248,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__ioinfo_adjust() */ -#endif /*H5_HAVE_PARALLEL*/ +#endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index c8afb8e..494d2c8 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -25,7 +25,6 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5HLprivate.h" /* Local heaps */ -#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -506,7 +505,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - } /* end if */ + } /* Update external storage message, if it's used */ if(dset->shared->dcpl_cache.efl.nused > 0) { @@ -557,6 +556,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message") } /* end if */ + /* Create layout message */ /* (Don't make layout message constant unless allocation time is early and non-filtered, since space may not be allocated) */ /* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */ if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index eb687d2..2c06800 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -479,8 +479,7 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, MPI_Comm_size(comm, &mpi_size); MPI_Comm_rank(comm, &mpi_rank); - /* - * Determine the size of the end result array by collecting the number + /* Determine the size of the end result array by collecting the number * of entries contributed by each processor into a single total. */ if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm))) diff --git a/src/H5Doh.c b/src/H5Doh.c index f8ce69f..38d0914 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -189,15 +189,15 @@ H5O__dset_isa(const H5O_t *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) @@ -260,7 +260,7 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 1217c48..591fcb1 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -510,12 +510,12 @@ typedef struct H5D_fill_buf_info_t { /* Internal data structure for computing variable-length dataset's total size */ typedef struct { - H5D_t *dset; /* Dataset for operation */ - H5S_t *fspace; /* Dataset's dataspace for operation */ - H5S_t *mspace; /* Memory dataspace for operation */ - void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ - void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ - hsize_t size; /* Accumulated number of bytes for the selection */ + H5D_t *dset; /* Dataset for operation */ + hid_t fspace_id; /* File dataspace ID of the dataset we are working on */ + hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */ + void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ + void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ + hsize_t size; /* Accumulated number of bytes for the selection */ } H5D_vlen_bufsize_t; @@ -559,15 +559,12 @@ 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(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__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__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size); H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info); -H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, - const hsize_t *point, void *op_data); +H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data); H5_DLL herr_t H5D__check_filters(H5D_t *dataset); H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); @@ -660,6 +657,7 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_t *btree_size); 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__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_read(const H5D_t *dset, hsize_t *offset, diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 5856ede..266f5f5 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -559,11 +559,9 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf 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") - } /* end if */ + } - /* - * Scatter the data into memory. - */ + /* Scatter the data into memory */ if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed") } /* end else */ @@ -691,9 +689,9 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in 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, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") - } /* end if */ + 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") + } /* * Perform datatype conversion. diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 321d258..4510a03 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -244,10 +244,10 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata } /* end if */ if(dset) - 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") + 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") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 7f1ac86..8867492 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2961,7 +2961,7 @@ done: static herr_t H5D__virtual_refresh_source_dset(H5D_t **dset) { - hid_t dset_id; /* Temporary dataset identifier */ + hid_t temp_id; /* Temporary dataset identifier */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2970,15 +2970,15 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) HDassert(dset && *dset); /* Get a temporary identifier for this source dataset */ - if((dset_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0) + if((temp_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID") /* Refresh source dataset */ - if(H5D__refresh(dset_id, *dset) < 0) + if(H5D__refresh(temp_id, *dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset") /* Discard the identifier & replace the dataset */ - if(NULL == (*dset = (H5D_t *)H5I_remove(dset_id))) + if(NULL == (*dset = (H5D_t *)H5I_remove(temp_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") done: diff --git a/src/H5F.c b/src/H5F.c index 68bdfd3..97330e5 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -55,6 +55,8 @@ /* Local Prototypes */ /********************/ +static herr_t H5F__close_cb(H5F_t *f); + /*********************/ /* Package Variables */ @@ -157,6 +159,66 @@ H5F_term_package(void) /*------------------------------------------------------------------------- + * Function: H5F__close_cb + * + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called from the API and gets called + * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F__close_cb() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F__close_cb(H5F_t *f) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ + + /* Perform checks for "semi" file close degree here, since closing the + * file is not allowed if there are objects still open. + */ + if(f->shared->fc_degree == H5F_CLOSE_SEMI) { + unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ + unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ + + /* 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") + + /* 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, + * without decrementing the file ID's reference count and triggering + * 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") + } /* end if */ + + /* Reset the file ID for this file */ + f->file_id = -1; + + /* Attempt to close the file/mount hierarchy */ + if(H5F_try_close(f, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5Fget_create_plist * * Purpose: Get an atom for a copy of the file-creation property list for @@ -236,36 +298,105 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_obj_count + * Function: H5F__get_all_count_cb + * + * Purpose: Get counter of all object types currently open. * - * Purpose: Public function returning the number of opened object IDs - * (files, datasets, groups and datatypes) in the same file. + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static int +H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) +{ + H5F_trav_obj_cnt_t *udata = (H5F_trav_obj_cnt_t *)key; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + *(udata->obj_count) = *(udata->obj_count) + 1; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_get_all_count_cb */ + + +/*------------------------------------------------------------------------- + * Function: H5Fget_obj_count + * + * Purpose: Public function returning the number of opened object IDs + * (files, datasets, groups and datatypes) in the same file. + * + * Return: Success: The number of opened object IDs + * + * Failure: -1 * - * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t H5Fget_obj_count(hid_t file_id, unsigned types) { - H5F_t *f = NULL; /* File to query */ - size_t obj_count = 0; /* Number of opened objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE2("Zs", "iIu", file_id, types); /* Check arguments */ - if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") /* Perform the query */ - if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - - /* Set the return value */ - ret_value = (ssize_t)obj_count; + /* If the 'special' ID wasn't passed in, just make a normal call to + * count the IDs in the file. + */ + if(file_id != (hid_t)H5F_OBJ_ALL) { + H5F_t *f = NULL; + size_t obj_count = 0; + + /* Get the file object */ + if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") + + /* Get the count */ + if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") + + /* Set the return value */ + ret_value = (ssize_t)obj_count; + } + /* If we passed in the 'special' ID, get the count for everything open in the + * library, iterating over all open files and getting the object count for each. + * + * XXX: Consider making this a helper function in H5I. + */ + else { + H5F_trav_obj_cnt_t udata; + + udata.obj_count = &ret_value; + udata.types = types | H5F_OBJ_LOCAL; + + 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"); + } + 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"); + } + 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"); + } + 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"); + } + 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"); + } + } done: FUNC_LEAVE_API(ret_value) @@ -273,37 +404,118 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_object_ids + * Function: H5F__get_all_ids_cb + * + * Purpose: Get IDs of all currently open objects of a given type. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP * - * Purpose: Public function to return a list of opened object IDs. + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static int +H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key) +{ + H5F_trav_obj_ids_t *udata = (H5F_trav_obj_ids_t *)key; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + if(*udata->obj_count >= udata->max_objs) + HGOTO_DONE(H5_ITER_STOP); + + udata->oid_list[*udata->obj_count] = obj_id; + *(udata->obj_count) = *(udata->obj_count) + 1; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__get_all_ids_cb */ + + +/*------------------------------------------------------------------------- + * Function: H5Fget_object_ids + * + * Purpose: Public function to return a list of opened object IDs. + * + * NOTE: Type mismatch - You can ask for more objects than can be + * returned. + * + * Return: Success: The number of IDs in oid_list + * + * Failure: -1 * - * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) { - H5F_t *f = NULL; /* File to query */ - size_t obj_id_count = 0; /* Number of open objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list); /* Check arguments */ - if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") if(!oid_list) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object ID list is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list cannot be NULL") /* Perform the query */ - if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed") + /* If the 'special' ID wasn't passed in, just make a normal VOL call to + * get the IDs from the file. + */ + if(file_id != (hid_t)H5F_OBJ_ALL) { + H5F_t *file = NULL; + size_t obj_id_count = 0; - /* Set the return value */ - ret_value = (ssize_t)obj_id_count; + /* get the file object */ + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + + /* Get the IDs */ + if(H5F_get_obj_ids(file, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") + + /* Set the return value */ + ret_value = (ssize_t)obj_id_count; + } + /* If we passed in the 'special' ID, get the count for everything open in the + * library, iterating over all open files and getting the object count for each. + * + * XXX: Consider making this a helper function in H5I. + * XXX: Note that the RM states that passing in a negative value for max_objs + * gets you all the objects. This technically works, but is clearly wrong + * behavior since max_objs is an unsigned type. + */ + else { + H5F_trav_obj_ids_t udata; + + udata.max_objs = max_objs; + udata.oid_list = oid_list; + udata.obj_count = &ret_value; + + 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"); + } + 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"); + } + 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"); + } + 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"); + } + 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"); + } + } done: FUNC_LEAVE_API(ret_value) @@ -482,7 +694,7 @@ done: * * Return: Success: A file ID * - * Failure: FAIL + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -495,7 +707,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); - /* Check/fix arguments. */ + /* Check arguments */ if(!filename || !*filename) 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 */ @@ -533,13 +745,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fflush + * Function: H5Fflush + * + * Purpose: Flushes all outstanding buffers of a file to disk but does + * not remove them from the cache. The OBJECT_ID can be a file, + * dataset, group, attribute, or named data type. * - * Purpose: Flushes all outstanding buffers of a file to disk but does - * not remove them from the cache. The OBJECT_ID can be a file, - * dataset, group, attribute, or named data type. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -547,7 +760,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) { H5F_t *f = NULL; /* File to flush */ H5O_loc_t *oloc = NULL; /* Object location for ID */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iFs", object_id, scope); @@ -654,17 +867,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fclose + * Function: H5Fclose + * + * Purpose: This function closes the file specified by FILE_ID by + * flushing all data to storage, and terminating access to the + * file through FILE_ID. If objects (e.g., datasets, groups, + * etc.) are open in the file then the underlying storage is not + * closed until those objects are closed; however, all data for + * the file and the open objects is flushed. * - * Purpose: This function closes the file specified by FILE_ID by - * flushing all data to storage, and terminating access to the - * file through FILE_ID. If objects (e.g., datasets, groups, - * etc.) are open in the file then the underlying storage is not - * closed until those objects are closed; however, all data for - * the file and the open objects is flushed. + * Return: SUCCEED/FAIL * - * Return: Success: Non-negative - * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -677,7 +890,7 @@ H5Fclose(hid_t file_id) /* Check arguments */ if(H5I_FILE != H5I_get_type(file_id)) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") /* Close the file */ if(H5F__close(file_id) < 0) @@ -689,63 +902,62 @@ done: /*------------------------------------------------------------------------- - * Function: H5Freopen + * Function: H5Freopen * - * Purpose: Reopen a file. The new file handle which is returned points - * to the same file as the specified file handle. Both handles - * share caches and other information. The only difference - * between the handles is that the new handle is not mounted - * anywhere and no files are mounted on it. + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. + * + * Return: Success: New file ID + * + * Failure: H5I_INVALID_HID * - * Return: Success: New file ID - * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Freopen(hid_t file_id) { - H5F_t *old_file = NULL; - H5F_t *new_file = NULL; - hid_t ret_value; + H5F_t *old_file = NULL; + H5F_t *new_file = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); - /* Check arguments */ + /* Get the file object */ if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file") - /* Get a new "top level" file struct, sharing the same "low level" file struct */ - if(NULL == (new_file = H5F__new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") - - /* Duplicate old file's names */ - new_file->open_name = H5MM_xstrdup(old_file->open_name); - new_file->actual_name = H5MM_xstrdup(old_file->actual_name); - new_file->extpath = H5MM_xstrdup(old_file->extpath); + /* Reopen the file */ + if(NULL == (new_file = H5F__reopen(old_file))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") + /* Get an atom for the file */ if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") /* Keep this ID in file object structure */ new_file->file_id = ret_value; done: - if(ret_value < 0 && new_file) - if(H5F__dest(new_file, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") + if(H5I_INVALID_HID == ret_value) + if(new_file && H5F__dest(new_file, FALSE) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "can't close file") FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ /*------------------------------------------------------------------------- - * Function: H5Fget_intent + * Function: H5Fget_intent * - * Purpose: Public API to retrieve the file's 'intent' flags passed - * during H5Fopen() + * Purpose: Public API to retrieve the file's 'intent' flags passed + * during H5Fopen() + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/negative on failure *------------------------------------------------------------------------- */ herr_t @@ -794,8 +1006,10 @@ done: * * Purpose: Retrieves the amount of free space in the file. * - * Return: Success: Amount of free space for type - * Failure: Negative + * Return: Success: Amount of free space for type + * + * Failure: -1 + * *------------------------------------------------------------------------- */ hssize_t @@ -805,16 +1019,16 @@ H5Fget_freespace(hid_t file_id) hsize_t tot_space; /* Amount of free space in the file */ hssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Hs", "i", file_id); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") - /* Go get the actual amount of free space in the file */ + /* Get the amount of free space in the file */ if(H5MF_get_freespace(file, &tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") ret_value = (hssize_t)tot_space; @@ -828,10 +1042,10 @@ done: * * Purpose: Retrieves the file size of the HDF5 file. This function * is called after an existing file is opened in order - * to learn the true size of the underlying file. + * to learn the true size of the underlying file. + * + * Return: SUCCEED/FAIL * - * Return: Success: Non-negative - * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -840,23 +1054,26 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) H5F_t *file; /* File object for file ID */ haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ haddr_t base_addr; /* Base address for the file */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", file_id, size); /* Check args */ + if(!size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL") if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the actual file size */ + /* Get the actual file size */ if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") base_addr = H5FD_get_base_addr(file->shared->lf); + /* Convert relative base address for file to absolute address */ if(size) - *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */ + *size = (hsize_t)(max_eof_eoa + base_addr); done: FUNC_LEAVE_API(ret_value) @@ -867,56 +1084,58 @@ done: * Function: H5Fget_file_image * * Purpose: If a buffer is provided (via the buf_ptr argument) and is - * big enough (size in buf_len argument), load *buf_ptr with - * an image of the open file whose ID is provided in the - * file_id parameter, and return the number of bytes copied - * to the buffer. + * big enough (size in buf_len argument), load *buf_ptr with + * an image of the open file whose ID is provided in the + * file_id parameter, and return the number of bytes copied + * to the buffer. * - * If the buffer exists, but is too small to contain an image - * of the indicated file, return a negative number. + * If the buffer exists, but is too small to contain an image + * of the indicated file, return a negative number. * - * Finally, if no buffer is provided, return the size of the - * buffer needed. This value is simply the eoa of the target - * file. + * Finally, if no buffer is provided, return the size of the + * buffer needed. This value is simply the eoa of the target + * file. * - * Note that any user block is skipped. + * Note that any user block is skipped. * - * Also note that the function may not be used on files - * opened with either the split/multi file driver or the - * family file driver. + * Also note that the function may not be used on files + * opened with either the split/multi file driver or the + * family file driver. * - * In the former case, the sparse address space makes the - * get file image operation impractical, due to the size of - * the image typically required. + * In the former case, the sparse address space makes the + * get file image operation impractical, due to the size of + * the image typically required. * - * In the case of the family file driver, the problem is - * the driver message in the super block, which will prevent - * the image being opened with any driver other than the - * family file driver -- which negates the purpose of the - * operation. This can be fixed, but no resources for - * this now. + * In the case of the family file driver, the problem is + * the driver message in the super block, which will prevent + * the image being opened with any driver other than the + * family file driver -- which negates the purpose of the + * operation. This can be fixed, but no resources for + * this now. + * + * Return: Success: Bytes copied / number of bytes needed + * + * Failure: -1 * - * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value *------------------------------------------------------------------------- */ ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { - H5F_t *file; /* File object for file ID */ - ssize_t ret_value; /* Return value */ + H5F_t *file; /* File object for file ID */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len); /* Check args */ if(NULL == (file = (H5F_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, (-1), "not a file ID") - /* call private get_file_image function */ + /* Get the file image */ /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: FUNC_LEAVE_API(ret_value) @@ -924,17 +1143,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_mdc_config + * Function: H5Fget_mdc_config * - * Purpose: Retrieves the current automatic cache resize configuration - * from the metadata cache, and return it in *config_ptr. + * Purpose: Retrieves the current automatic cache resize configuration + * from the metadata cache, and return it in *config_ptr. * - * Note that the version field of *config_Ptr must be correctly - * filled in by the caller. This allows us to adapt for - * obsolete versions of the structure. + * Note that the version field of *config_Ptr must be correctly + * filled in by the caller. This allows us to adapt for + * obsolete versions of the structure. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -952,9 +1171,9 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") - /* Go get the resize configuration */ + /* Get the metadata cache configuration */ if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -965,11 +1184,11 @@ done: * Function: H5Fset_mdc_config * * Purpose: Sets the current metadata cache automatic resize - * configuration, using the contents of the instance of - * H5AC_cache_config_t pointed to by config_ptr. + * configuration, using the contents of the instance of + * H5AC_cache_config_t pointed to by config_ptr. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -981,13 +1200,13 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* set the resize configuration */ + /* Set the metadata cache configuration */ if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -998,12 +1217,12 @@ done: * Function: H5Fget_mdc_hit_rate * * Purpose: Retrieves the current hit rate from the metadata cache. - * This rate is the overall hit rate since the last time - * the hit rate statistics were reset either manually or - * automatically. + * This rate is the overall hit rate since the last time + * the hit rate statistics were reset either manually or + * automatically. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -1022,9 +1241,9 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") - /* Go get the current hit rate */ + /* Get the current hit rate */ if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: FUNC_LEAVE_API(ret_value) @@ -1035,13 +1254,13 @@ done: * Function: H5Fget_mdc_size * * Purpose: Retrieves the maximum size, minimum clean size, current - * size, and current number of entries from the metadata - * cache associated with the specified file. If any of - * the ptr parameters are NULL, the associated datum is - * not returned. + * size, and current number of entries from the metadata + * cache associated with the specified file. If any of + * the ptr parameters are NULL, the associated datum is + * not returned. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -1060,10 +1279,10 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the size data */ + /* Get the size data */ if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") if(cur_num_entries_ptr != NULL) *cur_num_entries_ptr = (int)cur_num_entries; @@ -1077,16 +1296,16 @@ done: * Function: H5Freset_mdc_hit_rate_stats * * Purpose: Reset the hit rate statistic whose current value can - * be obtained via the H5Fget_mdc_hit_rate() call. Note - * that this statistic will also be reset once per epoch - * by the automatic cache resize code if it is enabled. + * be obtained via the H5Fget_mdc_hit_rate() call. Note + * that this statistic will also be reset once per epoch + * by the automatic cache resize code if it is enabled. + * + * It is probably a bad idea to call this function unless + * you are controlling cache size from your program instead + * of using our cache size control code. * - * It is probably a bad idea to call this function unless - * you are controlling cache size from your program instead - * of using our cache size control code. + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -1098,13 +1317,13 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, 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) @@ -1115,18 +1334,21 @@ done: * Function: H5Fget_name * * Purpose: Gets the name of the file to which object OBJ_ID belongs. - * If `name' is non-NULL then write up to `size' bytes into that + * If 'name' is non-NULL then write up to 'size' bytes into that * buffer and always return the length of the entry name. - * Otherwise `size' is ignored and the function does not store the name, - * just returning the number of characters required to store the name. - * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) - * is unchanged and the function returns a negative value. + * Otherwise `size' is ignored and the function does not store + * the name, just returning the number of characters required to + * store the name. If an error occurs then the buffer pointed to + * by 'name' (NULL or non-NULL) is unchanged and the function + * returns a negative value. * * Note: This routine returns the name that was used to open the file, * not the actual name after resolving symlinks, etc. * - * Return: Success: The length of the file name - * Failure: Negative + * Return: Success: The length of the file name + * + * Failure: -1 + * *------------------------------------------------------------------------- */ ssize_t @@ -1134,9 +1356,9 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { H5F_t *f; /* Top file in mount hierarchy */ size_t len; - ssize_t ret_value; + ssize_t ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); /* For file IDs, get the file object directly */ @@ -1145,14 +1367,14 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) */ if(H5I_get_type(obj_id) == H5I_FILE ) { if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file") } /* end if */ else { H5G_loc_t loc; /* Object location */ /* Get symbol table entry */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a valid object ID") f = loc.oloc->file; } /* end else */ @@ -1181,42 +1403,48 @@ done: * in the SOHM table if there is one. * 3. The amount of free space tracked in the file. * - * Return: Success: non-negative on success - * Failure: Negative + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) { H5F_t *f; /* Top file in mount hierarchy */ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_type_t type; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", obj_id, finfo); /* Check args */ if(!finfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL") - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { + /* 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") + + /* Get the file object */ + if(type == H5I_FILE ) { + /* For file IDs, get the file object directly */ + /* (This prevents the H5G_loc() call from returning the file pointer for + * the top file in a mount hierarchy) + */ if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") } /* end if */ else { H5G_loc_t loc; /* Object location */ /* Get symbol table entry */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object identifier") f = loc.oloc->file; } /* end else */ - HDassert(f->shared); - /* Get the file info */ + /* Get the file information */ if(H5F__get_info(f, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") @@ -1228,17 +1456,18 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_metadata_read_retry_info * - * Purpose: To retrieve the collection of read retries for metadata items with checksum. + * Purpose: To retrieve the collection of read retries for metadata + * items with checksum. + * + * Return: SUCCEED/FAIL * - * Return: Success: non-negative on success - * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) { H5F_t *file; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, info); @@ -1252,7 +1481,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5F__get_metadata_read_retry_info(file, info) < 0) + if(H5F_get_metadata_read_retry_info(file, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1261,36 +1490,38 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_free_sections + * Function: H5Fget_free_sections + * + * Purpose: To get free-space section information for free-space manager with + * TYPE that is associated with file FILE_ID. + * If SECT_INFO is null, this routine returns the total # of free-space + * sections. + * + * Return: Success: The total # of free space sections * - * Purpose: To get free-space section information for free-space manager with - * TYPE that is associated with file FILE_ID. - * If SECT_INFO is null, this routine returns the total # of free-space - * sections. + * Failure: -1 * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative *------------------------------------------------------------------------- */ ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/) { - H5F_t *file; /* Top file in mount hierarchy */ - ssize_t ret_value; /* Return value */ + H5F_t *file; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info); /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") if(sect_info && nsects == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: FUNC_LEAVE_API(ret_value) @@ -1304,15 +1535,15 @@ done: * provided file, potentially closing any cached files * unless they are held open from somewhere\ else. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fclear_elink_file_cache(hid_t file_id) { - H5F_t *file; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1335,9 +1566,34 @@ done: /*------------------------------------------------------------------------- * Function: H5Fstart_swmr_write * - * Purpose: To enable SWMR writing mode for the file + * Purpose: To enable SWMR writing mode for the file + * + * 1) Refresh opened objects: part 1 + * 2) Flush & reset accumulator + * 3) Mark the file in SWMR writing mode + * 4) Set metadata read attempts and retries info + * 5) Disable accumulator + * 6) Evict all cache entries except the superblock + * 7) Refresh opened objects (part 2) + * 8) Unlock the file + * + * Pre-conditions: + * + * 1) The file being opened has v3 superblock + * 2) The file is opened with H5F_ACC_RDWR + * 3) The file is not already marked for SWMR writing + * 4) Current implementaion for opened objects: + * --only allow datasets and groups without attributes + * --disallow named datatype with/without attributes + * --disallow opened attributes attached to objects + * + * NOTE: Currently, only opened groups and datasets are allowed + * when enabling SWMR via H5Fstart_swmr_write(). + * Will later implement a different approach-- + * set up flush dependency/proxy even for file opened without + * SWMR to resolve issues with opened objects. * - * Return: Non-negative on success/negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1345,22 +1601,22 @@ herr_t H5Fstart_swmr_write(hid_t file_id) { H5F_t *file = NULL; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* check args */ + /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + 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") - /* Call the internal routine */ + /* start SWMR writing */ if(H5F__start_swmr_write(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") + HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: FUNC_LEAVE_API(ret_value) @@ -1373,7 +1629,8 @@ done: * Purpose: Start metadata cache logging operations for a file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1405,7 +1662,8 @@ done: * - Does not close the log file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1437,7 +1695,8 @@ done: * set up via the fapl. is_currently_logging determines if * log messages are being recorded at this time. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1471,14 +1730,15 @@ done: * H5Fset_latest_format() starting release 1.10.2. * See explanation for H5Fset_latest_format() in H5Fdeprec.c. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { - H5F_t *f; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *f; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "iFvFv", file_id, low, high); @@ -1501,38 +1761,40 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fformat_convert + * Function: H5Fformat_convert (Internal) + * + * Purpose: Downgrade the superblock version to v2 and + * downgrade persistent file space to non-persistent + * for 1.8 library. * - * Purpose: Downgrade the superblock version to v2 and - * downgrade persistent file space to non-persistent - * for 1.8 library. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t -H5Fformat_convert(hid_t fid) +H5Fformat_convert(hid_t file_id) { - H5F_t *f; /* File to flush */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *f = NULL; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", fid); + H5TRACE1("e", "i", file_id); - if(H5I_FILE != H5I_get_type(fid)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + /* Check args */ + if(H5I_FILE != H5I_get_type(file_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier") /* Get file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + if(NULL == (f = (H5F_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(fid) < 0) + if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the internal routine */ + /* Convert the format */ if(H5F__format_convert(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") + HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: FUNC_LEAVE_API(ret_value) @@ -1544,15 +1806,15 @@ done: * * Purpose: Resets statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Freset_page_buffering_stats(hid_t file_id) { - H5F_t *file; /* File to reset stats on */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File to reset stats on */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1565,7 +1827,7 @@ H5Freset_page_buffering_stats(hid_t file_id) /* Reset the statistics */ if(H5PB_reset_stats(file->shared->page_buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, 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) @@ -1577,15 +1839,15 @@ done: * * Purpose: Retrieves statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]) { - H5F_t *file; /* File object for file ID */ + H5F_t *file; /* File object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1618,8 +1880,8 @@ done: * image_len: --size of the on disk metadata cache image * --zero if no cache image * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1653,10 +1915,7 @@ done: * allocated memory in the file. * (See H5FDget_eoa() in H5FD.c) * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF - * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1695,7 +1954,7 @@ done: * * Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1729,3 +1988,4 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) done: FUNC_LEAVE_API(ret_value) } /* H5Fincrement_filesize() */ + diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 6417956..c91d0ea 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -35,12 +35,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ @@ -84,16 +84,12 @@ * Function: H5Fget_info1 * * Purpose: Gets general information about the file, including: - * 1. Get storage size for superblock extension if there is one. + * 1. Get storage size for superblock extension if there is one. * 2. Get the amount of btree and heap storage for entries * in the SOHM table if there is one. - * 3. The amount of free space tracked in the file. + * 3. The amount of free space tracked in the file. * - * Return: Success: non-negative on success - * Failure: Negative - * - * Programmer: Vailin Choi - * July 11, 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -111,14 +107,15 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) if(!finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for + /* For file IDs, get the file object directly + * + * (This prevents the H5G_loc() call from returning the file pointer for * the top file in a mount hierarchy) */ if(H5I_get_type(obj_id) == H5I_FILE ) { if(NULL == (f = (H5F_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - } /* end if */ + } else { H5G_loc_t loc; /* Object location */ @@ -126,7 +123,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") f = loc.oloc->file; - } /* end else */ + } HDassert(f->shared); /* Get the current file info */ @@ -193,7 +190,8 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") /* 'low' and 'high' are both initialized to LATEST. - If latest format is not expected, set 'low' to EARLIEST */ + * If latest format is not expected, set 'low' to EARLIEST + */ if(!latest_format) low = H5F_LIBVER_EARLIEST; diff --git a/src/H5Fint.c b/src/H5Fint.c index 432cd8e..39934d6 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -47,7 +47,7 @@ /* Local Typedefs */ /******************/ -/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */ +/* Struct only used by functions H5F__get_objects and H5F__get_objects_cb */ typedef struct H5F_olist_t { H5I_type_t obj_type; /* Type of object to look for */ hid_t *obj_id_list; /* Pointer to the list of open IDs to return */ @@ -73,10 +73,11 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ -static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); +static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); +static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); -static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); +static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -104,19 +105,19 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- - * Function: H5F_get_access_plist + * Function: H5F_get_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t @@ -127,71 +128,71 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ unsigned efc_size = 0; - hid_t ret_value = SUCCEED; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check args */ HDassert(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, FAIL, "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_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") + HGOTO_ERROR(H5E_PLIST, 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, FAIL, "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_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set alignment threshold") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set alignment") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache size") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "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_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "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_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 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_PLIST, H5E_CANTGET, FAIL, "can't set page buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 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_PLIST, H5E_CANTGET, FAIL, "can't set minimum metadata fraction of page buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "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_PLIST, H5E_CANTGET, FAIL, "can't set minimum raw data fraction of page buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "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->coll_md_read)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") #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_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_PLIST, 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; @@ -200,18 +201,18 @@ 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_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver 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_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, 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_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, 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_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "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() */ @@ -237,8 +238,8 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_i HDassert(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_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed") + 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") done: FUNC_LEAVE_NOAPI(ret_value) @@ -264,8 +265,8 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list HDassert(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_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed") + 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") done: FUNC_LEAVE_NOAPI(ret_value) @@ -273,23 +274,23 @@ done: /*--------------------------------------------------------------------------- - * Function: H5F_get_objects + * Function: H5F__get_objects * - * Purpose: This function is called by H5F_get_obj_count or - * H5F_get_obj_ids to get number of object IDs and/or a - * list of opened object IDs (in return value). + * Purpose: This function is called by H5F_get_obj_count or + * H5F_get_obj_ids to get number of object IDs and/or a + * list of opened object IDs (in return value). * - * Return: Non-negative on success; Can't fail. + * Return: SUCCEED/FAIL *--------------------------------------------------------------------------- */ -herr_t -H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) +static herr_t +H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) { - size_t obj_id_count=0; /* Number of open IDs */ + size_t obj_id_count = 0; /* Number of open IDs */ H5F_olist_t olist; /* Structure to hold search results */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(obj_id_count_ptr); @@ -304,30 +305,30 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ if(types & H5F_OBJ_LOCAL) { olist.file_info.local = TRUE; olist.file_info.ptr.file = f; - } /* end if */ + } else { olist.file_info.local = FALSE; olist.file_info.ptr.shared = f ? f->shared : NULL; - } /* end else */ + } /* Iterate through file IDs to count the number, and put their * IDs on the object list. */ if(types & H5F_OBJ_FILE) { olist.obj_type = H5I_FILE; - if(H5I_iterate(H5I_FILE, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0) 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), * or the caller wants to get the list of IDs and the list isn't full, * search through dataset IDs to count number of datasets, and put their * IDs on the object list */ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_indexfile_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } /* end if */ - } /* end if */ - else { /* either count opened object IDs or put the IDs on the list */ + } + } + else { /* Either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ switch(olist->obj_type) { @@ -456,7 +457,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } /* end if */ + } } /* end else */ if(add_obj) { @@ -464,7 +465,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) if(olist->obj_id_list) { olist->obj_id_list[olist->list_index] = obj_id; olist->list_index++; - } /* end if */ + } /* Increment the number of open objects */ if(olist->obj_id_count) @@ -473,14 +474,15 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) /* Check if we've filled up the array. Return H5_ITER_STOP only if * we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is * preset to H5_ITER_CONT) because H5I_iterate needs the return value of - * H5_ITER_CONT to continue the iteration. */ + * 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 */ + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_objects_cb() */ +} /* end H5F__get_objects_cb() */ /*-------------------------------------------------------------------------- @@ -489,7 +491,6 @@ done: * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME * * Return: SUCCEED/FAIL - * *--------------------------------------------------------------------------*/ static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/) @@ -517,14 +518,14 @@ done: /*-------------------------------------------------------------------------- - * Function: H5F__getenv_prefix_name + * Function: H5F__getenv_prefix_name * - * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, - * which is separated by the environment delimiter. - * env_prefix is modified to point to the remaining pathnames - * in the list. + * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, + * which is separated by the environment delimiter. + * env_prefix is modified to point to the remaining pathnames + * in the list. * - * Return: A pointer to a pathname + * Return: A pointer to a pathname (can't fail but can return NULL) --------------------------------------------------------------------------*/ static char * H5F__getenv_prefix_name(char **env_prefix/*in,out*/) @@ -666,6 +667,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, /* Leave if file was opened */ else break; + H5E_clear_stack(NULL); } /* end if */ } /* end while */ @@ -776,28 +778,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__is_hdf5 + * Function: H5F__is_hdf5 * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. * - * Return: Success: TRUE/FALSE - * * Failure: Negative + * Return: TRUE/FALSE/FAIL *------------------------------------------------------------------------- */ htri_t H5F__is_hdf5(const char *name) { - H5FD_t *file = NULL; /* Low-level file struct */ - haddr_t sig_addr; /* Addess of hdf5 file signature */ - htri_t ret_value = FAIL; /* Return value */ + H5FD_t *file = NULL; /* Low-level file struct */ + haddr_t sig_addr; /* Addess of hdf5 file signature */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE - /* Open the file at the virtual file layer */ + /* Open the file */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") @@ -809,7 +810,7 @@ H5F__is_hdf5(const char *name) done: /* Close the file */ if(file) - if(H5FD_close(file) < 0 && ret_value >= 0) + if(H5FD_close(file) < 0 && TRUE == ret_value) HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") FUNC_LEAVE_NOAPI(ret_value) @@ -1045,7 +1046,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ 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) + if(H5F__sfile_add(f->shared) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files") } /* end else */ @@ -1079,14 +1080,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__dest + * Function: H5F__dest * - * Purpose: Destroys a file structure. This function flushes the cache - * but doesn't do any other cleanup other than freeing memory - * for the file struct. The shared info for the file is freed - * only when its reference count reaches zero. + * Purpose: Destroys a file structure. This function flushes the cache + * but doesn't do any other cleanup other than freeing memory + * for the file struct. The shared info for the file is freed + * only when its reference count reaches zero. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1240,7 +1241,7 @@ H5F__dest(H5F_t *f, hbool_t flush) HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Remove shared file struct from list of open files */ - if(H5F_sfile_remove(f->shared) < 0) + if(H5F__sfile_remove(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") @@ -1490,7 +1491,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ /* Is the file already open? */ - if((shared = H5F_sfile_search(lf)) != NULL) { + if((shared = H5F__sfile_search(lf)) != NULL) { /* * The file is already open, so use that one instead of the one we * just opened. We only one one H5FD_t* per file so one doesn't @@ -1622,7 +1623,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(H5G_mkroot(file, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") } /* end if */ - else if (1 == shared->nrefs) { + 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") @@ -1687,7 +1688,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) 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) + 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") if(set_flag) { @@ -1749,11 +1750,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_flush_phase1 + * Function: H5F_flush_phase1 * - * Purpose: First phase of flushing cached data. + * Purpose: First phase of flushing cached data. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1786,11 +1788,12 @@ H5F__flush_phase1(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F__flush_phase2 + * Function: H5F__flush_phase2 * - * Purpose: Second phase of flushing cached data. + * Purpose: Second phase of flushing cached data. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1809,13 +1812,14 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) 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)) + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* Since we just returned from a call to H5AC_flush(), we just * passed through a barrier. Hence we can skip the barrier on * entry to the mpio file driver truncate call below, and the first * barrier in the following call to flush the cache again. */ H5CX_set_mpi_file_flushing(TRUE); + } #endif /* H5_HAVE_PARALLEL */ /* Truncate the file to the current allocated size */ @@ -1854,11 +1858,12 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /*------------------------------------------------------------------------- - * Function: H5F__flush + * Function: H5F__flush + * + * Purpose: Flushes cached data. * - * Purpose: Flushes cached data. + * Return: SUCCEED/FAIL * - * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1890,10 +1895,7 @@ H5F__flush(H5F_t *f) * * Purpose: Internal routine to close a file. * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * December 16, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1933,72 +1935,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__close_cb - * - * Purpose: Closes a file or causes the close operation to be pended. - * This function is called from the API and gets called - * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() - * decrements the file ID reference count to zero. The file ID - * is removed from the H5I_FILE group by H5I_dec_ref() just - * before H5F__close_cb() is called. If there are open object - * headers then the close is pended by moving the file to the - * H5I_FILE_CLOSING ID group (the f->closing contains the ID - * assigned to file). - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5F__close_cb(H5F_t *f) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(f); - HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ - - /* Perform checks for "semi" file close degree here, since closing the - * file is not allowed if there are objects still open */ - if(f->shared->fc_degree == H5F_CLOSE_SEMI) { - unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ - unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ - - /* 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") - - /* 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, - * without decrementing the file ID's reference count and triggering - * 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") - } /* end if */ - - /* Reset the file ID for this file */ - f->file_id = -1; - - /* 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") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__close_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_try_close + * Function: H5F_try_close * - * Purpose: Attempts to close a file due to one of several actions: - * - The reference count on the file ID dropped to zero - * - The last open object was closed in the file - * - The file was unmounted + * Purpose: Attempts to close a file due to one of several actions: + * - The reference count on the file ID dropped to zero + * - The last open object was closed in the file + * - The file was unmounted * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -2029,7 +1973,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) if(was_closed) *was_closed = TRUE; HGOTO_DONE(SUCCEED) - } /* end if */ + } /* 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) @@ -2063,7 +2007,8 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) 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 */ + * far and there are objects left open, bail out now. + */ HDassert(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 */ @@ -2104,9 +2049,9 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) for(u = 0; u < obj_count; u++) if(H5I_dec_ref(objs[u]) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object") - } /* end while */ + } if(result < 0) - HGOTO_ERROR(H5E_INTERNAL, 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 @@ -2120,7 +2065,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) for(u = 0; u < obj_count; u++) if(H5I_dec_ref(objs[u]) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object") - } /* end while */ + } if(result < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)") } /* end if */ @@ -2139,17 +2084,18 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* 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 - * can happen if a cycle is formed with external file caches */ + * can happen if a cycle is formed with external file caches. + */ 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") /* Delay flush until the shared file struct is closed, in H5F__dest. If the * application called H5Fclose, it would have been flushed in that function - * (unless it will have been flushed in H5F_dest anyways). */ + * (unless it will have been flushed in H5F_dest anyways). + */ - /* - * Destroy the H5F_t struct and decrement the reference count for the + /* Destroy the H5F_t struct and decrement the reference count for the * shared H5F_file_t struct. If the reference count for the H5F_file_t * struct reaches zero then destroy it also. */ @@ -2163,14 +2109,53 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_try_close() */ + +/*------------------------------------------------------------------------- + * Function: H5F__reopen + * + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. + * + * Return: Success: A pointer to a file struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5F_t * +H5F__reopen(H5F_t *f) +{ + H5F_t *ret_value = NULL; + + FUNC_ENTER_PACKAGE + + /* 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") + + /* Duplicate old file's names */ + ret_value->open_name = H5MM_xstrdup(f->open_name); + ret_value->actual_name = H5MM_xstrdup(f->actual_name); + ret_value->extpath = H5MM_xstrdup(f->extpath); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__reopen() */ + /*------------------------------------------------------------------------- - * Function: H5F_get_id + * Function: H5F_get_id * - * Purpose: Get the file ID, incrementing it, or "resurrecting" it as - * appropriate. + * Purpose: Get the file ID, incrementing it, or "resurrecting" it as + * appropriate. + * + * Return: Success: An ID for a file + * + * Failure: H5I_INVALID_HID * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ hid_t @@ -2185,13 +2170,13 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) if(file->file_id == -1) { /* Get an atom for the file */ if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") } else { - /* Increment reference count on atom. */ + /* Increment reference count on existing ID */ if(H5I_inc_ref(file->file_id, app_ref) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") - } /* end else */ + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + } ret_value = file->file_id; @@ -2201,12 +2186,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_incr_nopen_objs + * Function: H5F_incr_nopen_objs * - * Purpose: Increment the number of open objects for a file. + * Purpose: Increment the number of open objects for a file. * - * Return: Success: The number of open objects, after the increment - * Failure: (can't happen) + * Return: Success: The number of open objects, after the increment + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -2222,12 +2207,12 @@ H5F_incr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_decr_nopen_objs + * Function: H5F_decr_nopen_objs * - * Purpose: Decrement the number of open objects for a file. + * Purpose: Decrement the number of open objects for a file. * - * Return: Success: The number of open objects, after the decrement - * Failure: (can't happen) + * Return: Success: The number of open objects, after the decrement + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -2243,28 +2228,27 @@ H5F_decr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_build_actual_name + * Function: H5F__build_actual_name * - * Purpose: Retrieve the name of a file, after following symlinks, etc. + * Purpose: Retrieve the name of a file, after following symlinks, etc. * - * Note: Currently only working for "POSIX I/O compatible" VFDs + * Note: Currently only working for "POSIX I/O compatible" VFDs * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, +H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char **actual_name/*out*/) { - hid_t new_fapl_id = -1; /* ID for duplicated FAPL */ + hid_t new_fapl_id = H5I_INVALID_HID; /* ID for duplicated FAPL */ #ifdef H5_HAVE_SYMLINK /* This has to be declared here to avoid unfreed resources on errors */ char *realname = NULL; /* Fully resolved path name of file */ #endif /* H5_HAVE_SYMLINK */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -2361,17 +2345,17 @@ done: #endif /* H5_HAVE_SYMLINK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_build_actual_name() */ +} /* H5F__build_actual_name() */ /*------------------------------------------------------------------------- - * Function: H5F_addr_encode_len + * Function: H5F_addr_encode_len * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2402,13 +2386,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_encode + * Function: H5F_addr_encode * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2426,16 +2410,16 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_decode_len + * Function: H5F_addr_decode_len * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. + * If the value read is all 1's then the address is returned + * with an undefined value. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2490,16 +2474,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr /*------------------------------------------------------------------------- - * Function: H5F_addr_decode + * Function: H5F_addr_decode * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. + * If the value read is all 1's then the address is returned + * with an undefined value. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2521,8 +2505,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o * * Purpose: Set the grp_btree_shared field with a valid ref-count pointer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2547,8 +2530,7 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc) * * Purpose: Set the sohm_addr field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2572,8 +2554,7 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr) * * Purpose: Set the sohm_vers field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2597,8 +2578,7 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers) * * Purpose: Set the sohm_nindexes field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2622,8 +2602,7 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes) * * Purpose: Set the store_msg_crt_idx field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2643,14 +2622,14 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) /*------------------------------------------------------------------------- - * Function: H5F_set_libver_bounds() + * Function: H5F__set_libver_bounds() * * Purpose: Set the file's low and high bound to the input parameters * 'low' and 'high' respectively. * This is done only if the existing setting is different * from the inputs. * - * Return: SUCCEED on success, and FAIL on failure. + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi; December 2017 * @@ -2695,11 +2674,11 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) /* Set the new bounds */ f->shared->low_bound = low; f->shared->high_bound = high; - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_set_libver_bounds() */ +} /* H5F__set_libver_bounds() */ /*------------------------------------------------------------------------- @@ -2708,7 +2687,7 @@ done: * Purpose: Private version of H5Fget_file_image * * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -2722,10 +2701,10 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* 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, (-1), "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, (-1), "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 @@ -2746,7 +2725,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) * 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, (-1), "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 @@ -2768,11 +2747,11 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) * 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, (-1), "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, (-1), "unable to get file size") /* set ret_value = to eoa -- will overwrite this if appropriate */ ret_value = (ssize_t)eoa; @@ -2785,14 +2764,14 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* 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, (-1), "supplied buffer too small") space_needed = (size_t)eoa; /* read in the file image */ /* (Note compensation for base address addition in internal routine) */ if(H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed") + HGOTO_ERROR(H5E_FILE, H5E_READERROR, (-1), "file image read request failed") /* Offset to "status_flags" in the superblock */ tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers); @@ -2857,16 +2836,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_track_metadata_read_retries + * Function: H5F_track_metadata_read_retries * - * Purpose: To track the # of a "retries" (log10) for a metadata item. - * This routine should be used only when: - * "retries" > 0 - * f->shared->read_attempts > 1 (does not have retry when 1) - * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) + * Purpose: To track the # of a "retries" (log10) for a metadata item. + * This routine should be used only when: + * "retries" > 0 + * f->shared->read_attempts > 1 (does not have retry when 1) + * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2905,14 +2883,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_set_retries + * Function: H5F_set_retries * - * Purpose: To initialize data structures for read retries: - * --zero out "retries" - * --set up "retries_nbins" based on read_attempts + * Purpose: To initialize data structures for read retries: + * --zero out "retries" + * --set up "retries_nbins" based on read_attempts * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3053,11 +3030,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_max_eof_eoa + * Function: H5F__get_max_eof_eoa * - * Purpose: Determine the maximum of (EOA, EOF) for the file + * Purpose: Determine the maximum of (EOA, EOF) for the file * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3096,8 +3073,7 @@ done: * * Purpose: Set the coll_md_read field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ void @@ -3117,7 +3093,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) /*------------------------------------------------------------------------- - * Function: H5F__get_metadata_read_retry_info + * Function: H5F_get_metadata_read_retry_info * * Purpose: Private function to retrieve the collection of read retries * for metadata items with checksum. @@ -3127,13 +3103,13 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) *------------------------------------------------------------------------- */ herr_t -H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) +H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) { unsigned i, j; /* Local index variable */ size_t tot_size; /* Size of each retries[i] */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(file); @@ -3146,7 +3122,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) HDmemset(info->retries, 0, sizeof(info->retries)); /* Return if there are no bins -- no retries */ - if (!info->nbins) + if(!info->nbins) HGOTO_DONE(SUCCEED); /* Calculate size for each retries[i] */ @@ -3154,7 +3130,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) /* Map and copy information to info's retries for metadata items with tracking for read retries */ j = 0; - for (i = 0; i < H5AC_NTYPES; i++) { + for(i = 0; i < H5AC_NTYPES; i++) { switch (i) { case H5AC_OHDR_ID: case H5AC_OHDR_CHK_ID: @@ -3178,13 +3154,13 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) case H5AC_FARRAY_DBLK_PAGE_ID: case H5AC_SUPERBLOCK_ID: HDassert(j < H5F_NUM_METADATA_READ_RETRY_TYPES); - if (file->shared->retries[i] != NULL) { + if(file->shared->retries[i] != NULL) { /* Allocate memory for retries[i] * * This memory should be released by the user with * the H5free_memory() call. */ - if (NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size))) + if(NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the information */ @@ -3202,8 +3178,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__get_metadata_read_retry_info() */ - +} /* end H5F_get_metadata_read_retry_info() */ /*------------------------------------------------------------------------- @@ -3230,14 +3205,14 @@ done: * --disallow named datatype with/without attributes * --disallow opened attributes attached to objects * - * Note: Currently, only opened groups and datasets are allowed + * NOTE: Currently, only opened groups and datasets are allowed * when enabling SWMR via H5Fstart_swmr_write(). * Will later implement a different approach-- * set up flush dependency/proxy even for file opened without * SWMR to resolve issues with opened objects. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -3289,17 +3264,17 @@ H5F__start_swmr_write(H5F_t *f) /* Flush data buffers */ if(H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f'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_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") if(nt_attr_count) 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_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") if(grp_dset_count) { /* Allocate space for group and object locations */ @@ -3377,9 +3352,10 @@ H5F__start_swmr_write(H5F_t *f) 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++) + for(u = 0; u < grp_dset_count; u++) { if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") + } /* Unlock the file */ if(H5FD_unlock(f->shared->lf) < 0) @@ -3387,7 +3363,6 @@ H5F__start_swmr_write(H5F_t *f) done: if(ret_value < 0 && setup) { - HDassert(f); /* Re-enable accumulator */ f->shared->feature_flags |= (unsigned)H5FD_FEAT_ACCUMULATE_METADATA; @@ -3402,7 +3377,7 @@ done: /* Un-set H5F_ACC_SWMR_WRITE in shared open flags */ f->shared->flags &= ~H5F_ACC_SWMR_WRITE; - /* Unmark the f: not in SWMR writing mode */ + /* Unmark the file: not in SWMR writing mode */ f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS); /* Mark superblock as dirty */ @@ -3425,7 +3400,7 @@ done: H5MM_xfree(obj_paths); FUNC_LEAVE_NOAPI(ret_value) -} /* H5F__start_swmr_write() */ +} /* end H5F__start_swmr_write() */ /*------------------------------------------------------------------------- @@ -3451,39 +3426,40 @@ H5F__format_convert(H5F_t *f) /* Check if the superblock should be downgraded */ if(f->shared->sblock->super_vers > HDF5_SUPERBLOCK_VERSION_V18_LATEST) { - f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST; - mark_dirty = TRUE; - } /* end if */ + f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST; + mark_dirty = TRUE; + } /* Check for persistent freespace manager, which needs to be downgraded */ if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF && f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF && 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(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "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") - - /* Set non-persistent freespace manager */ - f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF; - f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF; - f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; - f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF; - - /* Indicate that the superblock should be marked dirty */ - mark_dirty = TRUE; + + /* Check to remove free-space manager info message from superblock extension */ + if(H5F_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") + + /* Close freespace manager */ + if(H5MF_try_close(f) < 0) + 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; + f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF; + f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; + f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF; + + /* Indicate that the superblock should be marked dirty */ + mark_dirty = TRUE; } /* end if */ /* Check if we should mark the superblock dirty */ 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") + /* Mark superblock as dirty */ + if(H5F_super_dirty(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fio.c b/src/H5Fio.c index 830b7ee..69e6bb2 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -92,8 +92,7 @@ *------------------------------------------------------------------------- */ herr_t -H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/) +H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ @@ -138,8 +137,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf) +H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index b04bd3a..e6106a2 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -132,7 +132,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED */ if(child->parent) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted") - if(H5G_loc_find(loc, name, &mp_loc/*out*/) < 0) + if(H5G_loc_find(loc, name, &mp_loc) < 0) 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 @@ -462,7 +462,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t 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 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) diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index f854d3b..7620d95 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -320,11 +320,11 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) attached to the loc_id */ if(H5I_INVALID_HID != loc_id) { H5G_loc_t loc; - H5F_t *f; + H5F_t *f = NULL; /* Retrieve the file structure */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") f = loc.oloc->file; HDassert(f); @@ -333,8 +333,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) /* 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") - } /* end if */ - } /* end if */ + } + } /* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */ else { H5P_genplist_t *plist; /* Property list pointer */ @@ -349,8 +349,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad VFL driver info") *mpi_comm = fa->comm; - } /* end if */ - } /* end else */ + } + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 3716c66..44344f0 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -325,7 +325,7 @@ struct H5F_file_t { /* been used accessed for either */ /* allocation or deallocation */ /* since file open. */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ + haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ /* for self referential FSMs */ haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ /* for self referential FSMs */ @@ -377,6 +377,19 @@ struct H5F_t { #endif /* H5_HAVE_PARALLEL */ }; +/* User data for traversal routine to get ID counts */ +typedef struct { + ssize_t *obj_count; /* number of objects counted so far */ + unsigned types; /* types of objects to be counted */ +} H5F_trav_obj_cnt_t; + +/* User data for traversal routine to get ID lists */ +typedef struct { + size_t max_objs; + hid_t *oid_list; + ssize_t *obj_count; /* number of objects counted so far */ + unsigned types; /* types of objects to be counted */ +} H5F_trav_obj_ids_t; /*****************************/ /* Package Private Variables */ @@ -394,18 +407,16 @@ H5FL_EXTERN(H5F_file_t); /******************************/ /* General routines */ +H5_DLL H5F_t *H5F__reopen(H5F_t *f); H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name); -H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); -H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(hid_t file_id); -H5_DLL herr_t H5F__close_cb(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); /* File mount related routines */ @@ -421,7 +432,7 @@ H5_DLL herr_t H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_ H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ -H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); +H5_DLL herr_t H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags); H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); @@ -434,9 +445,9 @@ H5_DLL herr_t H5F__accum_flush(H5F_t *f); H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush); /* Shared file list related routines */ -H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared); -H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf); -H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared); +H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared); +H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf); +H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 979ba7d..1ce9374 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -715,7 +715,6 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); -H5_DLL herr_t H5F_start_swmr_write(H5F_t *file); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); @@ -763,7 +762,6 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f); H5_DLL double H5F_rdcc_w0(const H5F_t *f); H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f); H5_DLL unsigned H5F_gc_ref(const H5F_t *f); -H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl); H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f); H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag); H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f); @@ -799,7 +797,7 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si /* 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); +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); @@ -807,6 +805,7 @@ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s /* Routine to track the # of retries */ H5_DLL herr_t H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries); H5_DLL herr_t H5F_set_retries(H5F_t *f); +H5_DLL herr_t H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); /* Routine to invoke callback function upon object flush */ H5_DLL herr_t H5F_object_flush_cb(H5F_t *f, hid_t obj_id); diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index e0c830b..ebc2ab2 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -40,11 +40,11 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL; /*------------------------------------------------------------------------- - * Function: H5F_sfile_assert_num + * Function: H5F_sfile_assert_num * - * Purpose: Sanity checking that shared file list is empty + * Purpose: Sanity checking that shared file list is empty * - * Return: none (void) + * Return: void * * Programmer: Quincey Koziol * Monday, July 25, 2005 @@ -84,33 +84,31 @@ H5F_sfile_assert_num(unsigned n) /*------------------------------------------------------------------------- - * Function: H5F_sfile_add + * Function: H5F__sfile_add * - * Purpose: Add a "shared" file struct to the list of open files + * Purpose: Add a "shared" file struct to the list of open files * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5F_sfile_add(H5F_file_t *shared) +H5F__sfile_add(H5F_file_t *shared) { H5F_sfile_node_t *new_shared; /* New shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(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; @@ -121,31 +119,29 @@ H5F_sfile_add(H5F_file_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_add() */ +} /* end H5F__sfile_add() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_search + * Function: H5F__sfile_search * - * Purpose: Search for a "shared" file with low-level file info that + * Purpose: Search for a "shared" file with low-level file info that * matches * - * Return: Non-NULL on success / NULL on failure + * Return: Non-NULL on success / NULL on failure * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ H5F_file_t * -H5F_sfile_search(H5FD_t *lf) +H5F__sfile_search(H5FD_t *lf) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_file_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(lf); @@ -154,7 +150,7 @@ H5F_sfile_search(H5FD_t *lf) curr = H5F_sfile_head_g; while(curr) { /* Check for match */ - if(0==H5FD_cmp(curr->shared->lf, lf)) + if(0 == H5FD_cmp(curr->shared->lf, lf)) HGOTO_DONE(curr->shared) /* Advance to next shared file node */ @@ -163,31 +159,29 @@ H5F_sfile_search(H5FD_t *lf) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_search() */ +} /* end H5F__sfile_search() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_remove + * Function: H5F__sfile_remove * - * Purpose: Remove a "shared" file struct from the list of open files + * Purpose: Remove a "shared" file struct from the list of open files * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5F_sfile_remove(H5F_file_t *shared) +H5F__sfile_remove(H5F_file_t *shared) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_sfile_node_t *last; /* Last shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(shared); @@ -203,7 +197,7 @@ H5F_sfile_remove(H5F_file_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) @@ -219,5 +213,5 @@ H5F_sfile_remove(H5F_file_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_remove() */ +} /* end H5F__sfile_remove() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 9339b3d..489cc21 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -134,7 +134,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_ext_open + * Function: H5F__super_ext_open * * Purpose: Open an existing superblock extension * @@ -146,11 +146,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) +H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -168,7 +168,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_super_ext_open() */ +} /* H5F__super_ext_open() */ /*------------------------------------------------------------------------- @@ -398,7 +398,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) } /* end if */ else { - /* Locate the signature as per per the serial library */ + /* Locate the signature as per per the serial library */ #endif /* H5_HAVE_PARALLEL */ if(H5FD_locate_signature(file, &super_addr) < 0) @@ -705,7 +705,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) } /* end if */ /* Open the superblock extension */ - if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0) + 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") /* Check for the extension having a 'driver info' message */ @@ -836,7 +836,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(!skip_eof_check && !null_fsm_addr) { HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF)); HDassert(!f->shared->first_alloc_dealloc); - } /* end if */ + } /* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file * with persistent free space managers, therefore, set @@ -882,14 +882,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(null_fsm_addr) { 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") - } /* end if */ + } else { if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "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") - } /* end else */ + } #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ f->shared->sblock = NULL; #endif /* JRM */ @@ -962,20 +962,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Write driver info information to the superblock extension */ #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - /* KLUGE ALERT!! - * - * H5F__super_ext_write_msg() expects f->shared->sblock to - * 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); - f->shared->sblock = sblock; + /* KLUGE ALERT!! + * + * H5F__super_ext_write_msg() expects f->shared->sblock to + * 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); + f->shared->sblock = sblock; #endif /* JRM */ - if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) + 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") #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - f->shared->sblock = NULL; + f->shared->sblock = NULL; #endif /* JRM */ } /* end if */ @@ -1320,10 +1320,11 @@ H5F__super_init(H5F_t *f) /* Create the Shared Object Header Message table and register it with * the metadata cache, if this file supports shared messages. */ - if(f->shared->sohm_nindexes > 0) + 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") + } /* Check for non-default v1 B-tree 'K' values to store */ if(sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF || @@ -1503,9 +1504,10 @@ H5F_eoa_dirty(H5F_t *f) 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) + 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") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1676,13 +1678,13 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, /* Open/create the superblock extension object header */ if(H5F_addr_defined(f->shared->sblock->ext_addr)) { - if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) + 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") } /* end if */ else { HDassert(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") + if(H5F__super_ext_create(f, &ext_loc) < 0) + 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)); @@ -1690,24 +1692,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, /* 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") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "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") - /* 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") + /* 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") } /* end if */ else { if(!status) 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") + /* 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") } /* end else */ done: @@ -1757,35 +1759,36 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id) 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") + 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") 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") - 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") - - /* 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") - - /* 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") - else if((unsigned)null_count == hdr_info.nmesgs) { - HDassert(H5F_addr_defined(ext_loc.addr)); - if(H5O_delete(f, ext_loc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") - f->shared->sblock->ext_addr = HADDR_UNDEF; - } /* end if */ - } /* end if */ + 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") + + /* 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") + + /* 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") + else if((unsigned)null_count == hdr_info.nmesgs) { + HDassert(H5F_addr_defined(ext_loc.addr)); + if(H5O_delete(f, ext_loc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + f->shared->sblock->ext_addr = HADDR_UNDEF; + } /* end else-if */ + } /* end if */ } /* end if */ done: diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 76866db..361f8a1 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -42,7 +42,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ /****************/ diff --git a/src/H5G.c b/src/H5G.c index e54e5cd..361127f 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -128,10 +128,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Group ID class */ static const H5I_class_t H5I_GROUP_CLS[1] = {{ - H5I_GROUP, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */ + H5I_GROUP, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */ }}; /* Flag indicating "top" of interface has been initialized */ @@ -255,9 +255,9 @@ H5G_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Gcreate2 + * Function: H5Gcreate2 * - * Purpose: Creates a new group relative to LOC_ID, giving it the + * Purpose: Creates a new group relative to LOC_ID, giving it the * specified creation property list GCPL_ID and access * property list GAPL_ID. The link to the new group is * created with the LCPL_ID. @@ -269,14 +269,11 @@ H5G_term_package(void) * hid_t gcpl_id; IN: Property list for group creation * hid_t gapl_id; IN: Property list for group access * - * Return: Success: The object ID of a new, empty group open for - * writing. Call H5Gclose() when finished with - * the group. + * Return: Success: The object ID of a new, empty group open for + * writing. Call H5Gclose() when finished with + * the group. * - * Failure: H5I_INVALID_HID - * - * Programmer: Quincey Koziol - * April 5, 2007 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -284,45 +281,49 @@ hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_loc_t loc; /* Location to create group */ - H5G_t *grp = NULL; /* New group created */ - hid_t ret_value; /* Return value */ + H5G_t *grp = NULL; /* Structure for new group */ + H5G_loc_t loc; /* Location to create group */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + 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") - /* Get correct property list */ + /* 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 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 group create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation 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") - /* Create the new group & get its ID */ + /* Create the group */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") @@ -331,9 +332,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gcreate_anon + * Function: H5Gcreate_anon * - * Purpose: Creates a new group relative to LOC_ID, giving it the + * Purpose: Creates a new group relative to LOC_ID, giving it the * specified creation property list GCPL_ID and access * property list GAPL_ID. * @@ -349,36 +350,33 @@ done: * hid_t gcpl_id; IN: Property list for group creation * hid_t gapl_id; IN: Property list for group access * - * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp" + * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp" * hid_t create_id = H5Pcreate(H5P_GROUP_CREATE); * int status = H5Pset_create_intermediate_group(create_id, TRUE); * hid_t gid = H5Gcreate_anon(file_id, "/A/B01/grp", create_id, H5P_DEFAULT); * - * Return: Success: The object ID of a new, empty group open for - * writing. Call H5Gclose() when finished with - * the group. - * - * Failure: H5I_INVALID_HID + * Return: Success: The object ID of a new, empty group open for + * writing. Call H5Gclose() when finished with + * the group. * - * Programmer: Peter Cao - * May 08, 2005 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_loc_t loc; - H5G_t *grp = NULL; - H5G_obj_create_t gcrt_info; /* Information for group creation */ - hid_t ret_value; + H5G_t *grp = NULL; /* Structure for new group */ + H5G_loc_t loc; + H5G_obj_create_t gcrt_info; /* Information for group creation */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") /* Check group creation property list */ if(H5P_DEFAULT == gcpl_id) @@ -396,9 +394,11 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) gcrt_info.cache_type = H5G_NOTHING_CACHED; HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); - /* Create the new group & get its ID */ + /* Create the group */ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group") + + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") @@ -417,7 +417,7 @@ done: } /* end if */ /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") @@ -426,28 +426,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gopen2 + * Function: H5Gopen2 * - * Purpose: Opens an existing group for modification. When finished, - * call H5Gclose() to close it and release resources. + * Purpose: Opens an existing group for modification. When finished, + * call H5Gclose() to close it and release resources. * * This function allows the user the pass in a Group Access * Property List, which H5Gopen1() does not. * - * Return: Success: Object ID of the group. - * Failure: H5I_INVALID_HID + * Return: Success: Object ID of the group * - * Programmer: James Laird - * Thursday, July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { - H5G_t *grp = NULL; /* Group opened */ + H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); @@ -455,8 +453,10 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + 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") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0) @@ -471,7 +471,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") @@ -480,18 +480,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_create_plist - * - * Purpose: Returns a copy of the group creation property list. + * Function: H5Gget_create_plist * - * Return: Success: ID for a copy of the group creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Purpose: Returns a copy of the group creation property list. * - * Failure: H5I_INVALID_HID + * Return: Success: ID for a copy of the group creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Programmer: Quincey Koziol - * Tuesday, October 25, 2005 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -506,9 +503,9 @@ H5Gget_create_plist(hid_t group_id) /* Check args */ if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") - /* Retrieve the GCPL */ + /* Get the group creation property list for the group */ if((ret_value = H5G_get_create_plist(group)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") @@ -518,42 +515,38 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info + * Function: H5Gget_info * - * Purpose: Retrieve information about a group. + * Purpose: Retrieve information about a group. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) +H5Gget_info(hid_t loc_id, H5G_info_t *group_info) { H5I_type_t id_type; /* Type of ID */ H5G_loc_t loc; /* Location of group */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", grp_id, grp_info); + H5TRACE2("e", "i*x", loc_id, group_info); /* Check args */ - id_type = H5I_get_type(grp_id); + id_type = H5I_get_type(loc_id); if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + 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") /* Get group location */ - if(H5G_loc(grp_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the group's information */ - if(H5G__obj_info(loc.oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + if(H5G__obj_info(loc.oloc, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: FUNC_LEAVE_API(ret_value) @@ -561,42 +554,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info_by_name + * Function: H5Gget_info_by_name * - * Purpose: Retrieve information about a group. + * Purpose: Retrieve information about a group, where the group is + * identified by name instead of ID. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, +H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*xi", loc_id, name, grp_info, lapl_id); + H5TRACE4("e", "i*s*xi", loc_id, name, group_info, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(!name) + 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") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info 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_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the group's information */ - if(H5G__get_info_by_name(&loc, name, grp_info/*out*/) < 0) + if(H5G__get_info_by_name(&loc, name, group_info/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -605,48 +597,46 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info_by_idx + * Function: H5Gget_info_by_idx * - * Purpose: Retrieve information about a group, according to the order + * Purpose: Retrieve information about a group, according to the order * of an index. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ 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 *grp_info, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, H5G_info_t *group_info, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, grp_info, + H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, group_info, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!group_name) + 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") 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") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info 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_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the group's information */ - if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, grp_info/*out*/) < 0) + if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, group_info/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -655,15 +645,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gclose - * - * Purpose: Closes the specified group. The group ID will no longer be - * valid for accessing the group. + * Function: H5Gclose * - * Return: Non-negative on success/Negative on failure + * Purpose: Closes the specified group. The group ID will no longer be + * valid for accessing the group. * - * Programmer: Robb Matzke - * Wednesday, December 31, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -679,8 +666,7 @@ H5Gclose(hid_t group_id) if(NULL == H5I_object_verify(group_id,H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* - * Decrement the counter on the group atom. It will be freed if the count + /* Decrement the counter on the group atom. It will be freed if the count * reaches zero. */ if(H5I_dec_app_ref(group_id) < 0) @@ -714,7 +700,7 @@ H5Gflush(hid_t group_id) /* Check args */ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(group_id) < 0) @@ -722,7 +708,7 @@ H5Gflush(hid_t group_id) /* Flush metadata to file */ if(H5O_flush_common(&grp->oloc, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: FUNC_LEAVE_API(ret_value) @@ -752,13 +738,13 @@ H5Grefresh(hid_t group_id) /* Check args */ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + 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") - /* Call private function to refresh group object */ + /* Refresh group's metadata */ if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index aae5496..b32ce39 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -59,19 +59,20 @@ typedef struct { /* Private macros */ /* PRIVATE PROTOTYPES */ -static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata); +static herr_t H5G__compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata); static herr_t H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable); +static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata); /*------------------------------------------------------------------------- - * Function: H5G_compact_build_table_cb + * Function: H5G__compact_build_table_cb * - * Purpose: Callback routine for searching 'link' messages for a particular + * Purpose: Callback routine for searching 'link' messages for a particular * name. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -80,13 +81,13 @@ static herr_t H5G__compact_build_table(const H5O_loc_t *oloc, *------------------------------------------------------------------------- */ static herr_t -H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_bt_t *udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */ herr_t ret_value=H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -102,7 +103,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_build_table_cb() */ +} /* end H5G__compact_build_table_cb() */ /*------------------------------------------------------------------------- @@ -151,7 +152,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, /* Iterate through the link messages, adding them to the table */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_compact_build_table_cb; + 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") @@ -432,12 +433,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_lookup_cb + * Function: H5G__compact_lookup_cb * - * Purpose: Callback routine for searching 'link' messages for a particular + * Purpose: Callback routine for searching 'link' messages for a particular * name & gettting object location for it * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -446,13 +447,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_lkp_t *udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -475,7 +476,7 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_uda done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_lookup_cb() */ +} /* end H5G__compact_lookup_cb() */ /*------------------------------------------------------------------------- @@ -511,7 +512,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk) /* Iterate through the link messages, adding them to the table */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_compact_lookup_cb; + 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") @@ -604,7 +605,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo, /* Check for going out of bounds */ if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound") /* Determine type of object */ if(ltable.lnks[idx].type == H5L_TYPE_SOFT) diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 326561a..d2bcad1 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst /* 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))) @@ -966,8 +966,7 @@ done: */ herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, - H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, - void *op_data) + H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { H5HF_t *fheap = NULL; /* Fractal heap handle */ H5G_link_table_t ltable = {0, NULL}; /* Table of links */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 57bbcd9..f8f668c 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -164,7 +164,7 @@ H5G_map_obj_type(H5O_type_t obj_type) * writing. Call H5Gclose() when finished with * the group. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, September 24, 1997 @@ -176,65 +176,67 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ - hid_t tmp_gcpl = (-1); /* Temporary group creation property list */ - hid_t ret_value; /* Return value */ + hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*sz", loc_id, name, size_hint); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given") /* Check if we need to create a non-standard GCPL */ if(size_hint > 0) { - H5P_genplist_t *gc_plist; /* Property list created */ H5O_ginfo_t ginfo; /* Group info property */ + H5P_genplist_t *gc_plist; /* Property list created */ /* Get the default property list */ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "can't set group info") - } /* end if */ + 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, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info") - /* Create the new group & get its ID */ + /* Create the group */ if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) + 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, FAIL, "unable to release property list") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate1() */ @@ -250,7 +252,7 @@ done: * * Return: Success: Object ID of the group. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, December 31, 1997 @@ -260,31 +262,31 @@ done: hid_t H5Gopen1(hid_t loc_id, const char *name) { - H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of parent for group */ - hid_t ret_value; /* Return value */ + H5G_t *grp = NULL; /* Group opened */ + H5G_loc_t loc; /* Location of parent for group */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Open the group */ if(NULL == (grp = H5G__open_name(&loc, name))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") - /* Register an atom for the group */ + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "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,7 +318,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to create link */ + /* Create link */ if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") @@ -352,7 +354,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to create link */ + /* Create link */ if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") @@ -408,7 +410,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } /* end if */ + } else if(type == H5L_TYPE_SOFT) { /* Soft links only need one location, the new_loc_id, but it's possible * that new_loc_id is H5L_SAME_LOC @@ -423,9 +425,9 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link */ if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } /* end else if */ + } else - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type") done: FUNC_LEAVE_NOAPI(ret_value) @@ -451,9 +453,9 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call common routine to move the link */ + /* Move the link */ if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 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) @@ -471,7 +473,7 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name); @@ -484,9 +486,9 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(H5CX_set_loc(dst_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call common routine to move the link */ + /* Move the link */ if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -565,17 +567,17 @@ H5Gunlink(hid_t loc_id, const char *name) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, 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") - /* Call H5L routine... */ + /* Delete the link */ if(H5L_delete(&loc, name) < 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) @@ -609,9 +611,9 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the link routine which provides this capability */ + /* Get the link value */ if(H5L_get_val(&loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") done: FUNC_LEAVE_API(ret_value) @@ -638,7 +640,7 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5G_loc_t loc; /* Group's location */ + H5G_loc_t loc; /* Group's location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -653,7 +655,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the common routine which provides this capability */ + /* Set the comment */ if(H5G_loc_set_comment(&loc, name, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") @@ -705,7 +707,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the common routine which provides this capability */ + /* Get the comment */ if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") @@ -742,21 +744,24 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { + H5G_loc_t loc; /* Location of object */ H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ + hsize_t idx; /* Internal location to hold index */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, 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_SYM, H5E_BADVALUE, FAIL, "invalid index specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") if(!op) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set number of objects looked at to zero */ last_obj = 0; @@ -766,8 +771,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; - /* Call the common routine which provides this capability */ - if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) + /* Call private function */ + if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ @@ -798,23 +803,23 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ - H5G_info_t grp_info; /* Group information */ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; + H5G_loc_t loc; /* Location of object */ + H5G_info_t grp_info; /* Group information */ + H5O_type_t obj_type; /* Type of object at location */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") if(!num_objs) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") /* Retrieve information about the group */ if(H5G__obj_info(loc.oloc, &grp_info) < 0) @@ -849,17 +854,17 @@ herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group's location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Get info */ if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) @@ -1054,13 +1059,13 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* Call common routine */ + /* Call internal function */ if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") @@ -1087,8 +1092,8 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5G_loc_t loc; /* Object location */ - H5G_obj_t ret_value; + H5G_loc_t loc; /* Object location */ + H5G_obj_t ret_value; FUNC_ENTER_API(H5G_UNKNOWN) H5TRACE2("Go", "ih", loc_id, idx); diff --git a/src/H5Gint.c b/src/H5Gint.c index 51d3b91..7e2f279 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -449,38 +449,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__close_cb - * - * Purpose: Closes the specified group. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Sunday, February 18, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__close_cb(H5G_t *grp) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->fo_count > 0); - - /* Call actual group close routine */ - if(H5G_close(grp) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__close_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5G_close * * Purpose: Closes the specified group. @@ -817,30 +785,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_iterate(hid_t loc_id, const char *group_name, +H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data) { - H5G_loc_t loc; /* Location of parent for group */ - hid_t gid = -1; /* ID of group to iterate over */ - H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ - H5G_iter_appcall_ud_t udata; /* User data for callback */ - herr_t ret_value = FAIL; /* Return value */ + hid_t gid = H5I_INVALID_HID; /* ID of group to iterate over */ + H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ + H5G_iter_appcall_ud_t udata; /* User data for callback */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ + HDassert(loc); HDassert(group_name); HDassert(last_lnk); HDassert(lnk_op && lnk_op->op_func.op_new); - /* - * Open the group on which to operate. We also create a group ID which + /* Open the group on which to operate. We also create a group ID which * we can pass to the application-defined operator. */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(NULL == (grp = H5G__open_name(&loc, group_name))) + if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -856,7 +821,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, done: /* Release the group opened */ - if(gid > 0) { + if(gid != H5I_INVALID_HID) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") } @@ -1078,15 +1043,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, +H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { H5G_iter_visit_ud_t udata; /* User data for callback */ H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - hid_t gid = (-1); /* Group ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of group passed in */ H5G_loc_t start_loc; /* Location of starting group */ unsigned rc; /* Reference count of object */ herr_t ret_value = FAIL; /* Return value */ @@ -1097,11 +1061,11 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, FUNC_ENTER_NOAPI(FAIL) /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!loc) + 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))) + if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the starting group */ @@ -1184,7 +1148,7 @@ done: H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL); /* Release the group opened */ - if(gid > 0) { + if(gid != H5I_INVALID_HID) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") } @@ -1254,7 +1218,7 @@ H5G_get_create_plist(const H5G_t *grp) /* 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) diff --git a/src/H5Gname.c b/src/H5Gname.c index 8aa0b45..31ed0f1 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -1311,7 +1311,7 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, udata.path = NULL; /* Visit all the links in the file */ - if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) + 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, (-1), "group traversal failed while looking for object name") else if(status > 0) found_obj = TRUE; diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index ae697ad..836213d 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -336,7 +336,6 @@ H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info); -H5_DLL herr_t H5G__close_cb(H5G_t *grp); /* * Group hierarchy traversal routines diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 95dfef5..c56b1c8 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -209,10 +209,10 @@ H5_DLL char *H5G_normalize(const char *name); */ H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traverse_t op, void *op_data); -H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data); -H5_DLL herr_t H5G_visit(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data); /* @@ -262,7 +262,7 @@ H5_DLL herr_t H5G_name_free(H5G_name_t *name); H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, hbool_t *cached); H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc, - char* name, size_t size); + char* name, size_t size); H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); /* diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 37b6292..e412e7c 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -32,18 +32,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Ppublic.h" /* Property Lists */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppublic.h" /* Property Lists */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -324,7 +323,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, /* 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; @@ -359,8 +358,7 @@ done: */ herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, - unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, - hbool_t *obj_exists) + unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists) { size_t nlinks; /* # of soft / UD links left to traverse */ herr_t ret_value = SUCCEED; /* Return value */ @@ -372,13 +370,13 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, HDassert(lnk); HDassert(obj_loc); - /* - * If we found a symbolic link then we should follow it. But if this + /* 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 * TARGET is set then we don't follow it. */ if(H5L_TYPE_SOFT == lnk->type && (0 == (target & H5G_TARGET_SLINK) || !last_comp)) { + /* 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") @@ -403,6 +401,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, */ if(lnk->type >= H5L_TYPE_UD_MIN && (0 == (target & H5G_TARGET_UDLINK) || !last_comp) ) { + /* 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") @@ -830,20 +829,21 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver if(!op) 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 - * like they've traversed too many. Nested calls, like in H5L__move(), + /* Retrieve the original # of soft / UD links that are able to be traversed + * (So that multiple calls to H5G_traverse don't incorrectly look + * like they've traversed too many. Nested calls, like in H5L_move(), * 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") /* 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 - is given an improper tag, unless another one is specifically set up - first. This will ensure we're not accidentally tagging something we - shouldn't be during the traversal. Note that for best tagging assertion - coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */ + * tag here will ensure that no metadata accessed while doing the traversal + * is given an improper tag, unless another one is specifically set up + * first. This will ensure we're not accidentally tagging something we + * 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); /* Go perform "real" traversal */ diff --git a/src/H5L.c b/src/H5L.c index 6967812..b659d42 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -21,18 +21,18 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lpkg.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* File objects */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* File objects */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -63,7 +63,7 @@ typedef struct { typedef struct { const char *dst_name; /* Destination name for moving object */ H5T_cset_t cset; /* Char set for new name */ - const H5G_loc_t *dst_loc; /* Destination location for moving object */ + const H5G_loc_t *dst_loc; /* Destination location for moving object */ unsigned dst_target_flags; /* Target flags for destination object */ hbool_t copy; /* TRUE if this is a copy operation */ size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */ @@ -109,17 +109,12 @@ static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - void *buf/*out*/, size_t size); static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -132,25 +127,15 @@ static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L__exists(const H5G_loc_t *loc, const char *name); static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linfo /*out*/); static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - char *name /*out*/, size_t size); -static herr_t H5L__iterate(hid_t grp_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data); /*********************/ /* Package Variables */ @@ -267,16 +252,16 @@ H5L_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Lmove + * Function: H5Lmove * - * Purpose: Renames an object within an HDF5 file and moves it to a new + * Purpose: Renames an object within an HDF5 file and moves it to a new * group. The original name SRC is unlinked from the group graph * and then inserted with the new name DST (which can specify a * new path for the object) as an atomic operation. The names - * are interpreted relative to SRC_LOC_ID and - * DST_LOC_ID, which are either file IDs or group ID. + * are interpreted relative to SRC_LOC_ID and DST_LOC_ID, + * which are either file IDs or group ID. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Wednesday, March 29, 2006 @@ -289,7 +274,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, @@ -332,13 +317,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcopy + * Function: H5Lcopy * - * Purpose: Creates an identical copy of a link with the same creation + * Purpose: Creates an identical copy of a link with the same creation * time and target. The new link can have a different name * and be in a different location than the original. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Wednesday, March 29, 2006 @@ -351,7 +336,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, @@ -386,7 +371,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: FUNC_LEAVE_API(ret_value) @@ -394,17 +379,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_soft + * Function: H5Lcreate_soft * - * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET. + * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET. * - * LINK_TARGET can be anything and is interpreted at lookup + * LINK_TARGET can be anything and is interpreted at lookup * time relative to the group which contains the final component * of LINK_NAME. For instance, if LINK_TARGET is `./foo' and * LINK_NAME is `./x/y/bar' and a request is made for `./x/y/bar' * then the actual object looked up is `./x/y/./foo'. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -416,7 +401,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location for new link */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id); @@ -424,10 +409,14 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, /* Check arguments */ if(H5G_loc(link_loc_id, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!link_target || !*link_target) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified") - if(!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + if(!link_target) + 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") + if(!link_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be NULL") + if(!*link_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_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") @@ -437,7 +426,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, /* Create the link */ if(H5L_create_soft(link_target, &link_loc, link_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 soft link") done: FUNC_LEAVE_API(ret_value) @@ -445,15 +434,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_hard + * Function: H5Lcreate_hard * - * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. + * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. * - * CUR_NAME must name an existing object. CUR_NAME and + * CUR_NAME must name an existing object. CUR_NAME and * NEW_NAME are interpreted relative to CUR_LOC_ID and * NEW_LOC_ID, which are either file IDs or group IDs. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -466,7 +455,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, { H5G_loc_t cur_loc, *cur_loc_p; H5G_loc_t new_loc, *new_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, @@ -476,13 +465,17 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!cur_name || !*cur_name) - 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") + if(!cur_name) + 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") + if(!new_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL") + if(!*new_name) + 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") @@ -496,13 +489,13 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(cur_loc_id == H5L_SAME_LOC) cur_loc_p = new_loc_p; else if(new_loc_id == H5L_SAME_LOC) - new_loc_p = cur_loc_p; + new_loc_p = cur_loc_p; else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_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 hard link") done: FUNC_LEAVE_API(ret_value) @@ -510,23 +503,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_ud + * Function: H5Lcreate_ud * - * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME + * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME * with user-specified data UDATA. * - * The format of the information pointed to by UDATA is + * The format of the information pointed to by UDATA is * defined by the user. UDATA_SIZE holds the size of this buffer. * - * LINK_NAME is interpreted relative to LINK_LOC_ID. + * LINK_NAME is interpreted relative to LINK_LOC_ID. * - * The property list specified by LCPL_ID holds properties used + * The property list specified by LCPL_ID holds properties used * to create the link. * * The link class of the new link must already be registered * with the library. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Tuesday, December 13, 2005 @@ -538,7 +531,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, @@ -548,7 +541,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(H5G_loc(link_loc_id, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") 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") @@ -558,7 +551,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, /* Create external link */ if(H5L__create_ud(&link_loc, link_name, udata, udata_size, link_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") done: FUNC_LEAVE_API(ret_value) @@ -566,16 +559,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ldelete + * Function: H5Ldelete * - * Purpose: Removes the specified NAME from the group graph and - * decrements the link count for the object to which NAME - * points. If the link count reaches zero then all file-space - * associated with the object will be reclaimed (but if the - * object is open, then the reclamation of the file space is - * delayed until all handles to the object are closed). + * Purpose: Removes the specified NAME from the group graph and + * decrements the link count for the object to which NAME + * points. If the link count reaches zero then all file-space + * associated with the object will be reclaimed (but if the + * object is open, then the reclamation of the file space is + * delayed until all handles to the object are closed). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -593,9 +586,9 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) /* Check arguments */ 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") 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) @@ -641,20 +634,20 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Check arguments */ 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") 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, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Delete the link */ - if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0) + if(H5L_delete_by_idx(&loc, group_name, idx_type, order, n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -695,7 +688,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, if(H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") 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) @@ -742,21 +735,21 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") 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") /* Get the link value */ - if(H5L__get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for") + if(H5L_get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") done: FUNC_LEAVE_API(ret_value) @@ -764,12 +757,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lexists + * Function: H5Lexists * - * Purpose: Checks if a link of a given name exists in a group + * Purpose: Checks if a link of a given name exists in a group * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: Success: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Friday, March 16, 2007 @@ -780,7 +772,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); @@ -788,15 +780,17 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) /* Check arguments */ if(H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!name) + 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") /* 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") /* Check for the existence of the link */ - if((ret_value = H5L__exists(&loc, name)) < 0) + if((ret_value = H5L_exists(&loc, name)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -830,9 +824,9 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") 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) @@ -875,20 +869,20 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") 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") /* Get the link information */ - if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) + if(H5L_get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -976,11 +970,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) @@ -988,14 +982,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lis_registered + * Function: H5Lis_registered * - * Purpose: Tests whether a user-defined link class has been registered + * Purpose: Tests whether a user-defined link class has been registered * or not. * - * Return: Positive if the link class has been registered - * Zero if it is unregistered - * Negative on error (if the class is not a valid UD class ID) + * Return: TRUE if the link class has been registered + * 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 @@ -1017,7 +1011,7 @@ H5Lis_registered(H5L_type_t id) /* Is the link class already registered? */ for(i = 0; i < H5L_table_used_g; i++) - if(H5L_table_g[i].id == id) { + if(H5L_table_g[i].id == id) { ret_value = TRUE; break; } /* end if */ @@ -1028,16 +1022,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lget_name_by_idx + * Function: H5Lget_name_by_idx * - * Purpose: Gets name for a link, according to the order within an + * Purpose: Gets name for a link, according to the order within an * index. * * Same pattern of behavior as H5Iget_name. * - * Return: Success: Non-negative length of name, with information - * in NAME buffer - * Failure: Negative + * Return: Success: Non-negative length of name, with information + * in NAME buffer + * + * Failure: -1 * * Programmer: Quincey Koziol * Saturday, November 11, 2006 @@ -1050,29 +1045,29 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, char *name /*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, lapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info") /* Get the link information */ - if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") + if((ret_value = H5L_get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") done: FUNC_LEAVE_API(ret_value) @@ -1098,17 +1093,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, +H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + H5I_type_t id_type; /* Type of ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data); + H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data); /* Check arguments */ - id_type = H5I_get_type(grp_id); + if(H5G_loc(group_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + 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") if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -1119,7 +1117,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Iterate over the links */ - if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1128,20 +1126,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Literate_by_name + * Function: H5Literate_by_name * - * Purpose: Iterates over links in a group, with user callback routine, + * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. * * Same pattern of behavior as H5Giterate. * - * 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. + * 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. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * * Programmer: Quincey Koziol @@ -1154,28 +1152,33 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id); /* Check arguments */ - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!group_name) + 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") 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") /* Iterate over the links */ - if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5L_iterate(&loc, group_name, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1184,9 +1187,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit + * Function: H5Lvisit * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1198,13 +1201,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * 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. + * 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. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -1212,28 +1215,31 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, +H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + H5I_type_t id_type; /* Type of ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "iIiIox*x", grp_id, idx_type, order, op, op_data); + H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data); /* Check args */ - id_type = H5I_get_type(grp_id); + if(H5G_loc(group_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + 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") 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") - /* Call internal routine */ - if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0) + /* Iterate over the links */ + if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1242,9 +1248,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit_by_name + * Function: H5Lvisit_by_name * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1256,13 +1262,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * 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. + * 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. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 3 2007 @@ -1273,19 +1279,24 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id); /* Check args */ - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!group_name) + 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") 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") @@ -1293,8 +1304,8 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, 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") - /* Call internal routine */ - if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) + /* Visit the links */ + if((ret_value = H5G_visit(&loc, group_name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1487,8 +1498,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, - hid_t lcpl_id) +H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id) { H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1880,11 +1890,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_create_soft + * Function: H5L_create_soft * - * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. + * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -2175,27 +2185,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_val_by_idx + * Function: H5L_get_val_by_idx * * Purpose: Internal routine to query a link value according to the - * index within a group + * index within a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 27, 2017 * *------------------------------------------------------------------------- */ -static herr_t -H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size) { H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -2214,7 +2223,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_val_by_idx() */ +} /* end H5L_get_val_by_idx() */ /*------------------------------------------------------------------------- @@ -2255,7 +2264,7 @@ H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk /* 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 * @@ -2347,29 +2356,28 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__delete_by_idx + * Function: H5L_delete_by_idx * * Purpose: Internal routine to delete a link according to its index - * within a group. + * within a group. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 27, 2017 * *------------------------------------------------------------------------- */ -static herr_t -H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) - /* Check arguments */ + /* Sanity check */ HDassert(loc); HDassert(name && *name); @@ -2384,7 +2392,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__delete_by_idx() */ +} /* end H5L_delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2558,7 +2566,7 @@ H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, /* 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) { @@ -2686,7 +2694,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo /* 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) @@ -2854,7 +2862,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__exists + * Function: H5L_exists * * Purpose: Returns whether a link exists in a group * @@ -2869,12 +2877,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5L__exists(const H5G_loc_t *loc, const char *name) +H5L_exists(const H5G_loc_t *loc, const char *name) { H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -2890,7 +2898,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L__exists() */ +} /* H5L_exists() */ /*------------------------------------------------------------------------- @@ -3015,27 +3023,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_info_by_idx + * Function: H5L_get_info_by_idx * * Purpose: Internal routine to retrieve link info according to an * index's order. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t -H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -3054,7 +3058,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_info_by_idx() */ +} /* end H5L_get_info_by_idx() */ /*------------------------------------------------------------------------- @@ -3098,28 +3102,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_name_by_idx + * Function: H5L_get_name_by_idx * * Purpose: Internal routine to retrieve link name according to an * index's order. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static ssize_t -H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, +ssize_t +H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size) { H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -3142,56 +3142,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_name_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5L__iterate - * - * Purpose: Internal routine to iterate over links - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) -{ - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check arguments */ - HDassert(group_name); - HDassert(op); - - /* Set up iteration beginning/end info */ - idx = (idx_p == NULL ? 0 : *idx_p); - last_lnk = 0; - - /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_NEW; - lnk_op.op_func.op_new = op; - - /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") - - /* Set the index we stopped at */ - if(idx_p) - *idx_p = last_lnk; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__iterate() */ +} /* end H5L_get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -3324,3 +3275,49 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__link_copy_file() */ + +/*------------------------------------------------------------------------- + * Function: H5L_iterate + * + * Purpose: Iterates through links in a group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) +{ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity checks */ + HDassert(loc); + HDassert(group_name); + HDassert(op); + + /* Set up iteration beginning/end info */ + idx = (idx_p == NULL ? 0 : *idx_p); + last_lnk = 0; + + /* Build link operator info */ + lnk_op.op_type = H5G_LINK_OP_NEW; + lnk_op.op_func.op_new = op; + + /* 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") + + /* Set the index we stopped at */ + if(idx_p) + *idx_p = last_lnk; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_iterate() */ + diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 3bbb6b6..fa3c097 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -122,12 +122,27 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id); H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name); +H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linkbuf/*out*/); H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name); +H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info_t *linfo /*out*/); +H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + char *name /*out*/, size_t size); H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size); +H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + void *buf/*out*/, size_t size); H5_DLL herr_t H5L_register_external(void); +H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate_t op, void *op_data); /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); diff --git a/src/H5O.c b/src/H5O.c index 25c3d83..b33e6e2 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -75,9 +75,9 @@ /*------------------------------------------------------------------------- - * Function: H5Oopen + * Function: H5Oopen * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object within an HDF5 file. * * This function opens an object in the same way that H5Gopen2, * H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require @@ -88,8 +88,9 @@ * The opened object should be closed again with H5Oclose * or H5Gclose, H5Tclose, or H5Dclose. * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: An open object identifier + * + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 14 2006 @@ -100,16 +101,18 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + 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") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) @@ -117,7 +120,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) /* Open the object */ if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -140,7 +143,7 @@ done: * or H5Gclose, H5Tclose, or H5Dclose. * * Return: Success: An open object identifier - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * November 20 2006 @@ -152,28 +155,28 @@ H5Oopen_by_idx(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) { H5G_loc_t loc; /* Location of group */ - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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, H5I_INVALID_HID, "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_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the object */ - if((ret_value = H5O__open_by_idx(&loc, group_name, idx_type, order, n)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + if((ret_value = H5O_open_by_idx(&loc, group_name, idx_type, order, n)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -208,7 +211,7 @@ done: * map this to an address on disk for the filesystem. * * Return: Success: An open object identifier - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 14 2006 @@ -221,7 +224,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) H5G_loc_t loc; /* Location within file */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "ia", loc_id, addr); /* Check args */ @@ -231,8 +234,8 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied") /* Open the object */ - if((ret_value = H5O__open_by_addr(&loc, addr)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + if((ret_value = H5O_open_by_addr(&loc, addr)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -332,13 +335,13 @@ H5Oincr_refcount(hid_t object_id) /* Get the object's oloc so we can adjust its link count */ if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID") /* 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") - /* Change the object's refcount */ + /* Change the object's reference count */ if(H5O_link(oloc, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -378,13 +381,13 @@ H5Odecr_refcount(hid_t object_id) /* Get the object's oloc so we can adjust its link count */ if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID") /* 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") - /* Change the object's refcount */ + /* Change the object's reference count */ if(H5O_link(oloc, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -394,12 +397,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oexists_by_name + * Function: H5Oexists_by_name * - * Purpose: Determine if a linked-to object exists + * Purpose: Determine if a linked-to object exists * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: Success: TRUE/FALSE + * Failure: FAIL * * Programmer: Quincey Koziol * February 2 2010 @@ -418,8 +421,10 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + 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") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) @@ -441,8 +446,7 @@ done: * * NOTE: Add a parameter "fields" to indicate selection of object info. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * July 7 2010 @@ -462,12 +466,12 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + 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") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, ".", oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -475,21 +479,20 @@ done: } /* end H5Oget_info2() */ - /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_name2 - * - * Purpose: Retrieve information about an object. - * - * NOTE: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * July 7 2010 - * - *------------------------------------------------------------------------- - */ +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_name2 + * + * Purpose: Retrieve information about an object + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: SUCCEED/FAIL + * + * Programmer: Neil Fortner + * July 7 2010 + * + *------------------------------------------------------------------------- + */ herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) @@ -503,10 +506,12 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + 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") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + 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") @@ -578,16 +583,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oset_comment + * Function: H5Oset_comment * * Purpose: Gives the specified object a comment. The COMMENT string - * should be a null terminated string. An object can have only - * one comment at a time. Passing NULL for the COMMENT argument - * will remove the comment property from the object. + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. * - * Note: Deprecated in favor of using attributes on objects + * Note: Deprecated in favor of using attributes on objects * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * August 30 2007 @@ -605,7 +610,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) /* Check args */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) @@ -621,16 +626,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oset_comment_by_name + * Function: H5Oset_comment_by_name * * Purpose: Gives the specified object a comment. The COMMENT string - * should be a null terminated string. An object can have only - * one comment at a time. Passing NULL for the COMMENT argument - * will remove the comment property from the object. + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. * - * Note: Deprecated in favor of using attributes on objects + * Note: Deprecated in favor of using attributes on objects * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * August 30 2007 @@ -667,15 +672,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_comment + * Function: H5Oget_comment * - * Purpose: Retrieve comment for an object. + * Purpose: Retrieve comment for an object. * - * Return: Success: Number of bytes in the comment excluding the - * null terminator. Zero if the object has no - * comment. + * Return: Success: Number of bytes in the comment excluding the + * null terminator. Zero if the object has no + * comment. * - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * August 30 2007 @@ -686,18 +691,18 @@ ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); /* Check args */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: FUNC_LEAVE_API(ret_value) @@ -705,15 +710,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_comment_by_name + * Function: H5Oget_comment_by_name * - * Purpose: Retrieve comment for an object. + * Purpose: Retrieve comment for an object. * - * Return: Success: Number of bytes in the comment excluding the - * null terminator. Zero if the object has no - * comment. + * Return: Success: Number of bytes in the comment excluding the + * null terminator. Zero if the object has no + * comment. * - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * August 30 2007 @@ -725,24 +730,24 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "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, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: FUNC_LEAVE_API(ret_value) @@ -750,9 +755,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit2 + * Function: H5Ovisit2 * - * Purpose: Recursively visit an object and all the objects reachable + * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects * linked to from that group will be visited. Links within * each group are visited according to the order within the @@ -772,12 +777,12 @@ done: * object info to be retrieved to the callback "op". * * 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. + * 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. + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 25 2007 @@ -788,12 +793,15 @@ herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); /* Check args */ + if(H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -803,9 +811,9 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -813,7 +821,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit_by_name2 + * Function: H5Ovisit_by_name2 * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -835,12 +843,12 @@ done: * object info to be retrieved to the callback "op". * * 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. + * 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. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -851,15 +859,20 @@ herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id); /* Check args */ - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!obj_name) + 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") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -873,9 +886,9 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, 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") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -883,17 +896,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oclose + * Function: H5Oclose * - * Purpose: Close an open file object. + * Purpose: Close an open file object. * * This is the companion to H5Oopen. It is used to close any * open object in an HDF5 file (but not IDs are that not file * objects, such as property lists and dataspaces). It has * the same effect as calling H5Gclose, H5Dclose, or H5Tclose. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: James Laird * July 14 2006 diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 570e16d..23dd928 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -57,9 +57,9 @@ /* Local Prototypes */ /********************/ -static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, +static herr_t H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size); -static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, +static herr_t H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size); static herr_t H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new_type, void *new_native, size_t new_size); @@ -70,10 +70,10 @@ static herr_t H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size static herr_t H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t *new_idx); static herr_t H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx); -static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u); -static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh); -static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh); -static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh); +static htri_t H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u); +static htri_t H5O__move_msgs_forward(H5F_t *f, H5O_t *oh); +static htri_t H5O__merge_null(H5F_t *f, H5O_t *oh); +static htri_t H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh); static herr_t H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno); @@ -97,7 +97,7 @@ H5FL_EXTERN(H5O_cont_t); /*------------------------------------------------------------------------- - * Function: H5O_add_gap + * Function: H5O__add_gap * * Purpose: Add a gap to a chunk * @@ -110,14 +110,14 @@ H5FL_EXTERN(H5O_cont_t); *------------------------------------------------------------------------- */ static herr_t -H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, +H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size) { hbool_t merged_with_null; /* Whether the gap was merged with a null message */ size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -150,7 +150,7 @@ if(chunkno > 0) { HDassert(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) + 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") /* Set flag to indicate that the gap was handled */ @@ -178,7 +178,7 @@ if(chunkno > 0) { /* 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) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Increment new gap size */ @@ -212,11 +212,11 @@ if(chunkno > 0) { done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_add_gap() */ +} /* H5O__add_gap() */ /*------------------------------------------------------------------------- - * Function: H5O_eliminate_gap + * Function: H5O__eliminate_gap * * Purpose: Eliminate a gap in a chunk with a null message. * @@ -236,13 +236,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, +H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *gap_loc, size_t gap_size) { uint8_t *move_start, *move_end; /* Pointers to area of messages to move */ hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(oh); @@ -319,7 +319,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, *chk_dirtied = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5O_eliminate_gap() */ +} /* H5O__eliminate_gap() */ /*------------------------------------------------------------------------- @@ -369,7 +369,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, alloc_msg->raw_size = new_size; /* 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) + 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") } /* end if */ else { @@ -378,7 +378,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, /* 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) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) 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 */ @@ -402,7 +402,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */ /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &chk_dirtied, null_msg, + if(H5O__eliminate_gap(oh, &chk_dirtied, null_msg, ((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") @@ -432,7 +432,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5O_alloc_msgs + * Function: H5O__alloc_msgs * * Purpose: Allocate more messages for a header * @@ -445,14 +445,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_alloc_msgs(H5O_t *oh, size_t min_alloc) +H5O__alloc_msgs(H5O_t *oh, size_t min_alloc) { size_t old_alloc; /* Old number of messages allocated */ size_t na; /* New number of messages allocated */ H5O_mesg_t *new_mesg; /* Pointer to new message array */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh); @@ -474,7 +474,7 @@ H5O_alloc_msgs(H5O_t *oh, size_t min_alloc) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_alloc_msgs() */ +} /* H5O__alloc_msgs() */ /*------------------------------------------------------------------------- @@ -590,7 +590,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t 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)); @@ -618,7 +618,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, else { /* Create a new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Set extension message */ @@ -690,7 +690,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, } /* end for */ /* Resize the chunk in the cache */ - if(H5O_chunk_resize(oh, chk_proxy) < 0) + if(H5O__chunk_resize(oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") /* Set new message index */ @@ -958,7 +958,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, * that could be generated below. */ if(oh->nmesgs + 3 > oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)3) < 0) + if(H5O__alloc_msgs(oh, (size_t)3) < 0) 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 */ @@ -1361,7 +1361,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5O_release_mesg + * Function: H5O__release_mesg * * Purpose: Convert a message into a null message * @@ -1374,13 +1374,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) +H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -1395,7 +1395,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) /* 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); @@ -1415,7 +1415,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) /* Check if chunk has a gap currently */ if(oh->chunk[mesg->chunkno].gap) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &chk_dirtied, mesg, + if(H5O__eliminate_gap(oh, &chk_dirtied, mesg, ((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") @@ -1427,11 +1427,11 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_release_mesg() */ +} /* H5O__release_mesg() */ /*------------------------------------------------------------------------- - * Function: H5O_move_cont + * Function: H5O__move_cont * * Purpose: Check and move message(s) forward into a continuation message * @@ -1444,7 +1444,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) +H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that continuation message is in */ H5O_mesg_t *cont_msg; /* Pointer to the continuation message */ @@ -1452,7 +1452,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(f); @@ -1500,7 +1500,7 @@ 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) + if(H5O__release_mesg(f, oh, cont_msg, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") /* Protect chunk */ @@ -1549,7 +1549,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Check if there is space that should be a gap */ 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) + 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") } /* end if */ @@ -1594,12 +1594,12 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_move_cont() */ +} /* H5O__move_cont() */ /*------------------------------------------------------------------------- * - * Function: H5O_move_msgs_forward + * Function: H5O__move_msgs_forward * * Purpose: Move messages toward first chunk * @@ -1612,7 +1612,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) +H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) { H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */ H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */ @@ -1623,7 +1623,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) hbool_t did_packing = FALSE; /* Whether any messages were packed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1706,7 +1706,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) if(H5O_CONT_ID == curr_msg->type->id) { htri_t status; /* Status from moving messages */ - if((status = H5O_move_cont(f, oh, u)) < 0) + if((status = H5O__move_cont(f, oh, u)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message") else if(status > 0) { /* Message(s) got moved into "continuation" message */ packed_msg = TRUE; @@ -1818,7 +1818,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Check for gap in null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &null_chk_dirtied, null_msg, + if(H5O__eliminate_gap(oh, &null_chk_dirtied, null_msg, ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (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") @@ -1845,7 +1845,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) null_chk_dirtied = TRUE; /* 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) + 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") /* Re-use message # for new null message taking place of non-null message */ @@ -1862,7 +1862,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Create new null message for previous location of non-null message */ if(oh->nmesgs >= oh->alloc_nmesgs) { - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */ @@ -1893,7 +1893,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Check for gap in new null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg], + if(H5O__eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg], ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (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") @@ -1945,12 +1945,12 @@ done: HDassert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy); FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_move_msgs_forward() */ +} /* H5O__move_msgs_forward() */ /*------------------------------------------------------------------------- * - * Function: H5O_merge_null + * Function: H5O__merge_null * * Purpose: Merge neighboring null messages in an object header * @@ -1963,13 +1963,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_merge_null(H5F_t *f, H5O_t *oh) +H5O__merge_null(H5F_t *f, H5O_t *oh) { hbool_t merged_msg; /* Flag to indicate that messages were merged */ hbool_t did_merging = FALSE; /* Whether any messages were merged */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh != NULL); @@ -2051,7 +2051,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) oh->nmesgs--; /* The merge null message might span the entire chunk: scan for empty chunk to remove */ - if((result = H5O_remove_empty_chunks(f, oh)) < 0) + if((result = H5O__remove_empty_chunks(f, oh)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") else if(result > 0) /* Get out of loop */ @@ -2084,12 +2084,12 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_merge_null() */ +} /* H5O__merge_null() */ /*------------------------------------------------------------------------- * - * Function: H5O_remove_empty_chunks + * Function: H5O__remove_empty_chunks * * Purpose: Attempt to eliminate empty chunks from object header. * @@ -2106,13 +2106,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) +H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) { hbool_t deleted_chunk; /* Whether to a chunk was deleted */ hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh != NULL); @@ -2173,7 +2173,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) deleted_chunkno = null_msg->chunkno; /* Convert continuation message into a null message */ - if(H5O_release_mesg(f, oh, cont_msg, TRUE) < 0) + if(H5O__release_mesg(f, oh, cont_msg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") /* @@ -2273,12 +2273,12 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_remove_empty_chunks() */ +} /* H5O__remove_empty_chunks() */ /*------------------------------------------------------------------------- * - * Function: H5O_condense_header + * Function: H5O__condense_header * * Purpose: Attempt to eliminate empty chunks from object header. * @@ -2291,13 +2291,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_condense_header(H5F_t *f, H5O_t *oh) +H5O__condense_header(H5F_t *f, H5O_t *oh) { hbool_t rescan_header; /* Whether to rescan header */ htri_t result; /* Result from packing/merging/etc */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh != NULL); @@ -2308,33 +2308,33 @@ H5O_condense_header(H5F_t *f, H5O_t *oh) rescan_header = FALSE; /* Scan for messages that can be moved earlier in chunks */ - result = H5O_move_msgs_forward(f, oh); + result = H5O__move_msgs_forward(f, oh); if(result < 0) 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); + result = H5O__merge_null(f, oh); if(result < 0) 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); + result = H5O__remove_empty_chunks(f, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") if(result > 0) rescan_header = TRUE; } while(rescan_header); #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_condense_header() */ +} /* H5O__condense_header() */ /*------------------------------------------------------------------------- @@ -2523,7 +2523,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) HDassert(new_size <= old_size); /* Resize the chunk in the cache */ - if(H5O_chunk_resize(oh, chk_proxy) < 0) + if(H5O__chunk_resize(oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") /* Free the unused space in the file */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index a62a3a3..c93bf32 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -44,48 +44,48 @@ static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_ATTR -#define H5O_SHARED_DECODE H5O_attr_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_attr_decode -#define H5O_SHARED_ENCODE H5O_attr_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_attr_encode -#define H5O_SHARED_SIZE H5O_attr_shared_size -#define H5O_SHARED_SIZE_REAL H5O_attr_size -#define H5O_SHARED_DELETE H5O__attr_shared_delete -#define H5O_SHARED_DELETE_REAL H5O__attr_delete -#define H5O_SHARED_LINK H5O__attr_shared_link -#define H5O_SHARED_LINK_REAL H5O__attr_link -#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file -#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file -#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file -#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file +#define H5O_SHARED_TYPE H5O_MSG_ATTR +#define H5O_SHARED_DECODE H5O_attr_shared_decode +#define H5O_SHARED_DECODE_REAL H5O_attr_decode +#define H5O_SHARED_ENCODE H5O_attr_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O_attr_encode +#define H5O_SHARED_SIZE H5O_attr_shared_size +#define H5O_SHARED_SIZE_REAL H5O_attr_size +#define H5O_SHARED_DELETE H5O__attr_shared_delete +#define H5O_SHARED_DELETE_REAL H5O__attr_delete +#define H5O_SHARED_LINK H5O__attr_shared_link +#define H5O_SHARED_LINK_REAL H5O__attr_link +#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file +#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_attr_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__attr_debug +#define H5O_SHARED_DEBUG H5O_attr_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__attr_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_ATTR[1] = {{ - H5O_ATTR_ID, /* message id number */ - "attribute", /* message name for debugging */ - sizeof(H5A_t), /* native message size */ - H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ - H5O_attr_shared_decode, /* decode message */ - H5O_attr_shared_encode, /* encode message */ - H5O_attr_copy, /* copy the native value */ - H5O_attr_shared_size, /* size of raw message */ - H5O__attr_reset, /* reset method */ - H5O__attr_free, /* free method */ - H5O__attr_shared_delete, /* file delete method */ - H5O__attr_shared_link, /* link method */ - NULL, /*set share method */ - NULL, /*can share method */ - H5O_attr_pre_copy_file, /* pre copy native value to file */ - H5O__attr_shared_copy_file, /* copy native value to file */ - H5O_attr_shared_post_copy_file, /* post copy native value to file */ - H5O_attr_get_crt_index, /* get creation index */ - H5O_attr_set_crt_index, /* set creation index */ - H5O_attr_shared_debug /* debug the message */ + H5O_ATTR_ID, /* message id number */ + "attribute", /* message name for debugging */ + sizeof(H5A_t), /* native message size */ + H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ + H5O_attr_shared_decode, /* decode message */ + H5O_attr_shared_encode, /* encode message */ + H5O_attr_copy, /* copy the native value */ + H5O_attr_shared_size, /* size of raw message */ + H5O__attr_reset, /* reset method */ + H5O__attr_free, /* free method */ + H5O__attr_shared_delete, /* file delete method */ + H5O__attr_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + H5O_attr_pre_copy_file, /* pre copy native value to file */ + H5O__attr_shared_copy_file, /* copy native value to file */ + H5O_attr_shared_post_copy_file, /* post copy native value to file */ + H5O_attr_get_crt_index, /* get creation index */ + H5O_attr_set_crt_index, /* set creation index */ + H5O_attr_shared_debug /* debug the message */ }}; /* Flags for attribute flag encoding */ @@ -474,7 +474,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) * Purpose: Frees resources within a attribute message, but doesn't free * the message itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Tuesday, December 9, 1997 @@ -491,11 +491,11 @@ H5O__attr_reset(void H5_ATTR_UNUSED *_mesg) /*------------------------------------------------------------------------- - * Function: H5O__attr_free + * Function: H5O__attr_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, November 18, 2004 @@ -525,7 +525,7 @@ done: * * Purpose: Free file space referenced by message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -563,7 +563,7 @@ done: * Purpose: Increment reference count on any objects referenced by * message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -604,9 +604,7 @@ done: * Purpose: Perform any necessary actions before copying message between * files for attribute messages. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, June 26, 2006 @@ -628,7 +626,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, HDassert(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 */ + * 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") @@ -649,7 +648,6 @@ done: * Purpose: Copies a message from _MESG to _DEST in file * * Return: Success: Ptr to _DEST - * * Failure: NULL * * Programmer: Quincey Koziol @@ -695,7 +693,7 @@ done: * an object may have a reference attribute that points to the * object itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * March 6, 2005 @@ -719,12 +717,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_get_crt_index + * Function: H5O_attr_get_crt_index * - * Purpose: Get creation index from the message + * Purpose: Get creation index from the message * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, January 18, 2007 @@ -749,12 +746,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) /*------------------------------------------------------------------------- - * Function: H5O_attr_set_crt_index + * Function: H5O_attr_set_crt_index * - * Purpose: Set creation index from the message + * Purpose: Set creation index from the message * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, January 18, 2007 diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 640d1c7..5183026 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Oattribute.c - * Dec 11 2006 - * Quincey Koziol + * Created: H5Oattribute.c * - * Purpose: Object header attribute routines. + * Purpose: Object header attribute routines. * *------------------------------------------------------------------------- */ @@ -26,21 +24,21 @@ /* Module Setup */ /****************/ -#define H5A_FRIEND /*suppress error about including H5Apkg */ +#define H5A_FRIEND /* Suppress error about including H5Apkg.h */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Fprivate.h" /* File */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Fprivate.h" /* File */ /****************/ @@ -129,8 +127,24 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, +static herr_t H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static htri_t H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open); +static herr_t H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence, + unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); +static herr_t H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr); +static herr_t H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); +static herr_t H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo); +static herr_t H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); /*********************/ /* Package Variables */ @@ -149,12 +163,12 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, /*------------------------------------------------------------------------- - * Function: H5O_attr_to_dense_cb + * Function: H5O__attr_to_dense_cb * - * Purpose: Object header iterator callback routine to convert compact + * Purpose: Object header iterator callback routine to convert compact * attributes to dense attributes * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -163,14 +177,14 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, *------------------------------------------------------------------------- */ static herr_t -H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */ H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -186,7 +200,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* 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) + 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") /* Indicate that the object header was modified */ @@ -194,15 +208,15 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_to_dense_cb() */ +} /* end H5O__attr_to_dense_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_create + * Function: H5O__attr_create * - * Purpose: Create a new attribute in the object header. + * Purpose: Create a new attribute in the object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, December 8, 2006 @@ -283,7 +297,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Iterate over existing attributes, moving them to dense storage */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_to_dense_cb; + 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") } /* end if */ @@ -337,7 +351,8 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Increment reference count for shared attribute object for the * object handle created by the caller function H5A__create. The count * for the cached object header has been incremented in the step above - * (in H5O__msg_append_real). The dense storage doesn't need a count. */ + * (in H5O__msg_append_real). The dense storage doesn't need a count. + */ attr->shared->nrefs += 1; /* Was new attribute shared? */ @@ -392,12 +407,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_open_cb + * Function: H5O__attr_open_cb * - * Purpose: Object header iterator callback routine to open an + * Purpose: Object header iterator callback routine to open an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -406,13 +421,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, +H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -437,15 +452,15 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_open_cb() */ +} /* end H5O__attr_open_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_open_by_name + * Function: H5O__attr_open_by_name * - * Purpose: Open an existing attribute in an object header. + * Purpose: Open an existing attribute in an object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -470,7 +485,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *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; @@ -483,7 +498,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* If found the attribute is already opened, make a copy of it to share the * object information. If not, open attribute as a new object */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") else if(found_open_attr == TRUE) { if(NULL == (opened_attr = H5A__copy(NULL, exist_attr))) @@ -506,7 +521,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* Iterate over attributes, to locate correct one to open */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_open_cb; + 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") @@ -541,12 +556,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_open_by_idx_cb + * Function: H5O__attr_open_by_idx_cb * - * Purpose: Callback routine opening an attribute by index + * Purpose: Callback routine opening an attribute by index * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -555,12 +569,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) +H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) { H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */ herr_t ret_value = H5_ITER_STOP; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(attr); @@ -572,16 +586,16 @@ H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_open_by_idx_cb() */ +} /* end H5O__attr_open_by_idx_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_open_by_idx + * Function: H5O__attr_open_by_idx * - * Purpose: Open an existing attribute in an object header according to + * Purpose: Open an existing attribute in an object header according to * an index. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 18, 2006 @@ -605,7 +619,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_LIB; - attr_op.u.lib_op = H5O_attr_open_by_idx_cb; + attr_op.u.lib_op = H5O__attr_open_by_idx_cb; /* Iterate over attributes to locate correct one */ if(H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0) @@ -615,7 +629,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, * and make a copy of the already opened object to share the object info. */ if(opened_attr) { - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") /* If found that the attribute is already opened, make a copy of it @@ -647,12 +661,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_find_opened_attr + * Function: H5O__attr_find_opened_attr * - * Purpose: Find out whether an attribute has been opened by giving + * Purpose: Find out whether an attribute has been opened by giving * the name. Return the pointer to the object if found. * - * Return: TRUE: found the already opened object + * Return: TRUE: found the already opened object * FALSE: didn't find the opened object * FAIL: function failed. * @@ -662,14 +676,14 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) +H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) { hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */ unsigned long loc_fnum; /* File serial # for object */ size_t num_open_attr; /* Number of opened attributes */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get file serial number for the location of attribute */ if(H5F_get_fileno(loc->file, &loc_fnum) < 0) @@ -691,8 +705,8 @@ H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_t /* 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") - if(check_num_attr != num_open_attr) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch") + if(check_num_attr != num_open_attr) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch") /* Iterate over the attributes */ for(u = 0; u < num_open_attr; u++) { @@ -724,15 +738,15 @@ done: H5MM_free(attr_id_list); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_find_opened_attr */ +} /* end H5O__attr_find_opened_attr() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_update_shared + * Function: H5O__attr_update_shared * - * Purpose: Update a shared attribute. + * Purpose: Update a shared attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -802,25 +816,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_write_cb + * Function: H5O__attr_write_cb * - * Purpose: Object header iterator callback routine to update an + * Purpose: Object header iterator callback routine to update an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org * Dec 4 2006 * - * Modification:Raymond Lu - * 4 June 2008 - * Took out the data copying part because the attribute data - * is shared between attribute handle and object header. *------------------------------------------------------------------------- */ static herr_t -H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */ @@ -828,7 +838,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -885,15 +895,15 @@ done: 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() */ +} /* end H5O__attr_write_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_write + * Function: H5O__attr_write * - * Purpose: Write a new value to an attribute. + * Purpose: Write a new value to an attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 4, 2006 @@ -915,7 +925,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *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; @@ -942,7 +952,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) /* Iterate over attributes, to locate correct one to update */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_write_cb; + 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") @@ -964,12 +974,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_rename_chk_cb + * Function: H5O__attr_rename_chk_cb * - * Purpose: Object header iterator callback routine to check for + * Purpose: Object header iterator callback routine to check for * duplicate name during rename * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -978,13 +988,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(oh); @@ -1001,21 +1011,21 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_rename_chk_cb() */ +} /* end H5O__attr_rename_chk_cb() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_rename_mod_cb + * Function: H5O__attr_rename_mod_cb * - * Purpose: Object header iterator callback routine to change name of + * Purpose: Object header iterator callback routine to change name of * attribute during rename * - * Note: This routine doesn't currently allow an attribute to change + * Note: This routine doesn't currently allow an attribute to change * its "shared" status, if the name change would cause a size * difference that would put it into a different category. * Something for later... * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1024,7 +1034,7 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ @@ -1032,7 +1042,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1096,7 +1106,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* (doesn't decrement the link count on shared components because * the "native" pointer has been reset) */ - if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute") *oh_modified = H5O_MODIFY_CONDENSE; @@ -1130,15 +1140,15 @@ done: 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() */ +} /* end H5O__attr_rename_mod_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_rename + * Function: H5O__attr_rename * - * Purpose: Rename an attribute. + * Purpose: Rename an attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1162,7 +1172,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_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; @@ -1190,7 +1200,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* Iterate over attributes, to check if "new name" exists already */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_rename_chk_cb; + 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") @@ -1200,7 +1210,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* 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; + 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") @@ -1218,15 +1228,15 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5O__attr_rename */ +} /* end H5O__attr_rename() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_iterate_real + * Function: H5O_attr_iterate_real * - * Purpose: Internal routine to iterate over attributes for an object. + * Purpose: Internal routine to iterate over attributes for an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1309,11 +1319,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__attr_iterate + * Function: H5O__attr_iterate * - * Purpose: Iterate over attributes for an object. + * Purpose: Iterate over attributes for an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1322,8 +1332,7 @@ done: */ herr_t H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, - hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, - void *op_data) + hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { H5G_loc_t loc; /* Object location */ herr_t ret_value = FAIL; /* Return value */ @@ -1347,11 +1356,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_remove_update + * Function: H5O__attr_remove_update * - * Purpose: Check for reverting from dense to compact attribute storage + * Purpose: Check for reverting from dense to compact attribute storage * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, February 14, 2007 @@ -1367,12 +1376,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) +H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) { H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -1427,7 +1436,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* Insert attribute message into object header (Will increment reference count on shared attributes) */ /* Find out whether the attribute has been opened */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") /* If found the attribute is already opened, use the opened message to insert. @@ -1450,7 +1459,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* Update the message after removing the attribute */ /* This is particularly needed when removing the last attribute that is - accessed via fractal heap/v2 B-tree (HDFFV-9277) */ + * 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") @@ -1468,16 +1478,16 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_remove_update() */ +} /* end H5O__attr_remove_update() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_remove_cb + * Function: H5O__attr_remove_cb * - * Purpose: Object header iterator callback routine to remove an + * Purpose: Object header iterator callback routine to remove an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1486,13 +1496,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1502,7 +1512,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* 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) + 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") /* Indicate that the object header was modified */ @@ -1517,15 +1527,15 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_remove_cb() */ +} /* end H5O__attr_remove_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_remove + * Function: H5O__attr_remove * - * Purpose: Delete an attribute on an object. + * Purpose: Delete an attribute on an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1548,7 +1558,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *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; @@ -1575,7 +1585,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Iterate over attributes, to locate correct one to delete */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_remove_cb; + 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") @@ -1586,7 +1596,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Update the attribute information after removing an attribute */ if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo) < 0) + if(H5O__attr_remove_update(loc, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ @@ -1602,12 +1612,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__attr_remove_by_idx + * Function: H5O__attr_remove_by_idx * - * Purpose: Delete an attribute on an object, according to an order within - * an index. + * Purpose: Delete an attribute on an object, according to an order within + * an index. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, February 14, 2007 @@ -1631,7 +1641,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* 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; @@ -1666,7 +1676,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Iterate over attributes, to locate correct one to delete */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_remove_cb; + 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") @@ -1677,7 +1687,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Update the attribute information after removing an attribute */ if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo) < 0) + if(H5O__attr_remove_update(loc, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ @@ -1695,11 +1705,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_count_real + * Function: H5O__attr_count_real * - * Purpose: Determine the # of attributes on an object + * Purpose: Determine the # of attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, March 9, 2007 @@ -1707,11 +1717,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) +H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_TAG(oh->cache_info.addr) + FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* Check arguments */ HDassert(f); @@ -1745,16 +1755,16 @@ H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5O_attr_count_real */ +} /* end H5O__attr_count_real */ /*------------------------------------------------------------------------- - * Function: H5O_attr_exists_cb + * Function: H5O__attr_exists_cb * - * Purpose: Object header iterator callback routine to check for an + * Purpose: Object header iterator callback routine to check for an * attribute stored compactly, by name. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1763,13 +1773,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(mesg); @@ -1785,15 +1795,15 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_exists_cb() */ +} /* end H5O__attr_exists_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_exists + * Function: H5O__attr_exists * - * Purpose: Determine if an attribute with a particular name exists on an object + * Purpose: Determine if an attribute with a particular name exists on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1815,7 +1825,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *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, 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; @@ -1842,7 +1852,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name) /* Iterate over existing attributes, checking for attribute with same name */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_exists_cb; + 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") @@ -1863,7 +1873,7 @@ done: * * Purpose: For 1.8 attribute, returns storage amount for btree and fractal heap * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * June 19, 2007 @@ -1943,11 +1953,11 @@ done: #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5O__attr_count + * Function: H5O__attr_count * - * Purpose: Determine the # of attributes on an object + * Purpose: Determine the # of attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1968,10 +1978,10 @@ H5O__attr_count(const H5O_loc_t *loc) /* 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") /* Retrieve # of attributes on object */ - if(H5O_attr_count_real(loc->file, oh, &nattrs) < 0) + if(H5O__attr_count_real(loc->file, oh, &nattrs) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Set return value */ diff --git a/src/H5Obogus.c b/src/H5Obogus.c index 92fd218..fbf04f2 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -75,7 +75,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ 0, /*native message size */ 0, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ - H5O__bogus_encode, /*encode message */ + H5O_bogus_encode, /*encode message */ NULL, /*copy the native value */ H5O_bogus_size, /*raw message size */ NULL, /*free internal memory */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 59e1705..e7cad83 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -437,7 +437,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) HDassert(oh->cache_info.type == H5AC_OHDR); HDassert(oh->chunk[0].size == len); #ifdef H5O_DEBUG - H5O_assert(oh); + H5O__assert(oh); #endif /* H5O_DEBUG */ /* Point to raw data 'image' for first chunk, which @@ -1430,9 +1430,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for combining two adjacent 'null' messages */ if((udata->file_intent & H5F_ACC_RDWR) && - H5O_NULL_ID == id && oh->nmesgs > 0 && - H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && - oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { + H5O_NULL_ID == id && oh->nmesgs > 0 && + H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && + oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { size_t mesgno; /* Current message to operate on */ @@ -1448,7 +1448,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* 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) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages") /* Get pointer to message to set up */ @@ -1470,9 +1470,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* (Usually from future versions of the library) */ if(id >= H5O_UNKNOWN_ID || #ifdef H5O_ENABLE_BOGUS - id == H5O_BOGUS_VALID_ID || + id == H5O_BOGUS_VALID_ID || #endif - NULL == H5O_msg_class_g[id]) { + NULL == H5O_msg_class_g[id]) { H5O_unknown_t *unknown; /* Pointer to "unknown" message info */ @@ -1491,9 +1491,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for "fail if unknown" message flags */ if(((udata->file_intent & H5F_ACC_RDWR) && - (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") + (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") /* Check for "mark if unknown" message flag, etc. */ else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) && !(flags & H5O_MSG_FLAG_WAS_UNKNOWN) && diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 205515a..94301b3 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -77,12 +77,11 @@ H5FL_DEFINE(H5O_chunk_proxy_t); /*------------------------------------------------------------------------- - * Function: H5O__chunk_add + * Function: H5O__chunk_add * - * Purpose: Add new chunk for object header to metadata cache + * Purpose: Add new chunk for object header to metadata cache * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -107,7 +106,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* 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) @@ -128,6 +127,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* 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") + chk_proxy = NULL; done: @@ -146,12 +146,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_protect + * Function: H5O_chunk_protect * - * Purpose: Protect an object header chunk for modifications + * Purpose: Protect an object header chunk for modifications * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -221,12 +220,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_unprotect + * Function: H5O__chunk_unprotect * - * Purpose: Unprotect an object header chunk after modifications + * Purpose: Unprotect an object header chunk after modifications * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -273,12 +271,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_chunk_resize + * Function: H5O__chunk_resize * - * Purpose: Resize an object header chunk + * Purpose: Resize an object header chunk * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -287,11 +284,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) +H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh); @@ -311,16 +308,15 @@ H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_chunk_resize() */ +} /* end H5O__chunk_resize() */ /*------------------------------------------------------------------------- - * Function: H5O__chunk_update_idx + * Function: H5O__chunk_update_idx * - * Purpose: Update the chunk index for a chunk proxy + * Purpose: Update the chunk index for a chunk proxy * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -367,12 +363,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_delete + * Function: H5O__chunk_delete * - * Purpose: Notify metadata cache that a chunk has been deleted + * Purpose: Notify metadata cache that a chunk has been deleted * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -413,12 +408,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_dest + * Function: H5O__chunk_dest * - * Purpose: Destroy a chunk proxy object + * Purpose: Destroy a chunk proxy object * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 2eb27d6..ad54272 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -36,10 +36,10 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static size_t H5O__cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__cont_free(void *mesg); static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static herr_t H5O__cont_debug(H5F_t *f, const void *_mesg, FILE * stream, @@ -51,10 +51,10 @@ const H5O_msg_class_t H5O_MSG_CONT[1] = {{ "hdr continuation", /*message name for debugging */ sizeof(H5O_cont_t), /*native message size */ 0, /* messages are sharable? */ - H5O_cont_decode, /*decode message */ - H5O_cont_encode, /*encode message */ + H5O__cont_decode, /*decode message */ + H5O__cont_encode, /*encode message */ NULL, /*no copy method */ - H5O_cont_size, /*size of header continuation */ + H5O__cont_size, /*size of header continuation */ NULL, /*reset method */ H5O__cont_free, /* free method */ H5O__cont_delete, /* file delete method */ @@ -74,7 +74,7 @@ H5FL_DEFINE(H5O_cont_t); /*------------------------------------------------------------------------- - * Function: H5O_cont_decode + * Function: H5O__cont_decode * * Purpose: Decode the raw header continuation message. * @@ -89,14 +89,14 @@ H5FL_DEFINE(H5O_cont_t); *------------------------------------------------------------------------- */ static void * -H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, +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) { H5O_cont_t *cont = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -116,11 +116,11 @@ H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_cont_decode() */ +} /* end H5O__cont_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_cont_encode + * Function: H5O__cont_encode * * Purpose: Encodes a continuation message. * @@ -133,11 +133,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_cont_t *cont = (const H5O_cont_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -151,11 +151,11 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con H5F_ENCODE_LENGTH(f, p, cont->size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_cont_encode() */ +} /* end H5O__cont_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_cont_size + * Function: H5O__cont_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -172,18 +172,18 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *------------------------------------------------------------------------- */ static size_t -H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */ H5F_SIZEOF_SIZE(f)); /* Continuation header length */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_cont_size() */ +} /* end H5O__cont_size() */ /*------------------------------------------------------------------------- @@ -256,8 +256,6 @@ done: * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 8a44902..1ba4901 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Ocopy.c - * Nov 6 2006 - * Quincey Koziol + * Created: H5Ocopy.c * - * Purpose: Object copying routines. + * Purpose: Object copying routines. * *------------------------------------------------------------------------- */ @@ -32,19 +30,19 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Lprivate.h" /* Links */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5HGprivate.h" /* Global Heaps */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Lprivate.h" /* Links */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ /****************/ @@ -79,8 +77,6 @@ typedef struct H5O_copy_search_comm_dt_ud_t { /* Local Prototypes */ /********************/ -static herr_t H5O__copy(const H5G_loc_t *loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); static herr_t H5O__copy_free_addrmap_cb(void *item, void *key, void *op_data); static herr_t H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata); @@ -240,7 +236,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Copy the object */ - if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) + if(H5O_copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: @@ -249,7 +245,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__copy + * Function: H5O_copy * * Purpose: Private version of H5Ocopy * @@ -260,8 +256,8 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, +herr_t +H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) { H5G_loc_t src_loc; /* Source object group location */ @@ -272,7 +268,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, hbool_t obj_open = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI_NOINIT /* Check arguments */ HDassert(loc); @@ -312,7 +308,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__copy() */ +} /* end H5O_copy() */ /*------------------------------------------------------------------------- @@ -431,7 +427,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, } /* 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) + if(H5O__flush_msgs(oloc_src->file, oh_src) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages") /* Allocate the destination object header and fill in header fields */ @@ -766,7 +762,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* 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) + if(H5O__alloc_msgs(oh_dst, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Create null message for [rest of] space in new chunk */ @@ -1215,7 +1211,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, /* 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: @@ -1898,7 +1894,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, /* Traverse the destination file, adding committed datatypes to the skip * list */ - if(H5G_visit(H5F_FILE_ID(oloc_dst->file), "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0) + 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") cpy_info->dst_dt_list_complete = TRUE; } /* end if */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 1fc95dd..b8190ae 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -76,12 +76,12 @@ #ifdef H5O_DEBUG /*------------------------------------------------------------------------- - * Function: H5O_assert + * Function: H5O__assert * - * Purpose: Sanity check the information for an object header data + * Purpose: Sanity check the information for an object header data * structure. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED (Doesn't fail, just crashes) * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -90,7 +90,7 @@ *------------------------------------------------------------------------- */ herr_t -H5O_assert(const H5O_t *oh) +H5O__assert(const H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message to examine */ H5O_mesg_t *tmp_msg; /* Pointer to temporary message to examine */ @@ -101,7 +101,7 @@ H5O_assert(const H5O_t *oh) size_t hdr_size; /* Size of header's chunks */ unsigned u, v; /* Local index variables */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Initialize the tracking variables */ hdr_size = 0; @@ -223,7 +223,7 @@ H5O_assert(const H5O_t *oh) HDassert(hdr_size == (free_space + meta_space + mesg_space)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_assert() */ +} /* end H5O__assert() */ #endif /* H5O_DEBUG */ @@ -270,31 +270,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_debug_real + * Function: H5O__debug_real * - * Purpose: Prints debugging info about an object header. + * Purpose: Prints debugging info about an object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * Feb. 2009: Vailin Choi - * Fixed bug in the accumulation of chunk_total - * Used the appropriate flag when printing creation order tracked/indexed *------------------------------------------------------------------------- */ herr_t -H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth) +H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth) { size_t mesg_total = 0, chunk_total = 0, gap_total = 0; unsigned *sequence = NULL; unsigned i; /* Local index variable */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -323,16 +319,16 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int /* Extra information for later versions */ if(oh->version > H5O_VERSION_1) { /* Display object's status flags */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + 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, + 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, + 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, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Timestamps:", (oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled"); if(oh->flags & ~H5O_HDR_ALL_FLAGS) @@ -385,14 +381,14 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int for(i = 0, chunk_total = 0; i < oh->nchunks; i++) { size_t chunk_size; - HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); + HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %a\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(0 == i) { if(H5F_addr_ne(oh->chunk[i].addr, addr)) HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n"); chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh); @@ -401,54 +397,53 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunk_size = oh->chunk[i].size; /* Accumulate chunk's size to total */ - chunk_total += chunk_size; - gap_total += oh->chunk[i].gap; + chunk_total += chunk_size; + gap_total += oh->chunk[i].gap; - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(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), + HDfprintf(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 */ /* Accumulate message's size to total */ - mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; + mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; - /* For version 2 object header, add size of "OCHK" for continuation chunk */ - if (oh->mesg[i].type->id == H5O_CONT_ID) - mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); + /* For version 2 object header, add size of "OCHK" for continuation chunk */ + if(oh->mesg[i].type->id == H5O_CONT_ID) + mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); - HDfprintf(stream, "%*sMessage %d...\n", indent, "", i); + HDfprintf(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); - continue; - } /* end if */ + /* 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); + continue; + } /* end if */ - /* message name and size */ - HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", + /* 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 %t\n", indent + 3, "", MAX (0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3), "Dirty:", oh->mesg[i].dirty); HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX (0, fwidth - 3), "Message flags:"); - if(oh->mesg[i].flags) { + if(oh->mesg[i].flags) { hbool_t flag_printed = FALSE; /* Sanity check that all flags in format are covered below */ @@ -497,39 +492,40 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int } /* end if */ else HDfprintf(stream, "\n"); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3), + + HDfprintf(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), + 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); - /* check the size */ - if((oh->mesg[i].raw + 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"); + HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n"); - /* decode the message */ - debug_type = oh->mesg[i].type; - if(NULL == oh->mesg[i].native && debug_type->decode) + /* decode the message */ + debug_type = oh->mesg[i].type; + if(NULL == oh->mesg[i].native && debug_type->decode) 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), + /* print the message */ + HDfprintf(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, ""); + 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, ""); } /* end for */ if((mesg_total + gap_total) != chunk_total) - HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); + HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: /* Release resources */ @@ -537,7 +533,7 @@ done: sequence = (unsigned *)H5MM_xfree(sequence); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_debug_real() */ +} /* end H5O__debug_real() */ /*------------------------------------------------------------------------- @@ -575,14 +571,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 */ - H5O_debug_real(f, oh, addr, stream, indent, fwidth); + if(H5O__debug_real(f, oh, addr, stream, indent, fwidth) < 0) + 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/src/H5Odeprec.c b/src/H5Odeprec.c index c73529e..3441d8b 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -98,11 +98,11 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: FUNC_LEAVE_API(ret_value) @@ -131,12 +131,14 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + 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") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") - /* Verify access property list and set up collective metadata if appropriate */ + /* 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") @@ -169,8 +171,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Location of group */ H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ @@ -243,12 +243,15 @@ herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data); /* Check args */ + if(H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -256,8 +259,8 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -301,15 +304,20 @@ herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data, lapl_id); /* Check args */ - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!obj_name) + 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") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -321,8 +329,8 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, 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") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Odtype.c b/src/H5Odtype.c index b8eb4a7..28970d1 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -15,13 +15,13 @@ #define H5T_FRIEND /*prevent warning from including H5Tpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Gprivate.h" /* Groups */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Tpkg.h" /* Datatypes */ #include "H5VMprivate.h" /* Vectors and arrays */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 8a6004d..c131c76 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -754,8 +754,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) } /* end if */ fill->size = 0; if(fill->type) { - (void)H5T_close_real(fill->type); - fill->type = NULL; + (void)H5T_close_real(fill->type); + fill->type = NULL; } /* end if */ done: @@ -1008,7 +1008,7 @@ 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)) { diff --git a/src/H5Oflush.c b/src/H5Oflush.c index d8c9530..2302d4c 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -41,11 +41,9 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Objects */ - /********************/ /* Local Prototypes */ /********************/ -static herr_t H5O__flush(hid_t obj_id); static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag); static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc); @@ -58,11 +56,11 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, /*------------------------------------------------------------------------- - * Function: H5Oflush + * Function: H5Oflush * - * Purpose: Flushes all buffers associated with an object to disk. + * Purpose: Flushes all buffers associated with an object to disk. * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Mike McGreevy * May 19, 2010 @@ -72,17 +70,22 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, herr_t H5Oflush(hid_t obj_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5O_loc_t *oloc; /* Object location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", obj_id); + /* Check args */ + if(NULL == (oloc = H5O_get_loc(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal routine */ - if(H5O__flush(obj_id) < 0) + /* Flush the object */ + if(H5O_flush(oloc, obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: @@ -91,88 +94,83 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_flush_common + * Function: H5O_flush * - * Purpose: Flushes the object's metadata - * Invokes the user-defined callback if there is one. + * Purpose: Internal routine to flush an object * - * Return: Non-negative on success, negative on failure + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi; Dec 2013 + * Programmer: Quincey Koziol + * December 29, 2017 * *------------------------------------------------------------------------- */ herr_t -H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) +H5O_flush(H5O_loc_t *oloc, hid_t obj_id) { - haddr_t tag = 0; - herr_t ret_value = SUCCEED; /* Return value */ + void *obj_ptr; /* Pointer to object */ + const H5O_obj_class_t *obj_class; /* Class of object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Retrieve tag for object */ - if(H5O__oh_tag(oloc, &tag) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata") + /* Get the object pointer */ + if(NULL == (obj_ptr = H5I_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Flush metadata based on tag value of the object */ - if(H5F_flush_tagged_metadata(oloc->file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + /* Get the object class */ + if(NULL == (obj_class = H5O__obj_class(oloc))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class") - /* 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") + /* 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") + + /* 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") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_flush_common() */ +} /* end H5O_flush() */ /*------------------------------------------------------------------------- - * Function: H5O__flush + * Function: H5O_flush_common * - * Purpose: Internal routine to flush an object + * Purpose: Flushes the object's metadata + * Invokes the user-defined callback if there is one. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * December 29, 2017 + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ -static herr_t -H5O__flush(hid_t obj_id) +herr_t +H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) { - H5O_loc_t *oloc; /* Object location */ - void *obj_ptr; /* Pointer to object */ - const H5O_obj_class_t *obj_class; /* Class of object */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") + haddr_t tag = 0; + herr_t ret_value = SUCCEED; /* Return value */ - /* Get the object pointer */ - if(NULL == (obj_ptr = H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + FUNC_ENTER_NOAPI(FAIL) - /* Get the object class */ - if(NULL == (obj_class = H5O__obj_class(oloc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class") + /* Retrieve tag for object */ + if(H5O__oh_tag(oloc, &tag) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata") - /* 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") + /* Flush metadata based on tag value of the object */ + if(H5F_flush_tagged_metadata(oloc->file, tag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") - /* 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") + /* 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") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__flush() */ +} /* end H5O_flush_common() */ /*------------------------------------------------------------------------- @@ -219,9 +217,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Orefresh * - * Purpose: Refreshes all buffers associated with an object. + * Purpose: Refreshes all buffers associated with an object. * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Mike McGreevy * July 28, 2010 @@ -239,13 +237,13 @@ H5Orefresh(hid_t oid) /* Check args */ if(NULL == (oloc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(oid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal routine */ + /* Refresh the object */ if(H5O_refresh_metadata(oid, *oloc) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") @@ -354,8 +352,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Get object's type */ if(H5I_get_type(oid) == H5I_DATASET) - if(H5D_mult_refresh_close(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + if(H5D_mult_refresh_close(oid) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") /* Retrieve tag for object */ if(H5O__oh_tag(&oloc, &tag) < 0) @@ -379,8 +377,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Re-cork object with tag */ if(corked) - if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") + if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") done: FUNC_LEAVE_NOAPI(ret_value); @@ -404,12 +402,15 @@ done: herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) { - void *object = NULL; /* Dataset for this operation */ + void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ + HDassert(obj_loc); + /* Get object's type */ type = H5I_get_type(oid); @@ -455,7 +456,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) /* Re-register ID for the object */ if((H5I_register_with_id(type, object, TRUE, oid)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index b75a9c5..4b34a52 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -113,7 +113,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* 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 */ flags = *p++; @@ -231,7 +231,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest) /* check args */ HDassert(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; diff --git a/src/H5Oint.c b/src/H5Oint.c index 49d7835..44809e1 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -42,7 +42,6 @@ #include "H5MMprivate.h" /* Memory management */ #endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared object header messages */ /****************/ @@ -514,12 +513,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_open_name + * Function: H5O_open_name * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object within an HDF5 file. * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * March 5 2007 @@ -552,7 +551,7 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref) loc_found = TRUE; /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, app_ref)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, app_ref)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: @@ -565,12 +564,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__open_by_idx + * Function: H5O_open_by_idx * * Purpose: Internal routine to open an object by index within group * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * December 28, 2017 @@ -578,7 +577,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5G_loc_t obj_loc; /* Location used to open group */ @@ -587,7 +586,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments */ HDassert(loc); @@ -603,7 +602,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, loc_found = TRUE; /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: @@ -613,16 +612,16 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__open_by_idx() */ +} /* end H5O_open_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O__open_by_addr + * Function: H5O_open_by_addr * * Purpose: Internal routine to open an object by its address * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * December 28, 2017 @@ -630,14 +629,14 @@ done: *------------------------------------------------------------------------- */ hid_t -H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) +H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments */ HDassert(loc); @@ -651,21 +650,21 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */ /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__open_by_addr() */ +} /* end H5O_open_by_addr() */ /*------------------------------------------------------------------------- - * Function: H5O__open_by_loc + * Function: H5O_open_by_loc * - * Purpose: Opens an object and returns an ID given its group loction. + * Purpose: Opens an object and returns an ID given its group loction. * - * Return: Success: Open object identifier - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 25 2006 @@ -673,12 +672,12 @@ done: *------------------------------------------------------------------------- */ hid_t -H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) +H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) { const H5O_obj_class_t *obj_class; /* Class of object for location */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(obj_loc); @@ -693,7 +692,7 @@ H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__open_by_loc() */ +} /* end H5O_open_by_loc() */ /*------------------------------------------------------------------------- @@ -735,10 +734,9 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) #ifdef H5O_DEBUG if(H5DEBUG(O)) { if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file)) - HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", - loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); - else - HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); + HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); + else + HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); } #endif @@ -761,14 +759,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__link_oh + * Function: H5O__link_oh * - * Purpose: Adjust the link count for an open object header by adding - * ADJUST to the link count. + * Purpose: Adjust the link count for an open object header by adding + * ADJUST to the link count. * - * Return: Success: New link count + * Return: Success: New link count * - * Failure: Negative + * Failure: -1 * * Programmer: Robb Matzke * matzke@llnl.gov @@ -794,14 +792,14 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if(adjust < 0) { /* Check for too large of an adjustment */ if((unsigned)(-adjust) > oh->nlink) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "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, FAIL, "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) { @@ -809,7 +807,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, FAIL, "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 */ @@ -824,7 +822,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, FAIL, "can't mark object for deletion") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion") } /* end if */ } /* end if */ @@ -833,7 +831,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, FAIL, "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 */ @@ -843,7 +841,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, FAIL, "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 */ @@ -851,7 +849,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) H5O_refcount_t refcount = oh->nlink; if(H5O__msg_write_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message") } /* end else */ } /* end if */ else { @@ -860,7 +858,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) H5O_refcount_t refcount = oh->nlink; if(H5O__msg_append_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "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 */ @@ -1061,7 +1059,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) } /* end if */ #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ /* Pin the other chunks also when requested, so that the object header @@ -1325,8 +1323,9 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) chk_dirtied = TRUE; } /* end if */ else { - /* XXX: For now, update access time & change fields in the object header */ - /* (will need to add some code to update modification time appropriately) */ + /* XXX: For now, update access time & change fields in the object header + * (will need to add some code to update modification time appropriately) + */ oh->atime = oh->ctime = now; /* Mark object header as dirty in cache */ @@ -1426,25 +1425,25 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) H5O_bogus_t *bogus; /* Pointer to the bogus information */ /* 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") + if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") /* Update the native value */ bogus->u = H5O_BOGUS_VALUE; - if(bogus_id == H5O_BOGUS_VALID_ID) - type = H5O_MSG_BOGUS_VALID; - else if(bogus_id == H5O_BOGUS_INVALID_ID) - type = H5O_MSG_BOGUS_INVALID; - else - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") + if(bogus_id == H5O_BOGUS_VALID_ID) + type = H5O_MSG_BOGUS_VALID; + else if(bogus_id == H5O_BOGUS_INVALID_ID) + type = H5O_MSG_BOGUS_INVALID; + else + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 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") + 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") /* Point to "bogus" information (take it over) */ - oh->mesg[idx].native = bogus; + oh->mesg[idx].native = bogus; /* Set the appropriate flags for the message */ oh->mesg[idx].flags = mesg_flags; @@ -1634,23 +1633,23 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) /* Set type to "unknown" */ *obj_type = H5O_TYPE_UNKNOWN; - } /* end if */ + } else { /* Set object type */ *obj_type = obj_class->type; - } /* end else */ + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__obj_type_real() */ /*------------------------------------------------------------------------- - * Function: H5O__obj_class + * Function: H5O__obj_class * - * Purpose: Returns the class of object pointed to by `loc'. + * Purpose: Returns the class of object pointed to by 'loc'. * - * Return: Success: An object class - * Failure: NULL + * Return: Success: An object class + * Failure: NULL * * Programmer: Quincey Koziol * Monday, November 6, 2006 @@ -1663,7 +1662,7 @@ H5O__obj_class(const H5O_loc_t *loc) H5O_t *oh = NULL; /* Object header for location */ const H5O_obj_class_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) @@ -1675,7 +1674,7 @@ H5O__obj_class(const H5O_loc_t *loc) 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() */ @@ -1714,7 +1713,7 @@ H5O__obj_class_real(const H5O_t *oh) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") else if(isa) HGOTO_DONE(H5O_obj_class_g[i - 1]) - } /* end for */ + } if(0 == i) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") @@ -2164,7 +2163,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_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) + if(H5O__attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Get B-tree & heap metadata storage size, if requested */ @@ -2580,7 +2579,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__visit + * Function: H5O__visit * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -2601,12 +2600,12 @@ done: * Note: Add a parameter "fields" to indicate selection of object info. * * 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. + * 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. + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -2614,17 +2613,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, +H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { H5O_iter_visit_ud_t udata; /* User data for callback */ - H5G_loc_t loc; /* Location of reference object */ H5G_loc_t obj_loc; /* Location used to open object */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ H5O_info_t oinfo; /* Object info struct */ - hid_t obj_id = (-1); /* ID of object */ + hid_t obj_id = H5I_INVALID_HID; /* ID of object */ herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -2633,8 +2631,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HDmemset(&udata, 0, sizeof(udata)); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HDassert(loc); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2642,7 +2639,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0) + if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; @@ -2652,7 +2649,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Open the object */ /* (Takes ownership of the obj_loc information) */ - if((obj_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((obj_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Make callback for starting object */ @@ -2698,20 +2695,21 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* 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") - } /* end if */ + } /* Call internal group visitation routine */ - if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) + if((ret_value = H5G_visit(&start_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") } /* end if */ done: - if(obj_id > 0) { + 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") - } /* end if */ + } else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + if(udata.visited) H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL); diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 4903d9f..9827b6a 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -44,13 +44,13 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void static herr_t H5O__linfo_free(void *_mesg); static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src, - H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, - H5O_copy_t *cpy_info, void *udata); + H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, + H5O_copy_t *cpy_info, void *udata); static herr_t H5O__linfo_post_copy_file(const H5O_loc_t *parent_src_oloc, - const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, - unsigned *mesg_flags, H5O_copy_t *cpy_info); -static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, - FILE * stream, int indent, int fwidth); + const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, + unsigned *mesg_flags, H5O_copy_t *cpy_info); +static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, FILE * stream, + int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index e156dcd..d6e3dce 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -127,11 +127,11 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* 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) @@ -225,7 +225,7 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, 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") #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: @@ -276,7 +276,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* 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) @@ -384,7 +384,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, /* 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 */ @@ -427,7 +427,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, 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") #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: @@ -474,15 +474,15 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg) /* 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() */ @@ -616,12 +616,12 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native) HDassert(type); if(native) { - if(type->reset) { - if((type->reset)(native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") - } /* end if */ + if(type->reset) { + if((type->reset)(native) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") + } /* end if */ else - HDmemset(native, 0, type->native_size); + HDmemset(native, 0, type->native_size); } /* end if */ done: @@ -658,7 +658,7 @@ H5O_msg_free(unsigned type_id, void *mesg) HDassert(type); /* Call the "real" free routine */ - ret_value = H5O__msg_free_real(type, mesg); + ret_value = H5O_msg_free_real(type, mesg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_free() */ @@ -667,7 +667,7 @@ H5O_msg_free(unsigned type_id, void *mesg) /*------------------------------------------------------------------------- * Function: H5O__msg_free_mesg * - * Purpose: Call H5O__msg_free_real() on a message. + * Purpose: Call H5O_msg_free_real() on a message. * * Return: Non-negative on success/Negative on failure * @@ -685,14 +685,14 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) HDassert(mesg); /* Free any native information */ - mesg->native = H5O__msg_free_real(mesg->type, mesg->native); + mesg->native = H5O_msg_free_real(mesg->type, mesg->native); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__msg_free_mesg() */ /*------------------------------------------------------------------------- - * Function: H5O__msg_free_real + * Function: H5O_msg_free_real * * Purpose: Similar to H5O_msg_reset() except it also frees the message * pointer. @@ -706,9 +706,9 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) *------------------------------------------------------------------------- */ void * -H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native) +H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ HDassert(type); @@ -722,7 +722,7 @@ H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native) } /* end if */ FUNC_LEAVE_NOAPI(NULL) -} /* end H5O__msg_free_real() */ +} /* end H5O_msg_free_real() */ /*------------------------------------------------------------------------- @@ -798,22 +798,22 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id) /* 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); + msg_count = H5O__msg_count_real(oh, type); H5_CHECKED_ASSIGN(ret_value, int, msg_count, unsigned); 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() */ /*------------------------------------------------------------------------- - * Function: H5O_msg_count_real + * Function: H5O__msg_count_real * * Purpose: Counts the number of messages in an object header which are a * certain type. @@ -828,12 +828,12 @@ done: *------------------------------------------------------------------------- */ unsigned -H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) +H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) { unsigned u; /* Local index variable */ unsigned ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(oh); @@ -841,11 +841,11 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) /* Loop over all messages, counting the ones of the type looked for */ for(u = ret_value = 0; u < oh->nmesgs; u++) - if(oh->mesg[u].type == type) + if(oh->mesg[u].type == type) ret_value++; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_count_real() */ +} /* end H5O__msg_count_real() */ /*------------------------------------------------------------------------- @@ -976,11 +976,11 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj /* 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) @@ -1028,11 +1028,11 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, /* 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) @@ -1090,7 +1090,7 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, * (OK to remove constant messages - QAK) */ /* Convert message into a null message */ - if(H5O_release_mesg(udata->f, oh, mesg, udata->adj_link) < 0) + 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") /* Indicate that the object header was modified */ @@ -1315,8 +1315,8 @@ done: * message removal) */ 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") + if(H5O__condense_header(f, oh) < 0) + 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) @@ -1973,7 +1973,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, /* 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); @@ -1991,7 +1991,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, /* Release chunk */ if(H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_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 */ @@ -2197,7 +2197,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_flush_msgs + * Function: H5O__flush_msgs * * Purpose: Flushes messages for object header. * @@ -2210,13 +2210,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_flush_msgs(H5F_t *f, H5O_t *oh) +H5O__flush_msgs(H5F_t *f, H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -2240,7 +2240,7 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_flush_msgs() */ +} /* end H5O__flush_msgs() */ /*------------------------------------------------------------------------- diff --git a/src/H5Omtime.c b/src/H5Omtime.c index db1d8d7..172f9ab 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -442,8 +442,6 @@ H5O__mtime_free(void *mesg) * matzke@llnl.gov * Jul 24 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -454,7 +452,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, struct tm *tm; char buf[128]; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 059b46a..ea654d2 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -63,7 +63,7 @@ ) #define H5O_ALIGN_OH(O, X) \ H5O_ALIGN_VERS((O)->version, X) -#define H5O_ALIGN_F(F, X) \ +#define H5O_ALIGN_F(F, X) \ H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X) /* Size of checksum (on disk) */ @@ -555,15 +555,11 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ -H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr); -H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, +H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); H5_DLL herr_t H5O__dec_rc(H5O_t *oh); @@ -576,9 +572,8 @@ H5_DLL herr_t H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t unsigned mesg_flags, unsigned update_flags, void *mesg); H5_DLL herr_t H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, void *mesg); -H5_DLL void *H5O__msg_free_real(const H5O_msg_class_t *type, void *mesg); H5_DLL herr_t H5O__msg_free_mesg(H5O_mesg_t *mesg); -H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type); +H5_DLL unsigned H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type); H5_DLL herr_t H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link); H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, @@ -586,17 +581,15 @@ H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata); H5_DLL herr_t H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const H5O_mesg_operator_t *op, void *op_data); -H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg); -H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh); +H5_DLL herr_t H5O__flush_msgs(H5F_t *f, H5O_t *oh); H5_DLL herr_t H5O__delete_mesg(H5F_t *f, H5O_t *open_oh, H5O_mesg_t *mesg); /* Object header chunk routines */ H5_DLL herr_t H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno); H5_DLL H5O_chunk_proxy_t *H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx); -H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, - hbool_t chk_dirtied); +H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied); H5_DLL herr_t H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx); -H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy); +H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy); H5_DLL herr_t H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx); H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy); @@ -604,20 +597,20 @@ H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy); H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info); /* Object header allocation routines */ -H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc); +H5_DLL herr_t H5O__alloc_msgs(H5O_t *oh, size_t min_alloc); H5_DLL herr_t H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_msg_alloc_info_t *found_msg, size_t *new_idx); H5_DLL herr_t H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg, size_t *mesg_idx); -H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh); -H5_DLL herr_t H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, +H5_DLL herr_t H5O__condense_header(H5F_t *f, H5O_t *oh); +H5_DLL herr_t H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link); /* Shared object operators */ -H5_DLL void * H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, +H5_DLL void * H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type); -H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); -H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); +H5_DLL herr_t H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); +H5_DLL size_t H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); H5_DLL herr_t H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg); H5_DLL herr_t H5O__shared_link(H5F_t *f, H5O_t *open_oh, @@ -629,17 +622,18 @@ H5_DLL herr_t H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst, H5_DLL herr_t H5O__shared_post_copy_file (H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src, H5O_shared_t *shared_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info); -H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, +H5_DLL herr_t H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth); /* Attribute message operators */ H5_DLL herr_t H5O__attr_reset(void *_mesg); H5_DLL herr_t H5O__attr_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); H5_DLL herr_t H5O__attr_link(H5F_t *f, H5O_t *open_oh, void *_mesg); -H5_DLL herr_t H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs); +H5_DLL herr_t H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs); /* Arrays of versions for: - Object header, Attribute/Fill value/Filter pipeline messages */ + * Object header, Attribute/Fill value/Filter pipeline messages + */ /* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */ H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS]; H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS]; @@ -661,10 +655,9 @@ H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); /* Object header debugging routines */ #ifdef H5O_DEBUG -H5_DLL herr_t H5O_assert(const H5O_t *oh); +H5_DLL herr_t H5O__assert(const H5O_t *oh); #endif /* H5O_DEBUG */ -H5_DLL herr_t H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, - int indent, int fwidth); +H5_DLL herr_t H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* _H5Opkg_H */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 10063d5..4a401b5 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -866,10 +866,13 @@ H5_DLL herr_t H5O_init(void); H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc/*out*/); H5_DLL herr_t H5O_open(H5O_loc_t *loc); +H5_DLL hid_t H5O_open_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL hid_t H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr); +H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust); -H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, - hbool_t pin_all_chunks); +H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks); H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc); H5_DLL herr_t H5O_unpin(H5O_t *oh); H5_DLL herr_t H5O_dec_rc_by_loc(const H5O_loc_t *loc); @@ -900,10 +903,12 @@ H5_DLL herr_t H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg); H5_DLL herr_t H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg); +H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg); H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg); H5_DLL void *H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg); H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native); H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg); +H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg); H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst); H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id); H5_DLL htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id); @@ -937,6 +942,7 @@ H5_DLL herr_t H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id, H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags); /* Object metadata flush/refresh routines */ +H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc); H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr); @@ -948,6 +954,8 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type, H5O_copy_t *cpy_info); +H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name, + H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); /* Debugging routines */ H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidth); diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 328ba4b..4fc0488 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -69,6 +69,10 @@ /********************/ /* Local Prototypes */ /********************/ +static void *H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, + const H5O_shared_t *shared, const H5O_msg_class_t *type); +static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, + const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust); /*********************/ @@ -88,14 +92,14 @@ /*------------------------------------------------------------------------- - * Function: H5O_shared_read + * Function: H5O__shared_read * - * Purpose: Reads a message referred to by a shared message. + * Purpose: Reads a message referred to by a shared message. * - * Return: Success: Ptr to message in native format. The message - * should be freed by calling H5O_msg_reset(). + * Return: Success: Ptr to message in native format. The message + * should be freed by calling H5O_msg_reset(). * - * Failure: NULL + * Failure: NULL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -104,7 +108,7 @@ *------------------------------------------------------------------------- */ static void * -H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, +H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t *shared, const H5O_msg_class_t *type) { H5HF_t *fheap = NULL; @@ -112,7 +116,7 @@ H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, uint8_t mesg_buf[H5O_MESG_BUF_SIZE]; /* Buffer for deserializing messages */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -194,13 +198,13 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_read() */ +} /* end H5O__shared_read() */ /*------------------------------------------------------------------------- - * Function: H5O__shared_link_adj + * Function: H5O__shared_link_adj * - * Purpose: Changes the link count for the object referenced by a shared + * Purpose: Changes the link count for the object referenced by a shared * message. * * This function changes the object header link count and is @@ -209,8 +213,7 @@ done: * reference count is stored in the file-wide shared message * index and is changed in a different place in the code. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -294,11 +297,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_shared_decode + * Function: H5O__shared_decode * - * Purpose: Decodes a shared object message + * Purpose: Decodes a shared object message * - * Return: Non-negative on success/Negative on failure + * Return: Success: A buffer containing the decoded shared object + * Failure: NULL * * Programmer: Quincey Koziol * Monday, January 22, 2007 @@ -306,14 +310,14 @@ done: *------------------------------------------------------------------------- */ void * -H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, +H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type) { H5O_shared_t sh_mesg; /* Shared message info */ unsigned version; /* Shared message version */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -373,20 +377,20 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu sh_mesg.msg_type_id = type->id; /* Retrieve actual message, through decoded shared message info */ - if(NULL == (ret_value = H5O_shared_read(f, open_oh, ioflags, &sh_mesg, type))) + 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") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_decode() */ +} /* end H5O__shared_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_shared_encode + * Function: H5O__shared_encode * - * Purpose: Encodes message _MESG into buffer BUF. + * Purpose: Encodes message _MESG into buffer BUF. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, April 2, 1998 @@ -394,11 +398,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg) +H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg) { unsigned version; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -427,15 +431,15 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shared_encode() */ +} /* end H5O__shared_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_set_shared + * Function: H5O_set_shared * - * Purpose: Sets the shared component for a message. + * Purpose: Sets the shared component for a message. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -460,12 +464,12 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) /*------------------------------------------------------------------------- - * Function: H5O_shared_size + * Function: H5O__shared_size * - * Purpose: Returns the length of a shared object message. + * Purpose: Returns the length of a shared object message. * - * Return: Success: Length - * Failure: 0 + * Return: Success: Length + * Failure: 0 * * Programmer: Robb Matzke * Thursday, April 2, 1998 @@ -473,26 +477,26 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) *------------------------------------------------------------------------- */ size_t -H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) +H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) { - ret_value = (size_t)1 + /*version */ - (size_t)1 + /*the type field */ - (size_t)H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */ + ret_value = (size_t)1 + /* Version */ + (size_t)1 + /* Type field */ + (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */ } /* end if */ else { HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM); - ret_value = 1 + /*version */ - 1 + /*the type field */ - H5O_FHEAP_ID_LEN; /* Shared in the heap */ + ret_value = 1 + /* Version */ + 1 + /* Type field */ + H5O_FHEAP_ID_LEN; /* Shared in the heap */ } /* end else */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_size() */ +} /* end H5O__shared_size() */ /*------------------------------------------------------------------------- @@ -500,7 +504,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) * * Purpose: Free file space referenced by message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -521,7 +525,7 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, /* * Committed datatypes increment the OH of the original message when they - * are written (in H5O__shared_link) and decrement it here. + * are written (in H5O_shared_link) and decrement it here. * SOHMs in the heap behave differently; their refcount is incremented * during H5SM_share when they are going to be written (in H5O_msg_append * or H5O_msg_write). Their refcount in the SOHM indexes still needs to @@ -543,7 +547,7 @@ done: * Purpose: Increment reference count on any objects referenced by * message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -558,7 +562,7 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, FUNC_ENTER_PACKAGE - /* check args */ + /* Check args */ HDassert(f); HDassert(sh_mesg); @@ -576,8 +580,7 @@ done: * * Purpose: Copies a message from _MESG to _DEST in file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * January 22, 2007 @@ -647,7 +650,7 @@ done: * to complish that is to delete the old message and write the * new message with the correct values. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * xcao@hdfgroup.org @@ -696,7 +699,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_shared_debug + * Function: H5O__shared_debug * * Purpose: Prints debugging info for the message * @@ -708,9 +711,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) +H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(mesg); @@ -756,5 +759,5 @@ H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shared_debug() */ +} /* end H5O__shared_debug() */ diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 2960fef..8040a6a 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -66,7 +66,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, /* Check for shared message */ 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))) + 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") /* We currently do not support automatically fixing shared messages */ @@ -129,13 +129,13 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes /* 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") + if(H5O__shared_encode(f, p, sh_mesg) < 0) + 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: @@ -181,13 +181,13 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) /* Check for message stored elsewhere */ 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") + 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") } /* 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: @@ -232,13 +232,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 */ @@ -284,13 +284,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 */ @@ -473,7 +473,7 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, /* Check for message stored elsewhere */ if(H5O_IS_STORED_SHARED(sh_mesg->type)) { /* Print shared message information */ - if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0) + if(H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info") } /* end if */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 87fb771..0f14a4b 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -37,9 +37,9 @@ /* PRIVATE PROTOTYPES */ static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_stab_copy(const void *_mesg, void *_dest); -static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__stab_copy(const void *_mesg, void *_dest); +static size_t H5O__stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__stab_free(void *_mesg); static herr_t H5O__stab_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__stab_copy_file(H5F_t *file_src, void *native_src, @@ -58,9 +58,9 @@ const H5O_msg_class_t H5O_MSG_STAB[1] = {{ sizeof(H5O_stab_t), /*native message size */ 0, /* messages are sharable? */ H5O__stab_decode, /*decode message */ - H5O_stab_encode, /*encode message */ - H5O_stab_copy, /*copy the native value */ - H5O_stab_size, /*size of symbol table entry */ + H5O__stab_encode, /*encode message */ + H5O__stab_copy, /*copy the native value */ + H5O__stab_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__stab_free, /* free method */ H5O__stab_delete, /* file delete method */ @@ -111,7 +111,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* 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") H5F_addr_decode(f, &p, &(stab->btree_addr)); H5F_addr_decode(f, &p, &(stab->heap_addr)); @@ -129,7 +129,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_stab_encode + * Function: H5O__stab_encode * * Purpose: Encodes a symbol table message. * @@ -142,11 +142,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -158,11 +158,11 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con H5F_addr_encode(f, &p, stab->heap_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5O__stab_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_stab_copy + * Function: H5O__stab_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -178,18 +178,18 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *------------------------------------------------------------------------- */ static void * -H5O_stab_copy(const void *_mesg, void *_dest) +H5O__stab_copy(const void *_mesg, void *_dest) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; H5O_stab_t *dest = (H5O_stab_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(stab); if(!dest && NULL == (dest = 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"); /* copy */ *dest = *stab; @@ -199,11 +199,11 @@ H5O_stab_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_stab_copy() */ +} /* end H5O__stab_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_stab_size + * Function: H5O__stab_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -220,17 +220,17 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f)); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_stab_size() */ +} /* end H5O__stab_size() */ /*------------------------------------------------------------------------- @@ -327,14 +327,14 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, /* 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); /* 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 diff --git a/src/H5Otest.c b/src/H5Otest.c index 7cb7b3d..df08ff7 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -127,7 +127,7 @@ H5O__is_attr_dense_test(hid_t oid) /* Check if dense storage is being used */ if(H5F_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ - HDassert(H5O_msg_count_real(oh, H5O_MSG_ATTR) == 0); + HDassert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0); ret_value = TRUE; } /* end if */ @@ -197,7 +197,7 @@ H5O__is_attr_empty_test(hid_t oid) } /* end if */ /* Retrieve the number of attribute messages in header */ - nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); + nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR); /* Check for later version of object header format & attribute info available */ if(oh->version > H5O_VERSION_1) { @@ -299,7 +299,7 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) } /* end if */ /* Retrieve the number of attribute messages in header */ - obj_nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); + obj_nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR); /* Check for later version of object header format */ if(oh->version > H5O_VERSION_1) { diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index dbab28c..89c00ad 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -63,11 +63,11 @@ H5FL_DEFINE(H5O_unknown_t); /*------------------------------------------------------------------------- - * Function: H5O__unknown_free + * Function: H5O__unknown_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, May 1, 2007 diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err index 3a34314..a6aae76 100644 --- a/tools/test/h5dump/errfiles/tattr-3.err +++ b/tools/test/h5dump/errfiles/tattr-3.err @@ -1,5 +1,5 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Aopen(): unable to load attribute info from object header for attribute: 'attr' + #000: (file name) line (number) in H5Aopen(): unable to open attribute: 'attr' major: Attribute minor: Can't open object #001: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err index 06519fb..2c4f1ff 100644 --- a/tools/test/h5dump/errfiles/tqmarkfile.err +++ b/tools/test/h5dump/errfiles/tqmarkfile.err @@ -8,7 +8,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist @@ -24,7 +24,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist diff --git a/tools/testfiles/tstarfile.ddl b/tools/testfiles/tstarfile.ddl index 77b80e0..87c3f87 100644 --- a/tools/testfiles/tstarfile.ddl +++ b/tools/testfiles/tstarfile.ddl @@ -64,7 +64,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist @@ -80,7 +80,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist -- cgit v0.12 From 8d7bdb704163327cacf8be3a4e03f02fb88a957b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 14:38:46 -0500 Subject: CMake changes for SKIPPED and flush tests --- CMakeLists.txt | 3 ++ release_docs/INSTALL_CMake.txt | 1 + test/CMakeLists.txt | 2 +- test/CMakeTests.cmake | 66 ++++++++++++++++++++++++++++------- tools/src/h5dump/h5dump.c | 2 +- tools/test/h5copy/CMakeTests.cmake | 3 +- tools/test/h5dump/CMakeTests.cmake | 3 +- tools/test/h5dump/CMakeTestsXML.cmake | 3 +- tools/test/h5import/CMakeTests.cmake | 3 +- tools/test/h5repack/CMakeTests.cmake | 24 ++++++++----- 10 files changed, 84 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f87568..53cddf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,9 @@ endif () # dependencies of the HDF5 libs may be 'incomplete', add additional # dependencies to this variable so that external projects pick them up # +#option (HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "") +set (HDF5_EXTERNAL_LIB_PREFIX "" CACHE STRING "Use prefix for custom library naming.") +mark_as_advanced (HDF5_EXTERNAL_LIB_PREFIX) # HDF5_EXTERNAL_LIB_PREFIX : # If the parent project needs to install hdf libraries, but avoid # name conflicts with system versions, then a prefix may be added diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 1d6797c..2aa1f17 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -591,6 +591,7 @@ HDF5_BUILD_TOOLS "Build HDF5 Tools" ON ---------------- HDF5 Advanced Options --------------------- ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF +HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "" HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 517a620..c8119fe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -224,7 +224,7 @@ set (H5_TESTS ntypes dangle dtransform - reserved + # reserved disabled cross_read freespace mf diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index cc6ebb8..8838c34 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -439,14 +439,6 @@ set (test_CLEANFILES tvlstr.h5 tvlstr2.h5 twriteorder.dat - flush.h5 - flush-swmr.h5 - noflush.h5 - noflush-swmr.h5 - flush_extend.h5 - flush_extend-swmr.h5 - noflush_extend.h5 - noflush_extend-swmr.h5 enum1.h5 titerate.h5 ttsafe.h5 @@ -551,6 +543,8 @@ set (H5TEST_SEPARATE_TESTS testhdf5 cache cache_image + flush1 + flush2 ) foreach (test ${H5_TESTS}) if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) @@ -587,7 +581,6 @@ foreach (test ${H5_TESTS}) endif () endforeach () -set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800) @@ -630,7 +623,6 @@ if (BUILD_SHARED_LIBS) endif () endforeach () - set_tests_properties (H5TEST-shared-flush2 PROPERTIES DEPENDS H5TEST-shared-flush1) set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800) @@ -720,6 +712,54 @@ if (BUILD_SHARED_LIBS) endif () endif () +#-- Adding test for flush1/2 +add_test (NAME H5TEST-clear-flush-objects + COMMAND ${CMAKE_COMMAND} + -E remove + flush.h5 + flush-swmr.h5 + noflush.h5 + noflush-swmr.h5 + flush_extend.h5 + flush_extend-swmr.h5 + noflush_extend.h5 + noflush_extend-swmr.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-flush1 COMMAND $) +else () + add_test (NAME H5TEST-flush1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=flush1.txt" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-flush1 PROPERTIES + DEPENDS H5TEST-clear-flush-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-flush2 COMMAND $) +else () + add_test (NAME H5TEST-flush2 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=flush2.txt" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) + #-- Adding test for tcheck_version add_test (NAME H5TEST-tcheck_version-major COMMAND $ "-tM") set_tests_properties (H5TEST-tcheck_version-major PROPERTIES @@ -826,9 +866,10 @@ add_test (NAME H5TEST-clear-error_test-objects set_tests_properties (H5TEST-clear-error_test-objects PROPERTIES FIXTURES_SETUP error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( - NAME H5TEST-error_test-SKIPPED + NAME H5TEST-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" ) + set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -925,9 +966,10 @@ if (BUILD_SHARED_LIBS) set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( - NAME H5TEST-shared-error_test-SKIPPED + NAME H5TEST-shared-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" ) + set_property(TEST H5TEST-shared-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index a5f0369..b9e37e8 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -65,7 +65,7 @@ struct handler_t { * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -/* The following initialization makes use of C language cancatenating */ +/* The following initialization makes use of C language concatenating */ /* "xxx" "yyy" into "xxxyyy". */ static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:"; static struct long_options l_opts[] = { diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 1bdefa6..924ade1 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -128,9 +128,10 @@ macro (ADD_SKIP_H5_TEST testname skipresultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5COPY-${testname}-${skipresultfile}-SKIPPED + NAME H5COPY-${testname}-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname}-${skipresultfile} ${ARGN}" ) + set_property(TEST H5COPY-${testname}-${skipresultfile} PROPERTY DISABLED) endif () endmacro () diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 24588e9..eedb432 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -441,9 +441,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${skipresultfile}-SKIPPED + NAME H5DUMP-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}" ) + set_property(TEST H5DUMP-${skipresultfile} PROPERTY DISABLED) endif () else () ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index 9c68e5f..de87d2f 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -164,9 +164,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP_XML-${skipresultfile}-SKIPPED + NAME H5DUMP_XML-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}" ) + set_property(TEST H5DUMP_XML-${skipresultfile} PROPERTY DISABLED) endif () else () ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 3c65b0b..7d76fba 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -283,9 +283,10 @@ macro (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5IMPORT-DUMP-${testname}-SKIPPED + NAME H5IMPORT-DUMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" ) + set_property(TEST H5IMPORT-DUMP-${testname} PROPERTY DISABLED) endif () endmacro () diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index f40c0b1..a063e19 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -229,9 +229,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_OLD-${testname}-SKIPPED + NAME H5REPACK_OLD-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) + set_property(TEST H5REPACK_OLD-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -260,9 +261,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK-${testname}-SKIPPED + NAME H5REPACK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) + set_property(TEST H5REPACK-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -291,9 +293,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_CMP-${testname}-SKIPPED + NAME H5REPACK_CMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_CMP-${testname} PROPERTY DISABLED) endif () else () # If using memchecker add tests without using scripts @@ -338,9 +341,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_MASK-${testname}-SKIPPED + NAME H5REPACK_MASK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_MASK-${testname} PROPERTY DISABLED) endif () else () # If using memchecker add tests without using scripts @@ -385,9 +389,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_DMP-${testname}-SKIPPED + NAME H5REPACK_DMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_DMP-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -427,9 +432,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_STAT-${testname}-SKIPPED + NAME H5REPACK_STAT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}" ) + set_property(TEST H5REPACK_STAT-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -469,9 +475,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED + NAME H5REPACK_VERIFY_LAYOUT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_VERIFY_LAYOUT-${testname} PROPERTY DISABLED) endif () else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -542,9 +549,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-SKIPPED + NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTY DISABLED) endif () else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) -- cgit v0.12 From a8f46df2c29f73947d1ab342d53c5f1e42fbbefe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 15:29:26 -0500 Subject: Remove libsettings from pregenerated block --- src/CMakeLists.txt | 67 ++++++++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e90e580..7bf976d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -907,46 +907,33 @@ else () endif () endif () -if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) - add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) - target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) - TARGET_C_PROPERTIES (H5make_libsettings STATIC) - target_link_libraries (H5make_libsettings - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> - INTERFACE $<$:"-O0"> - ) - - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - if (BUILD_SHARED_LIBS) - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - else () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) - endif () - endif () -else () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) - if (BUILD_SHARED_LIBS) +add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) +target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) +TARGET_C_PROPERTIES (H5make_libsettings STATIC) +target_link_libraries (H5make_libsettings + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> +) + +add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_BINARY_DIR} +) +if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c" - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + else () + set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () endif () @@ -957,7 +944,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- -set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) +set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} @@ -985,7 +972,7 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} -- cgit v0.12 From 9045cf049f74e017e20ed366d9a811a7902cf8ff Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 15:31:39 -0500 Subject: Remove extra unneeded --- src/CMakeLists.txt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7bf976d..d16adf8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -924,17 +924,13 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) if (BUILD_SHARED_LIBS) - if (NOT EXISTS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} - ) - else () - set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) - endif () + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_BINARY_DIR} + ) endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -- cgit v0.12 From ed6cfe8ee6c09ac38cd6905a79cc9a5d36e779cd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 16:18:26 -0500 Subject: HDFFV-10531 document option for external libs --- release_docs/INSTALL_CMake.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 2aa1f17..7352dae 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -275,9 +275,14 @@ IV. Further considerations packages there. Add the following CMake options: -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include + -DZLIB_USE_EXTERNAL:BOOL=OFF -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include + -DSZIP_USE_EXTERNAL:BOOL=OFF where "some_location" is the full path to the extlibs folder. + Also the appropriate environment variable must be set; + set(ENV{ZLIB_ROOT} "some_location") + set(ENV{SZIP_ROOT} "some_location") B. Use source packages from an GIT server by adding the following CMake options: -- cgit v0.12