diff options
327 files changed, 12320 insertions, 16157 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2c31664..7d7bcdd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -11,11 +11,11 @@ CMakeLists.txt @byrnHDF @derobins CMakeTests.* @byrnHDF @derobins -/bin/ @lrknox @derobins @qkoziol +/bin/ @lrknox @derobins /c++/ @bmribler @byrnHDF -/config/ @lrknox @derobins @qkoziol @byrnHDF +/config/ @lrknox @derobins @byrnHDF /doc/ @gnuoyd @jrmainzer @@ -29,11 +29,11 @@ CMakeTests.* @byrnHDF @derobins /release_docs/ @lrknox @bljhdf @byrnHDF -/src/ @jhendersonHDF @derobins @fortnern @qkoziol @soumagne @vchoi-hdfgroup @jrmainzer +/src/ @jhendersonHDF @derobins @fortnern @soumagne @vchoi-hdfgroup @jrmainzer -/test/ @jhendersonHDF @derobins @fortnern @qkoziol @soumagne @vchoi-hdfgroup @jrmainzer +/test/ @jhendersonHDF @derobins @fortnern @soumagne @vchoi-hdfgroup @jrmainzer -/testpar/ @jhendersonHDF @rawarren @jrmainzer @qkoziol +/testpar/ @jhendersonHDF @rawarren @jrmainzer /tools/ @byrnHDF @bmribler diff --git a/bin/test-driver b/bin/test-driver index d306056..d306056 100644..100755 --- a/bin/test-driver +++ b/bin/test-driver diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index e3bfb77..7ba359a 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -204,7 +204,7 @@ endif () #set (LOCAL_NO_PACKAGE "TRUE") ##### Following controls source update ##### #set (LOCAL_UPDATE "TRUE") -set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") +set (REPOSITORY_URL "https://github.com/HDFGroup/hdf5.git") set (REPOSITORY_BRANCH "hdf5_1_8") #uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index dbb81a4..ee3f210 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -55,7 +55,9 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") ### ext libs on system #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=NO") +#set(ENV{ZLIB_ROOT} "some_location") #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") +#set(ENV{SZIP_ROOT} "some_location") #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") ### disable using ext zlib diff --git a/m4/libtool.m4 b/m4/libtool.m4 index a3bc337..a644432 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -2867,6 +2867,9 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command @@ -2875,7 +2878,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 index a14cd24..48bc934 100644 --- a/m4/ltsugar.m4 +++ b/m4/ltsugar.m4 @@ -1,14 +1,3 @@ -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software diff --git a/release_docs/README_HPC b/release_docs/README_HPC index 97f088c..bd16376 100644 --- a/release_docs/README_HPC +++ b/release_docs/README_HPC @@ -1,6 +1,6 @@ ************************************************************************ * Using CMake to build and test HDF5 source on HPC machines * -************************************************************************ +************************************************************************ Contents @@ -16,34 +16,34 @@ Section VI: Other cross compiling options ======================================================================== I. Prerequisites ======================================================================== - 1. Create a working directory that is accessible from the compute nodes for + 1. Create a working directory that is accessible from the compute nodes for running tests; the working directory should be in a scratch space or a parallel file system space since testing will use this space. Building - from HDF5 source in a 'home' directory typically results in test + from HDF5 source in a 'home' directory typically results in test failures and should be avoided. - - 2. Load modules for desired compilers, module for cmake version 3.10 or greater, + + 2. Load modules for desired compilers, module for cmake version 3.12 or greater, and set any needed environment variables for compilers (i.e., CC, FC, CXX). Unload any problematic modules (i.e., craype-hugepages2M). ======================================================================== II. Obtain HDF5 source ======================================================================== -Obtain HDF5 source code from the HDF5 repository using a git command or +Obtain HDF5 source code from the HDF5 repository using a git command or from a release tar file in a working directory: - git clone https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git + git clone https://github.com/HDFGroup/hdf5.git [-b branch] [source directory] If no branch is specified, then the 'develop' version will be checked out. -If no source directory is specified, then the source will be located in the -'hdf5' directory. The Cmake scripts expect the source to be in a directory +If no source directory is specified, then the source will be located in the +'hdf5' directory. The CMake scripts expect the source to be in a directory named hdf5-<version string>, where 'version string' uses the format '1.xx.xx'. -For example, for the current 'develop' version, the "hdf5" directory should -be renamed "hdf5-1.8.22", or for the first hdf5_1_8_22 pre-release version, +For example, for the current 'develop' version, the "hdf5" directory should +be renamed "hdf5-1.8.22", or for the first hdf5_1_8_22 pre-release version, it should be renamed "hdf5-1.8.22-pre1". -If the version number is not known a priori, the version string +If the version number is not known a priori, the version string can be obtained by running bin/h5vers in the top level directory of the source clone, and the source directory renamed 'hdf5-<version string>'. @@ -57,23 +57,23 @@ The ctest command [1]: ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log -will configure, build, test and package HDF5 from the downloaded source +will configure, build, test and package HDF5 from the downloaded source after the setup steps outlined below are followed. -CMake option variables are available to allow running test programs in batch -scripts on compute nodes and to cross-compile for compute node hardware using +CMake option variables are available to allow running test programs in batch +scripts on compute nodes and to cross-compile for compute node hardware using a cross-compiling emulator. The setup steps will make default settings for -parallel or serial only builds available to the CMake command. +parallel or serial only builds available to the CMake command. - 1. For the current 'develop' version the "hdf5" directory should be renamed + 1. For the current 'develop' version the "hdf5" directory should be renamed "hdf5-1.8.22". 2. Three cmake script files need to be copied to the working directory, or have symbolic links to them, created in the working directory: - + hdf5-1.8.22/config/cmake/scripts/HDF5config.cmake hdf5-1.8.22/config/cmake/scripts/CTestScript.cmake - hdf5-1.8.22/config/cmake/scripts/HDF5options.cmake + hdf5-1.8.22/config/cmake/scripts/HDF5options.cmake should be copied to the working directory. @@ -84,14 +84,14 @@ parallel or serial only builds available to the CMake command. HDF5options.cmake hdf5-1.8.22 - Additionally, when the ctest command runs [1], it will add a build directory + Additionally, when the ctest command runs [1], it will add a build directory in the working directory. 4. The following options (among others) can be added to the ctest command [1], following '-S HDF5config.cmake,' and separated by ',': HPC=sbatch (or 'bsub' or 'raybsub') indicates which type of batch - files to use for running tests. If omitted, test + files to use for running tests. If omitted, test will run on the local machine or login node. KNL=true to cross-compile for KNL compute nodes on CrayXC40 @@ -104,27 +104,27 @@ parallel or serial only builds available to the CMake command. The HPC options will add BUILD_GENERATOR=Unix for the three HPC options. An example ctest command for a parallel build on a system using sbatch is - + ctest -S HDF5config.cmake,HPC=sbatch,MPI=true -C Release -V -O hdf5.log - Adding the option 'KNL=true' to the above list will compile for KNL nodes, + Adding the option 'KNL=true' to the above list will compile for KNL nodes, for example, on 'mutrino' and other CrayXC40 machines. - Changing -V to -VV will produce more logging information in HDF5.log. + Changing -V to -VV will produce more logging information in HDF5.log. - More detailed CMake information can be found in the HDF5 source in + More detailed CMake information can be found in the HDF5 source in release_docs/INSTALL_CMake.txt. ======================================================================== IV. Cross-compiling ======================================================================== -For cross-compiling on Cray, set environment variables CC=cc, FC=ftn +For cross-compiling on Cray, set environment variables CC=cc, FC=ftn and CXX=CC (for c++) after all compiler modules are loaded since switching compiler modules may unset or reset these variables. -CMake provides options for cross-compiling. To cross-compile for KNL hardware -on mutrino and other CrayXC40 machines, add HPC=sbatch,KNL=true to the -ctest command line. This will set the following options from the +CMake provides options for cross-compiling. To cross-compile for KNL hardware +on mutrino and other CrayXC40 machines, add HPC=sbatch,KNL=true to the +ctest command line. This will set the following options from the config/cmake/scripts/HPC/sbatch-HDF5options.cmake file: set (COMPILENODE_HWCOMPILE_MODULE "craype-haswell") @@ -133,74 +133,74 @@ config/cmake/scripts/HPC/sbatch-HDF5options.cmake file: set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "knl_ctestP.sl") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake") -On the Cray XC40 the craype-haswell module is needed for configuring, and the +On the Cray XC40 the craype-haswell module is needed for configuring, and the craype-mic-knl module is needed for building to run on the KNL nodes. CMake -with the above options will swap modules after configuring is complete, +with the above options will swap modules after configuring is complete, but before compiling programs for KNL. The sbatch script arguments for running jobs on KNL nodes may differ on CrayXC40 -machines other than mutrino. The batch scripts knl_ctestS.sl and knl_ctestP.sl -have the correct arguments for mutrino: "#SBATCH -p knl -C quad,cache". For -cori, another CrayXC40, that line is replaced by "#SBATCH -C knl,quad,cache". -For cori (and other machines), the values in LOCAL_BATCH_SCRIPT_NAME and -LOCAL_BATCH_SCRIPT_PARALLEL_NAME in the config/cmake/scripts/HPC/sbatch-HDF5options.cmake -file can be replaced by cori_knl_ctestS.sl and cori_knl_ctestS.sl, or the lines +machines other than mutrino. The batch scripts knl_ctestS.sl and knl_ctestP.sl +have the correct arguments for mutrino: "#SBATCH -p knl -C quad,cache". For +cori, another CrayXC40, that line is replaced by "#SBATCH -C knl,quad,cache". +For cori (and other machines), the values in LOCAL_BATCH_SCRIPT_NAME and +LOCAL_BATCH_SCRIPT_PARALLEL_NAME in the config/cmake/scripts/HPC/sbatch-HDF5options.cmake +file can be replaced by cori_knl_ctestS.sl and cori_knl_ctestS.sl, or the lines can be edited in the batch files in hdf5-1.8.22/bin/batch. ======================================================================== V. Manual alternatives ======================================================================== -If using ctest is undesirable, one can create a build directory and run the cmake +If using ctest is undesirable, one can create a build directory and run the cmake configure command, for example -"/projects/Mutrino/hpcsoft/cle6.0/common/cmake/3.10.2/bin/cmake" --C "<working directory>/hdf5-1.8.22/config/cmake/cacheinit.cmake" --DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_BUILD_FORTRAN:BOOL=ON --DHDF5_BUILD_JAVA:BOOL=OFF --DCMAKE_INSTALL_PREFIX:PATH=<working directory>/HDF_Group/HDF5/1.8.22 --DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF --DHDF5_ENABLE_PARALLEL:BOOL=ON -DHDF5_BUILD_CPP_LIB:BOOL=OFF --DHDF5_ENABLE_THREADSAFE:BOOL=OFF --DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DLOCAL_BATCH_TEST:BOOL=ON --DMPIEXEC_EXECUTABLE:STRING=srun -DMPIEXEC_NUMPROC_FLAG:STRING=-n --DMPIEXEC_MAX_NUMPROCS:STRING=6 --DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake --DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl --DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=knl_ctestP.sl -DSITE:STRING=mutrino --DBUILDNAME:STRING=par-knl_GCC493-SHARED-Linux-4.4.156-94.61.1.16335.0.PTF.1107299-default-x86_64 +"/projects/Mutrino/hpcsoft/cle6.0/common/cmake/3.12/bin/cmake" +-C "<working directory>/hdf5-1.8.22/config/cmake/cacheinit.cmake" +-DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_BUILD_FORTRAN:BOOL=ON +-DHDF5_BUILD_JAVA:BOOL=OFF +-DCMAKE_INSTALL_PREFIX:PATH=<working directory>/HDF_Group/HDF5/1.8.22 +-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF +-DHDF5_ENABLE_PARALLEL:BOOL=ON -DHDF5_BUILD_CPP_LIB:BOOL=OFF +-DHDF5_ENABLE_THREADSAFE:BOOL=OFF +-DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DLOCAL_BATCH_TEST:BOOL=ON +-DMPIEXEC_EXECUTABLE:STRING=srun -DMPIEXEC_NUMPROC_FLAG:STRING=-n +-DMPIEXEC_MAX_NUMPROCS:STRING=6 +-DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake +-DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl +-DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=knl_ctestP.sl -DSITE:STRING=mutrino +-DBUILDNAME:STRING=par-knl_GCC493-SHARED-Linux-4.4.156-94.61.1.16335.0.PTF.1107299-default-x86_64 "-GUnix Makefiles" "" "<working directory>/hdf5-1.8.22" followed by make and batch jobs to run tests. -To cross-compile on CrayXC40, run the configure command with the craype-haswell +To cross-compile on CrayXC40, run the configure command with the craype-haswell module loaded, then switch to the craype-mic-knl module for the build process. -Tests on machines using slurm can be run with +Tests on machines using slurm can be run with -"sbatch -p knl -C quad,cache ctestS.sl" +"sbatch -p knl -C quad,cache ctestS.sl" -or +or -"sbatch -p knl -C quad,cache ctestP.sl" +"sbatch -p knl -C quad,cache ctestP.sl" for parallel builds. - + Tests on machines using LSF will typically use "bsub ctestS.lsf", etc. ======================================================================== VI. Other cross compiling options ======================================================================== -Settings for two other cross-compiling options are also in the config/toolchain +Settings for two other cross-compiling options are also in the config/toolchain files which do not seem to be necessary with the Cray PrgEnv-* modules -1. HDF5_USE_PREGEN. This option, along with the HDF5_USE_PREGEN_DIR CMake - variable would allow the use of an appropriate H5Tinit.c file with type - information generated on a compute node to be used when cross compiling - for those compute nodes. The use of the variables in lines 110 and 111 - of HDF5options.cmake file seem to preclude needing this option with the - available Cray modules and CMake option. - -2. HDF5_BATCH_H5DETECT and associated CMake variables. This option when - properly configured will run H5detect in a batch job on a compute node - at the beginning of the CMake build process. It was also found to be - unnecessary with the available Cray modules and CMake options. +1. HDF5_USE_PREGEN. This option, along with the HDF5_USE_PREGEN_DIR CMake + variable would allow the use of an appropriate H5Tinit.c file with type + information generated on a compute node to be used when cross compiling + for those compute nodes. The use of the variables in lines 110 and 111 + of HDF5options.cmake file seem to preclude needing this option with the + available Cray modules and CMake option. + +2. HDF5_BATCH_H5DETECT and associated CMake variables. This option when + properly configured will run H5detect in a batch job on a compute node + at the beginning of the CMake build process. It was also found to be + unnecessary with the available Cray modules and CMake options. @@ -71,7 +71,7 @@ hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */ char H5_lib_vers_info_g[] = H5_VERS_INFO; static hbool_t H5_dont_atexit_g = FALSE; -H5_debug_t H5_debug_g; /*debugging info */ +H5_debug_t H5_debug_g; /* debugging info */ /*******************/ /* Local Variables */ @@ -223,11 +223,6 @@ done: * * Return: void * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -264,6 +259,7 @@ H5_term_library(void) do { pending = 0; + /* Try to organize these so the "higher" level components get shut * down before "lower" level components that they might rely on. -QAK */ @@ -739,7 +735,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); if (*substr) { - HDstrncat(lib_str, "-", 1); + HDstrncat(lib_str, "-", (size_t)1); HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1); } /* end if */ if (HDstrcmp(lib_str, H5_lib_vers_info_g)) { @@ -782,6 +778,7 @@ H5open(void) FUNC_ENTER_API_NOCLEAR(FAIL) H5TRACE0("e", ""); /* all work is done by FUNC_ENTER() */ + done: FUNC_LEAVE_API(ret_value) } /* end H5open() */ @@ -954,6 +951,9 @@ H5is_library_threadsafe(hbool_t *is_ts) * NOTE: The main purpose of this is for handling Win32 thread cleanup * on thread/process detach. * + * Only enabled when the shared Windows library is built with + * thread safety enabled. + * * Return: TRUE on success, FALSE on failure * *------------------------------------------------------------------------- @@ -186,72 +186,78 @@ H5A_term_interface(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. - ---------------------------------------------------------------------------*/ -/* ARGSUSED */ + * 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 H5_ATTR_UNUSED aapl_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 */ + 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 = 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") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "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_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") /* Go do the real work for attaching the attribute to the dataset */ if (NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, H5AC_dxpl_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") + if (H5I_INVALID_HID == ret_value) + if (attr && H5A_close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate2() */ @@ -273,7 +279,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 @@ -286,39 +292,38 @@ done: develop. --------------------------------------------------------------------------*/ -/* ARGSUSED */ hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) { - H5A_t * attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - 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 'obj_name' found */ - H5T_t * type; /* Datatype to use for attribute */ - H5S_t * space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ - - FUNC_ENTER_API(FAIL) + H5A_t * attr = NULL; /* Attribute created */ + H5G_loc_t loc; /* Object location */ + 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 'obj_name' found */ + H5T_t * type; /* Datatype to use for attribute */ + H5S_t * space; /* Dataspace to use for attribute */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + 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") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -327,22 +332,23 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid /* Find the object's location */ if (H5G_loc_find(&loc, obj_name, &obj_loc /*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, H5I_INVALID_HID, "object not found") loc_found = TRUE; /* Go do the real work for attaching the attribute to the dataset */ if (NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_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: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - if (ret_value < 0 && attr && H5A_close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") + if (H5I_INVALID_HID == ret_value) + if (attr && H5A_close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate_by_name() */ @@ -358,7 +364,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 @@ -369,39 +375,41 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t * attr = NULL; /* Attribute opened */ - hid_t ret_value; + H5G_loc_t loc; /* Object location */ + H5A_t * attr = NULL; /* Attribute opened */ + 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") /* Read in attribute from object header */ if (NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, H5AC_ind_dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to load attribute info from object header for attribute: '%s'", attr_name) /* Finish initializing attribute */ if (H5A_open_common(&loc, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to initialize 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_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") 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_CANTFREE, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen() */ @@ -779,20 +787,20 @@ 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; + 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") + 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 */ + /* Get the attribute name */ if (0 > (ret_value = H5A_get_name(my_attr, buf_size, buf))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: FUNC_LEAVE_API(ret_value) @@ -984,7 +992,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: - /* Cleanup on failure */ + /* Release resources */ if (attr && H5A_close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") @@ -1051,12 +1059,12 @@ done: } /* end H5Aget_info_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5Arename + * Function: H5Arename * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Raymond Lu * October 23, 2002 @@ -1071,7 +1079,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", loc_id, old_name, new_name); - /* check arguments */ + /* Check arguments */ if (!old_name || !new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil") if (H5I_ATTR == H5I_get_type(loc_id)) @@ -1082,7 +1090,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *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") /* Call private attribute rename routine */ if (H5O_attr_rename(loc.oloc, H5AC_dxpl_id, old_name, new_name) < 0) @@ -1094,12 +1102,12 @@ done: } /* H5Arename() */ /*------------------------------------------------------------------------- - * Function: H5Arename_by_name + * Function: H5Arename_by_name * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * February 20, 2007 @@ -1136,7 +1144,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, if (H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - /* Call private attribute rename routine */ + /* Rename the attribute */ if (H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1285,7 +1293,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, op_data, 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") if (H5G_loc(loc_id, &loc) < 0) @@ -1364,7 +1372,7 @@ H5Adelete(hid_t loc_id, const char *name) 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") if (H5G_loc(loc_id, &loc) < 0) @@ -1409,7 +1417,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid 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") if (H5G_loc(loc_id, &loc) < 0) @@ -1544,7 +1552,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") @@ -1579,7 +1587,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) FUNC_ENTER_API(FAIL) H5TRACE2("t", "i*s", obj_id, attr_name); - /* check arguments */ + /* 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) @@ -15,7 +15,7 @@ * * Created: H5AC.c * Jul 9 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Functions in this file implement a cache for * things which exist on disk. All "things" associated @@ -175,7 +175,7 @@ static herr_t H5AC_run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op); * * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 18, 2003 * *------------------------------------------------------------------------- @@ -195,11 +195,11 @@ done: /*------------------------------------------------------------------------- * Function: H5AC_init_interface * - * Purpose: Initialize interface-specific information + * Purpose: Initialize interface-specific information * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 18, 2002 * *------------------------------------------------------------------------- @@ -272,7 +272,7 @@ done: * * Failure: Negative. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 18, 2002 * *------------------------------------------------------------------------- @@ -350,7 +350,6 @@ static const char *H5AC_entry_type_names[H5AC_NTYPES] = { * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -366,12 +365,14 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) FUNC_ENTER_NOAPI(FAIL) + /* Check arguments */ HDassert(f); HDassert(NULL == f->shared->cache); HDassert(config_ptr != NULL); HDcompile_assert(NELMTS(H5AC_entry_type_names) == H5AC_NTYPES); HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES); + /* Validate configurations */ if (H5AC_validate_config(config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration") @@ -391,7 +392,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi size") if (NULL == (aux_ptr = H5FL_CALLOC(H5AC_aux_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxiliary structure.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxiliary structure") aux_ptr->magic = H5AC__H5AC_AUX_T_MAGIC; aux_ptr->mpi_comm = mpi_comm; @@ -423,10 +424,10 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) if (mpi_rank == 0) { if (NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create dirtied entry list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create dirtied entry list") if (NULL == (aux_ptr->c_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cleaned entry list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cleaned entry list") } /* end if */ /* construct the candidate slist for all processes. @@ -434,7 +435,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) * will use it in the case of a flush. */ if (NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list") if (aux_ptr != NULL) { if (aux_ptr->mpi_rank == 0) { @@ -488,13 +489,10 @@ done: if (aux_ptr != NULL) { if (aux_ptr->d_slist_ptr != NULL) H5SL_close(aux_ptr->d_slist_ptr); - if (aux_ptr->c_slist_ptr != NULL) H5SL_close(aux_ptr->c_slist_ptr); - if (aux_ptr->candidate_slist_ptr != NULL) H5SL_close(aux_ptr->candidate_slist_ptr); - aux_ptr->magic = 0; aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); } /* end if */ @@ -514,7 +512,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -569,6 +566,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) H5SL_close(aux_ptr->candidate_slist_ptr); aux_ptr->magic = 0; aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); + } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -649,19 +647,18 @@ done: /*------------------------------------------------------------------------- * Function: H5AC_flush * - * Purpose: Flush (and possibly destroy) the metadata cache associated - * with the specified file. + * Purpose: Flush (and possibly destroy) the metadata cache associated + * with the specified file. * - * If the cache contains protected entries, the function will - * fail, as protected entries cannot be flushed. However - * all unprotected entries should be flushed before the - * function returns failure. + * If the cache contains protected entries, the function will + * fail, as protected entries cannot be flushed. However + * all unprotected entries should be flushed before the + * function returns failure. * * Return: Non-negative on success/Negative on failure if there was a * request to flush all items and something was protected. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -713,15 +710,15 @@ done: * Function: H5AC_get_entry_status * * Purpose: Given a file address, determine whether the metadata - * cache contains an entry at that location. If it does, - * also determine whether the entry is dirty, protected, - * pinned, etc. and return that information to the caller - * in *status_ptr. + * cache contains an entry at that location. If it does, + * also determine whether the entry is dirty, protected, + * pinned, etc. and return that information to the caller + * in *status. * - * If the specified entry doesn't exist, set *status_ptr - * to zero. + * If the specified entry doesn't exist, set *status_ptr + * to zero. * - * On error, the value of *status_ptr is undefined. + * On error, the value of *status is undefined. * * Return: Non-negative on success/Negative on failure * @@ -775,7 +772,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -862,8 +858,8 @@ done: /*------------------------------------------------------------------------- * Function: H5AC_mark_entry_dirty * - * Purpose: Mark a pinned or protected entry as dirty. The target - * entry MUST be either pinned, protected, or both. + * Purpose: Mark a pinned or protected entry as dirty. The target + * entry MUST be either pinned, protected, or both. * * Return: Non-negative on success/Negative on failure * @@ -932,7 +928,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -1002,7 +997,7 @@ done: /*------------------------------------------------------------------------- * Function: H5AC_pin_protected_entry() * - * Purpose: Pin a protected cache entry. The entry must be protected + * Purpose: Pin a protected cache entry. The entry must be protected * at the time of call, and must be unpinned. * * Return: Non-negative on success/Negative on failure @@ -1304,7 +1299,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Sep 2 1997 * *------------------------------------------------------------------------- @@ -1628,9 +1622,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t * #endif /* H5_HAVE_PARALLEL */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_get_cache_auto_resize_config() */ /*------------------------------------------------------------------------- @@ -1663,9 +1655,7 @@ H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_s } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_get_cache_size() */ /*------------------------------------------------------------------------- @@ -1722,9 +1712,7 @@ H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr) } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_reset_cache_hit_rate_stats() */ /*------------------------------------------------------------------------- @@ -1868,16 +1856,16 @@ done: * Function: H5AC_validate_config() * * Purpose: Run a sanity check on the contents of the supplied - * instance of H5AC_cache_config_t. + * instance of H5AC_cache_config_t. * * Do nothing and return SUCCEED if no errors are detected, * and flag an error and return FAIL otherwise. * - * At present, this function operates by packing the data - * from the instance of H5AC_cache_config_t into an instance - * of H5C_auto_size_ctl_t, and then calling - * H5C_validate_resize_config(). As H5AC_cache_config_t and - * H5C_auto_size_ctl_t diverge, we may have to change this. + * At present, this function operates by packing the data + * from the instance of H5AC_cache_config_t into an instance + * of H5C_auto_size_ctl_t, and then calling + * H5C_validate_resize_config(). As H5AC_cache_config_t and + * H5C_auto_size_ctl_t diverge, we may have to change this. * * Return: Non-negative on success/Negative on failure * @@ -2476,13 +2464,13 @@ done: * Function: H5AC_check_if_write_permitted * * Purpose: Determine if a write is permitted under the current - * circumstances, and set *write_permitted_ptr accordingly. - * As a general rule it is, but when we are running in parallel - * mode with collective I/O, we must ensure that a read cannot - * cause a write. + * circumstances, and set *write_permitted_ptr accordingly. + * As a general rule it is, but when we are running in parallel + * mode with collective I/O, we must ensure that a read cannot + * cause a write. * - * In the event of failure, the value of *write_permitted_ptr - * is undefined. + * In the event of failure, the value of *write_permitted_ptr + * is undefined. * * Return: Non-negative on success/Negative on failure. * @@ -2747,12 +2735,12 @@ done: * Function: H5AC_ext_config_2_int_config() * * Purpose: Utility function to translate an instance of - * H5AC_cache_config_t to an instance of H5C_auto_size_ctl_t. + * H5AC_cache_config_t to an instance of H5C_auto_size_ctl_t. * - * Places translation in *int_conf_ptr and returns SUCCEED - * if successful. Returns FAIL on failure. + * Places translation in *int_conf_ptr and returns SUCCEED + * if successful. Returns FAIL on failure. * - * Does only minimal sanity checking. + * Does only minimal sanity checking. * * Return: Non-negative on success/Negative on failure * diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index aac4209..4f65a3d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5ACprivate.h + * Created: H5ACprivate.h * Jul 9 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * - * Purpose: Constants and typedefs available to the rest of the + * Purpose: Constants and typedefs available to the rest of the * library. * *------------------------------------------------------------------------- @@ -196,27 +196,27 @@ extern hid_t H5AC_ind_dxpl_id; /* hbool_t evictions_enabled = */ TRUE, \ /* hbool_t set_initial_size = */ TRUE, \ /* size_t initial_size = */ ( 2 * 1024 * 1024), \ - /* double min_clean_fraction = */ 0.3, \ + /* double min_clean_fraction = */ 0.3f, \ /* size_t max_size = */ (32 * 1024 * 1024), \ /* size_t min_size = */ (1 * 1024 * 1024), \ /* long int epoch_length = */ 50000, \ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \ - /* double lower_hr_threshold = */ 0.9F, \ - /* double increment = */ 2.0F, \ + /* double lower_hr_threshold = */ 0.9f, \ + /* double increment = */ 2.0f, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ /* enum H5C_cache_flash_incr_mode */ \ /* flash_incr_mode = */ H5C_flash_incr__add_space, \ - /* double flash_multiple = */ 1.0F, \ - /* double flash_threshold = */ 0.25F, \ + /* double flash_multiple = */ 1.0f, \ + /* double flash_threshold = */ 0.25f, \ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \ - /* double upper_hr_threshold = */ H5_DOUBLE(0.999), \ - /* double decrement = */ 0.9F, \ + /* double upper_hr_threshold = */ 0.999f, \ + /* double decrement = */ 0.9f, \ /* hbool_t apply_max_decrement = */ TRUE, \ /* size_t max_decrement = */ (1 * 1024 * 1024), \ /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ - /* double empty_reserve = */ 0.1F, \ + /* double empty_reserve = */ 0.1f, \ /* int dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ @@ -232,34 +232,33 @@ extern hid_t H5AC_ind_dxpl_id; /* hbool_t evictions_enabled = */ TRUE, \ /* hbool_t set_initial_size = */ TRUE, \ /* size_t initial_size = */ ( 2 * 1024 * 1024), \ - /* double min_clean_fraction = */ 0.01F, \ + /* double min_clean_fraction = */ 0.01f, \ /* size_t max_size = */ (32 * 1024 * 1024), \ /* size_t min_size = */ ( 1 * 1024 * 1024), \ /* long int epoch_length = */ 50000, \ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \ - /* double lower_hr_threshold = */ 0.9F, \ - /* double increment = */ 2.0F, \ + /* double lower_hr_threshold = */ 0.9f, \ + /* double increment = */ 2.0f, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ /* enum H5C_cache_flash_incr_mode */ \ /* flash_incr_mode = */ H5C_flash_incr__add_space, \ - /* double flash_multiple = */ 1.4F, \ - /* double flash_threshold = */ 0.25F, \ + /* double flash_multiple = */ 1.4f, \ + /* double flash_threshold = */ 0.25f, \ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\ - /* double upper_hr_threshold = */ H5_DOUBLE(0.999), \ - /* double decrement = */ 0.9F, \ + /* double upper_hr_threshold = */ 0.999f, \ + /* double decrement = */ 0.9f, \ /* hbool_t apply_max_decrement = */ TRUE, \ /* size_t max_decrement = */ (1 * 1024 * 1024), \ /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ - /* double empty_reserve = */ 0.1F, \ + /* double empty_reserve = */ 0.1f, \ /* int dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ } #endif /* H5_HAVE_PARALLEL */ /* clang-format on */ - /* * Library prototypes. */ @@ -324,16 +323,11 @@ H5_DLL herr_t H5AC_stats(const H5F_t *f); H5_DLL herr_t H5AC_dump_cache(const H5F_t *f); H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr); - H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, int32_t *cur_num_entries_ptr); - H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr); - H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr); - H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr); - H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_close_trace_file(H5AC_t *cache_ptr); diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 3323407..266a666 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -15,12 +15,10 @@ * * Created: H5ACpublic.h * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Public include file for cache functions. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5ACpublic_H @@ -76,32 +74,35 @@ extern "C" { * open_trace_file: Boolean field indicating whether the trace_file_name * field should be used to open a trace file for the cache. * - * The trace file is a debugging feature that allow the capture of - * top level metadata cache requests for purposes of debugging and/or - * optimization. This field should normally be set to FALSE, as - * trace file collection imposes considerable overhead. * - * This field should only be set to TRUE when the trace_file_name - * contains the full path of the desired trace file, and either - * there is no open trace file on the cache, or the close_trace_file - * field is also TRUE. + * The trace file is a debuging feature that allow the capture of + * top level metadata cache requests for purposes of debugging and/or + * optimization. This field should normally be set to FALSE, as + * trace file collection imposes considerable overhead. + * + * This field should only be set to TRUE when the trace_file_name + * contains the full path of the desired trace file, and either + * there is no open trace file on the cache, or the close_trace_file + * field is also TRUE. * * close_trace_file: Boolean field indicating whether the current trace * file (if any) should be closed. * - * See the above comments on the open_trace_file field. This field - * should be set to FALSE unless there is an open trace file on the - * cache that you wish to close. + * + * See the above comments on the open_trace_file field. This field + * should be set to FALSE unless there is an open trace file on the + * cache that you wish to close. * * trace_file_name: Full path of the trace file to be opened if the * open_trace_file field is TRUE. * - * In the parallel case, an ascii representation of the mpi rank of - * the process will be appended to the file name to yield a unique - * trace file name for each process. * - * The length of the path must not exceed H5AC__MAX_TRACE_FILE_NAME_LEN - * characters. + * In the parallel case, an ascii representation of the mpi rank of + * the process will be appended to the file name to yield a unique + * trace file name for each process. + * + * The length of the path must not exceed H5AC__MAX_TRACE_FILE_NAME_LEN + * characters. * * evictions_enabled: Boolean field used to either report the current * evictions enabled status of the cache, or to set the cache's diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 34359d6..56514d6 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -15,7 +15,7 @@ * * Created: H5Abtree2.c * Dec 4 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing attributes on objects * @@ -144,7 +144,6 @@ const H5B2_class_t H5A_BT2_CORDER[1] = {{ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Adense.c b/src/H5Adense.c index 8e6d0e9..2d1850b 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -15,7 +15,7 @@ * * Created: H5Adense.c * Dec 4 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Routines for operating on "dense" attribute storage * for an object. @@ -158,14 +158,13 @@ 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 * Dec 4 2006 * *------------------------------------------------------------------------- @@ -204,9 +203,6 @@ H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo) /* Retrieve the heap's address in the file */ if (H5HF_get_heap_addr(fheap, &ainfo->fheap_addr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address") -#ifdef QAK - HDfprintf(stderr, "%s: ainfo->fheap_addr = %a\n", FUNC, ainfo->fheap_addr); -#endif /* QAK */ #ifndef NDEBUG { @@ -216,9 +212,6 @@ H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo) if (H5HF_get_id_len(fheap, &fheap_id_len) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") HDassert(fheap_id_len == H5O_FHEAP_ID_LEN); -#ifdef QAK - HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); -#endif /* QAK */ } #endif /* NDEBUG */ @@ -238,9 +231,6 @@ H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo) /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_name, &ainfo->name_bt2_addr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index") -#ifdef QAK - HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr); -#endif /* QAK */ /* Check if we should create a creation order index v2 B-tree */ if (ainfo->index_corder) { @@ -259,10 +249,7 @@ H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo) /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_corder, &ainfo->corder_bt2_addr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index") -#ifdef QAK - HDfprintf(stderr, "%s: ainfo->corder_bt2_addr = %a\n", FUNC, ainfo->corder_bt2_addr); -#endif /* QAK */ - } /* end if */ + } /* end if */ done: /* Release resources */ @@ -281,11 +268,10 @@ done: * * 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 - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -296,9 +282,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); @@ -310,15 +294,14 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) } /* end H5A__dense_fnd_cb() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_open + * Function: H5A_dense_open * * Purpose: Open an attribute in dense storage structures for an object * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -399,15 +382,14 @@ done: } /* end H5A_dense_open() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_insert + * Function: H5A_dense_insert * * 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 - * Dec 4 2006 + * Programmer: Quincey Koziol + * Dec 4 2006 * *------------------------------------------------------------------------- */ @@ -563,7 +545,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, February 20, 2007 * *------------------------------------------------------------------------- @@ -596,7 +578,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, December 5, 2006 * *------------------------------------------------------------------------- @@ -704,15 +686,14 @@ done: } /* end H5A__dense_write_bt2_cb() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_write + * Function: H5A_dense_write * * Purpose: Modify an attribute in dense storage structures for an object * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 4 2006 + * Programmer: Quincey Koziol + * Dec 4 2006 * *------------------------------------------------------------------------- */ @@ -808,9 +789,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 5 2006 + * Programmer: Quincey Koziol + * Dec 5 2006 * *------------------------------------------------------------------------- */ @@ -845,15 +825,14 @@ done: } /* end H5A__dense_copy_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_rename + * Function: H5A_dense_rename * * 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 - * Jan 3 2007 + * Programmer: Quincey Koziol + * Jan 3 2007 * *------------------------------------------------------------------------- */ @@ -1034,9 +1013,8 @@ done: * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 5 2006 + * Programmer: Quincey Koziol + * Dec 5 2006 * *------------------------------------------------------------------------- */ @@ -1126,15 +1104,14 @@ done: } /* end H5A__dense_iterate_bt2_cb() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_iterate + * Function: H5A_dense_iterate * * 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 - * Dec 5 2006 + * Programmer: Quincey Koziol + * Dec 5 2006 * *------------------------------------------------------------------------- */ @@ -1265,11 +1242,10 @@ done: * * 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 - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1326,15 +1302,14 @@ done: } /* end H5A__dense_remove_bt2_cb() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_remove + * Function: H5A_dense_remove * * 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 - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1418,11 +1393,10 @@ done: * * 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 - * Feb 14 2007 + * Programmer: Quincey Koziol + * Feb 14 2007 * *------------------------------------------------------------------------- */ @@ -1542,16 +1516,15 @@ done: } /* end H5A__dense_remove_by_idx_bt2_cb() */ /*------------------------------------------------------------------------- - * 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 * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 14 2007 + * Programmer: Quincey Koziol + * Feb 14 2007 * *------------------------------------------------------------------------- */ @@ -1670,16 +1643,15 @@ done: } /* end H5A_dense_remove_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_exists + * Function: H5A_dense_exists * * 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 - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1761,11 +1733,10 @@ done: * * 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 - * Jan 3 2007 + * Programmer: Quincey Koziol + * Jan 3 2007 * *------------------------------------------------------------------------- */ @@ -1822,15 +1793,14 @@ done: } /* 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 * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 6 2006 + * Programmer: Quincey Koziol + * Dec 6 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index b240b93..418f2b2 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -15,7 +15,7 @@ * * Created: H5Adeprec.c * November 27 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Deprecated functions from the H5A interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Aint.c b/src/H5Aint.c index e60427d..efab1c2 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Aint.c - * Dec 18 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Aint.c + * Dec 18 2006 + * Quincey Koziol * - * Purpose: Internal routines for managing attributes. + * Purpose: Internal routines for managing attributes. * *------------------------------------------------------------------------- */ @@ -32,14 +32,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ /****************/ /* Local Macros */ @@ -233,11 +233,10 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_ * (to maintain ref. count incr/decr similarity with "shared message" * type of datatype sharing) */ - if (H5T_committed(attr->shared->dt)) { + if (H5T_committed(attr->shared->dt)) /* Increment the reference count on the shared datatype */ if (H5T_link(attr->shared->dt, 1, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count") - } /* end if */ /* Compute the size of pieces on disk. This is either the size of the * datatype and dataspace messages themselves, or the size of the "shared" @@ -268,6 +267,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_ if (H5O_attr_create(&(attr->oloc), dxpl_id, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, NULL, "unable to create attribute in object header") + /* Set return value */ ret_value = attr; done: @@ -279,20 +279,19 @@ done: } /* H5A_create() */ /*------------------------------------------------------------------------- - * Function: H5A_open_common + * Function: H5A_open_common * - * Purpose: - * Finishes initializing an attributes the open + * Purpose: Finishes initializing an attributes the open * * Usage: * herr_t H5A_open_common(loc, name, dxpl_id) * const H5G_loc_t *loc; IN: Pointer to group location for object * H5A_t *attr; IN/OUT: Pointer to attribute to initialize * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 18, 2006 + * Programmer: Quincey Koziol + * December 18, 2006 * *------------------------------------------------------------------------- */ @@ -337,9 +336,9 @@ done: /*------------------------------------------------------------------------- * Function: H5A_open_by_idx * - * Purpose: Open an attribute according to its index order + * Purpose: Open an attribute according to its index order * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * April 2, 1998 @@ -398,11 +397,11 @@ done: } /* H5A_open_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5A_open_by_name + * Function: H5A_open_by_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 @@ -685,16 +684,13 @@ done: } /* H5A_read() */ /*------------------------------------------------------------------------- - * Function: H5A_get_space + * Function: H5A_get_space * - * Purpose: Returns dataspace of the attribute. + * Purpose: Returns dataspace of the attribute. * - * Return: Success: dataspace + * Return: Success: A valid ID for the dataspace of an attribute * - * Failure: NULL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Failure: H5I_INVALID_ID * *------------------------------------------------------------------------- */ @@ -709,23 +705,19 @@ H5A_get_space(H5A_t *attr) /* Copy the attribute's dataspace */ if (NULL == (ret_value = H5S_copy(attr->shared->ds, FALSE, TRUE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy dataspace") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_space() */ /*------------------------------------------------------------------------- - * Function: H5A_get_type - * - * Purpose: Returns datatype of the dataset. + * Function: H5A_get_type * - * Return: Success: datatype + * Purpose: Returns datatype of an attribute * - * Failure: NULL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Return: Success: A datatype of an attribute + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -743,8 +735,7 @@ H5A_get_type(H5A_t *attr) if (H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to patch datatype's file pointer") - /* - * Copy the attribute's datatype. If the type is a named type then + /* Copy the attribute's datatype. If the type is a named type then * reopen the type before returning it to the user. Make the type * read-only. */ @@ -895,12 +886,11 @@ H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo) } /* end H5A_get_info() */ /*------------------------------------------------------------------------- - * Function: H5A_copy + * Function: H5A_copy * * Purpose: Copies attribute OLD_ATTR. * * Return: Success: Pointer to a new copy of the OLD_ATTR argument. - * * Failure: NULL * * Programmer: Robb Matzke @@ -957,18 +947,16 @@ done: } /* end H5A_copy() */ /*------------------------------------------------------------------------- - * Function: H5A_free + * Function: H5A_free * * 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 @@ -1003,11 +991,11 @@ done: } /* end H5A_free() */ /*------------------------------------------------------------------------- - * Function: H5A_close + * Function: H5A_close * * 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 @@ -1055,7 +1043,7 @@ done: } /* end H5A_close() */ /*------------------------------------------------------------------------- - * Function: H5A_oloc + * Function: H5A_oloc * * Purpose: Return the object location for an attribute. It's the * object location for the object to which the attribute @@ -1085,7 +1073,7 @@ H5A_oloc(H5A_t *attr) } /* end H5A_oloc() */ /*------------------------------------------------------------------------- - * Function: H5A_nameof + * Function: H5A_nameof * * Purpose: Return the group hier. path for an attribute. It's the * group hier. path for the object to which the attribute @@ -1143,12 +1131,11 @@ H5A_type(const H5A_t *attr) } /* end H5A_type() */ /*------------------------------------------------------------------------- - * 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 @@ -1197,7 +1184,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * * Modification:Raymond Lu @@ -1249,7 +1235,7 @@ done: } /* end H5A__compact_build_table_cb() */ /*------------------------------------------------------------------------- - * Function: H5A_compact_build_table + * Function: H5A_compact_build_table * * Purpose: Builds a table containing a sorted list of attributes for * an object @@ -1259,8 +1245,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18, 2006 + * Programmer: Quincey Koziol + * Dec 18, 2006 * *------------------------------------------------------------------------- */ @@ -1317,11 +1303,9 @@ done: * Purpose: Callback routine for building table of attributes from dense * attribute storage. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * *------------------------------------------------------------------------- @@ -1355,14 +1339,14 @@ done: } /* end H5A_dense_build_table_cb() */ /*------------------------------------------------------------------------- - * 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: SUCCEED/FAIL * @@ -1439,19 +1423,18 @@ done: } /* end H5A_dense_build_table() */ /*------------------------------------------------------------------------- - * Function: H5A__attr_cmp_name_inc + * Function: H5A__attr_cmp_name_inc * - * Purpose: Callback routine for comparing two attribute names, in + * Purpose: Callback routine for comparing two attribute names, in * increasing alphabetic order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * first argument is considered to be respectively less than, * equal to, or greater than the second. If two members compare * as equal, their order in the sorted array is undefined. * (i.e. same as strcmp()) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * *------------------------------------------------------------------------- @@ -1478,7 +1461,6 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2) * (i.e. opposite of strcmp()) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 8 2007 * *------------------------------------------------------------------------- @@ -1504,7 +1486,6 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) * as equal, their order in the sorted array is undefined. * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 8 2007 * *------------------------------------------------------------------------- @@ -1528,19 +1509,18 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) } /* end H5A__attr_cmp_corder_inc() */ /*------------------------------------------------------------------------- - * Function: H5A__attr_cmp_corder_dec + * Function: H5A__attr_cmp_corder_dec * - * Purpose: Callback routine for comparing two attributes, in + * Purpose: Callback routine for comparing two attributes, in * decreasing creation order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * second argument is considered to be respectively less than, * equal to, or greater than the first. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 8 2007 + * Programmer: Quincey Koziol + * Feb 8 2007 * *------------------------------------------------------------------------- */ @@ -1563,15 +1543,14 @@ H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2) } /* end H5A__attr_cmp_corder_dec() */ /*------------------------------------------------------------------------- - * Function: H5A__attr_sort_table + * Function: H5A__attr_sort_table * * Purpose: Sort table containing a list of attributes for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11, 2006 + * Programmer: Quincey Koziol + * Dec 11, 2006 * *------------------------------------------------------------------------- */ @@ -1606,16 +1585,15 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, H5_iter_orde } /* end H5A__attr_sort_table() */ /*------------------------------------------------------------------------- - * 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 + * Programmer: Quincey Koziol + * Dec 18, 2006 * *------------------------------------------------------------------------- */ @@ -1686,15 +1664,14 @@ done: } /* end H5A_attr_iterate_table() */ /*------------------------------------------------------------------------- - * Function: H5A_attr_release_table + * Function: H5A_attr_release_table * * 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 + * Programmer: Quincey Koziol + * Dec 11, 2006 * *------------------------------------------------------------------------- */ @@ -1732,11 +1709,9 @@ 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: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 11 2007 * *------------------------------------------------------------------------- @@ -1796,11 +1771,9 @@ done: * Chooses the oldest version possible, unless the "use the * latest format" flag is set. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 17 2007 * *------------------------------------------------------------------------- @@ -2143,7 +2116,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 @@ -2243,7 +2216,6 @@ done: * Failure: Negative * * Programmer: Peter Cao - * xcao@hdfgroup.org * July 20, 2007 * *------------------------------------------------------------------------- @@ -2296,7 +2268,6 @@ done: * Failure: Negative * * Programmer: Peter Cao - * xcao@hdfgroup.org * July 20, 2007 * *------------------------------------------------------------------------- @@ -2336,14 +2307,13 @@ done: } /* end H5A_dense_post_copy_file_all */ /*------------------------------------------------------------------------- - * 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 + * Programmer: Quincey Koziol * February 20, 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Atest.c b/src/H5Atest.c index 2aade87..3c3313e 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -30,12 +30,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#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 "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ /* Local Macros */ @@ -66,12 +66,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 @@ -98,12 +97,11 @@ done: } /* end H5A_is_shared_test() */ /*------------------------------------------------------------------------- - * 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 @@ -13,79 +13,79 @@ /*------------------------------------------------------------------------- * - * Created: H5B.c - * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> + * Created: H5B.c + * Jul 10 1997 + * Robb Matzke * - * Purpose: Implements balanced, sibling-linked, N-ary trees - * capable of storing any type of data with unique key - * values. + * Purpose: Implements balanced, sibling-linked, N-ary trees + * capable of storing any type of data with unique key + * values. * - * A B-link-tree is a balanced tree where each node has - * a pointer to its left and right siblings. A - * B-link-tree is a rooted tree having the following - * properties: + * A B-link-tree is a balanced tree where each node has + * a pointer to its left and right siblings. A + * B-link-tree is a rooted tree having the following + * properties: * - * 1. Every node, x, has the following fields: + * 1. Every node, x, has the following fields: * - * a. level[x], the level in the tree at which node - * x appears. Leaf nodes are at level zero. + * a. level[x], the level in the tree at which node + * x appears. Leaf nodes are at level zero. * - * b. n[x], the number of children pointed to by the - * node. Internal nodes point to subtrees while - * leaf nodes point to arbitrary data. + * b. n[x], the number of children pointed to by the + * node. Internal nodes point to subtrees while + * leaf nodes point to arbitrary data. * - * c. The child pointers themselves, child[x,i] such - * that 0 <= i < n[x]. + * c. The child pointers themselves, child[x,i] such + * that 0 <= i < n[x]. * - * d. n[x]+1 key values stored in increasing - * order: + * d. n[x]+1 key values stored in increasing + * order: * - * key[x,0] < key[x,1] < ... < key[x,n[x]]. + * key[x,0] < key[x,1] < ... < key[x,n[x]]. * - * e. left[x] is a pointer to the node's left sibling - * or the null pointer if this is the left-most - * node at this level in the tree. + * e. left[x] is a pointer to the node's left sibling + * or the null pointer if this is the left-most + * node at this level in the tree. * - * f. right[x] is a pointer to the node's right - * sibling or the null pointer if this is the - * right-most node at this level in the tree. + * f. right[x] is a pointer to the node's right + * sibling or the null pointer if this is the + * right-most node at this level in the tree. * - * 3. The keys key[x,i] partition the key spaces of the - * children of x: + * 3. The keys key[x,i] partition the key spaces of the + * children of x: * - * key[x,i] <= key[child[x,i],j] <= key[x,i+1] + * key[x,i] <= key[child[x,i],j] <= key[x,i+1] * - * for any valid combination of i and j. + * for any valid combination of i and j. * - * 4. There are lower and upper bounds on the number of - * child pointers a node can contain. These bounds - * can be expressed in terms of a fixed integer k>=2 - * called the `minimum degree' of the B-tree. + * 4. There are lower and upper bounds on the number of + * child pointers a node can contain. These bounds + * can be expressed in terms of a fixed integer k>=2 + * called the `minimum degree' of the B-tree. * - * a. Every node other than the root must have at least - * k child pointers and k+1 keys. If the tree is - * nonempty, the root must have at least one child - * pointer and two keys. + * a. Every node other than the root must have at least + * k child pointers and k+1 keys. If the tree is + * nonempty, the root must have at least one child + * pointer and two keys. * - * b. Every node can contain at most 2k child pointers - * and 2k+1 keys. A node is `full' if it contains - * exactly 2k child pointers and 2k+1 keys. + * b. Every node can contain at most 2k child pointers + * and 2k+1 keys. A node is `full' if it contains + * exactly 2k child pointers and 2k+1 keys. * - * 5. When searching for a particular value, V, and - * key[V] = key[x,i] for some node x and entry i, - * then: + * 5. When searching for a particular value, V, and + * key[V] = key[x,i] for some node x and entry i, + * then: * - * a. If i=0 the child[0] is followed. + * a. If i=0 the child[0] is followed. * - * b. If i=n[x] the child[n[x]-1] is followed. + * b. If i=n[x] the child[n[x]-1] is followed. * - * c. Otherwise, the child that is followed - * (either child[x,i-1] or child[x,i]) is - * determined by the type of object to which the - * leaf nodes of the tree point and is controlled - * by the key comparison function registered for - * that type of B-tree. + * c. Otherwise, the child that is followed + * (either child[x,i-1] or child[x,i]) is + * determined by the type of object to which the + * leaf nodes of the tree point and is controlled + * by the key comparison function registered for + * that type of B-tree. * * *------------------------------------------------------------------------- @@ -95,26 +95,26 @@ /* Module Setup */ /****************/ -#define H5B_PACKAGE /*suppress error about including H5Bpkg */ +#define H5B_PACKAGE /*suppress error about including H5Bpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Bpkg.h" /* B-link trees */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Bpkg.h" /* B-link trees */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ #include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ /****************/ #define H5B_SIZEOF_HDR(F) \ - (H5_SIZEOF_MAGIC + /*magic number */ \ - 4 + /*type, level, num entries */ \ - 2 * H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */ + (H5_SIZEOF_MAGIC + /*magic number */ \ + 4 + /*type, level, num entries */ \ + 2 * H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */ /* Default initializer for H5B_ins_ud_t */ #define H5B_INS_UD_T_NULL \ @@ -184,20 +184,19 @@ H5FL_BLK_DEFINE_STATIC(page); H5FL_SEQ_DEFINE_STATIC(size_t); /*------------------------------------------------------------------------- - * Function: H5B_create + * Function: H5B_create * - * Purpose: Creates a new empty B-tree leaf node. The UDATA pointer is - * passed as an argument to the sizeof_rkey() method for the - * B-tree. + * Purpose: Creates a new empty B-tree leaf node. The UDATA pointer is + * passed as an argument to the sizeof_rkey() method for the + * B-tree. * - * Return: Success: Non-negative, and the address of new node is - * returned through the ADDR_P argument. + * Return: Success: Non-negative, and the address of new node is + * returned through the ADDR_P argument. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 + * Programmer: Robb Matzke + * Jun 23 1997 * *------------------------------------------------------------------------- */ @@ -263,25 +262,24 @@ done: } /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */ /*------------------------------------------------------------------------- - * Function: H5B_find + * Function: H5B_find * - * Purpose: Locate the specified information in a B-tree and return - * that information by filling in fields of the caller-supplied - * UDATA pointer depending on the type of leaf node - * requested. The UDATA can point to additional data passed - * to the key comparison function. + * Purpose: Locate the specified information in a B-tree and return + * that information by filling in fields of the caller-supplied + * UDATA pointer depending on the type of leaf node + * requested. The UDATA can point to additional data passed + * to the key comparison function. * - * Note: This function does not follow the left/right sibling - * pointers since it assumes that all nodes can be reached - * from the parent node. + * Note: This function does not follow the left/right sibling + * pointers since it assumes that all nodes can be reached + * from the parent node. * - * Return: Non-negative (TRUE/FALSE) on success (if found, values returned + * Return: Non-negative (TRUE/FALSE) on success (if found, values returned * through the UDATA argument). Negative on failure (if not found, * UDATA is undefined). * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 + * Programmer: Robb Matzke + * Jun 23 1997 * *------------------------------------------------------------------------- */ @@ -359,24 +357,23 @@ done: } /* end H5B_find() */ /*------------------------------------------------------------------------- - * Function: H5B_split + * Function: H5B_split * - * Purpose: Split a single node into two nodes. The old node will - * contain the left children and the new node will contain the - * right children. + * Purpose: Split a single node into two nodes. The old node will + * contain the left children and the new node will contain the + * right children. * - * The UDATA pointer is passed to the sizeof_rkey() method but is - * otherwise unused. + * The UDATA pointer is passed to the sizeof_rkey() method but is + * otherwise unused. * - * The BT_UD argument is a pointer to a protected B-tree - * node. + * The BT_UD argument is a pointer to a protected B-tree + * node. * - * Return: Non-negative on success (The address of the new node is + * Return: Non-negative on success (The address of the new node is * returned through the NEW_ADDR argument). Negative on failure. * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 3 1997 + * Programmer: Robb Matzke + * Jul 3 1997 * *------------------------------------------------------------------------- */ @@ -526,15 +523,14 @@ done: } /* end H5B_split() */ /*------------------------------------------------------------------------- - * Function: H5B_insert + * Function: H5B_insert * - * Purpose: Adds a new item to the B-tree. + * Purpose: Adds a new item to the B-tree. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 + * Programmer: Robb Matzke + * Jun 23 1997 * *------------------------------------------------------------------------- */ @@ -681,17 +677,16 @@ done: } /* end H5B_insert() */ /*------------------------------------------------------------------------- - * Function: H5B_insert_child + * Function: H5B_insert_child * - * Purpose: Insert a child to the left or right of child[IDX] depending - * on whether ANCHOR is H5B_INS_LEFT or H5B_INS_RIGHT. The BT - * argument is a pointer to a protected B-tree node. + * Purpose: Insert a child to the left or right of child[IDX] depending + * on whether ANCHOR is H5B_INS_LEFT or H5B_INS_RIGHT. The BT + * argument is a pointer to a protected B-tree node. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 8 1997 + * Programmer: Robb Matzke + * Jul 8 1997 * *------------------------------------------------------------------------- */ @@ -751,33 +746,32 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B } /* end H5B_insert_child() */ /*------------------------------------------------------------------------- - * Function: H5B_insert_helper + * Function: H5B_insert_helper * - * Purpose: Inserts the item UDATA into the tree rooted at ADDR and having - * the specified type. + * Purpose: Inserts the item UDATA into the tree rooted at ADDR and having + * the specified type. * - * On return, if LT_KEY_CHANGED is non-zero, then LT_KEY is - * the new native left key. Similarly for RT_KEY_CHANGED - * and RT_KEY. + * On return, if LT_KEY_CHANGED is non-zero, then LT_KEY is + * the new native left key. Similarly for RT_KEY_CHANGED + * and RT_KEY. * - * If the node splits, then MD_KEY contains the key that - * was split between the two nodes (that is, the key that - * appears as the max key in the left node and the min key - * in the right node). + * If the node splits, then MD_KEY contains the key that + * was split between the two nodes (that is, the key that + * appears as the max key in the left node and the min key + * in the right node). * - * Return: Success: A B-tree operation. The address of the new - * node, if the node splits, is returned through - * the NEW_NODE_P argument. The new node is always - * to the right of the previous node. This - * function is called recursively and the return - * value influences the behavior of the caller. - * See also, declaration of H5B_ins_t. + * Return: Success: A B-tree operation. The address of the new + * node, if the node splits, is returned through + * the NEW_NODE_P argument. The new node is always + * to the right of the previous node. This + * function is called recursively and the return + * value influences the behavior of the caller. + * See also, declaration of H5B_ins_t. * - * Failure: H5B_INS_ERROR + * Failure: H5B_INS_ERROR * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 9 1997 + * Programmer: Robb Matzke + * Jul 9 1997 * *------------------------------------------------------------------------- */ @@ -1108,16 +1102,15 @@ done: } /* end H5B_insert_helper() */ /*------------------------------------------------------------------------- - * Function: H5B_iterate_helper + * Function: H5B_iterate_helper * - * Purpose: Calls the list callback for each leaf node of the - * B-tree, passing it the caller's UDATA structure. + * Purpose: Calls the list callback for each leaf node of the + * B-tree, passing it the caller's UDATA structure. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 + * Programmer: Robb Matzke + * Jun 23 1997 * *------------------------------------------------------------------------- */ @@ -1175,16 +1168,15 @@ done: } /* end H5B_iterate_helper() */ /*------------------------------------------------------------------------- - * Function: H5B_iterate + * Function: H5B_iterate * - * Purpose: Calls the list callback for each leaf node of the - * B-tree, passing it the UDATA structure. + * Purpose: Calls the list callback for each leaf node of the + * B-tree, passing it the UDATA structure. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 + * Programmer: Robb Matzke + * Jun 23 1997 * *------------------------------------------------------------------------- */ @@ -1212,25 +1204,25 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, H5B_ } /* end H5B_iterate() */ /*------------------------------------------------------------------------- - * Function: H5B_remove_helper + * Function: H5B_remove_helper * - * Purpose: The recursive part of removing an item from a B-tree. The - * sub B-tree that is being considered is located at ADDR and - * the item to remove is described by UDATA. If the removed - * item falls at the left or right end of the current level then - * it might be necessary to adjust the left and/or right keys - * (LT_KEY and/or RT_KEY) to to indicate that they changed by - * setting LT_KEY_CHANGED and/or RT_KEY_CHANGED. + * Purpose: The recursive part of removing an item from a B-tree. The + * sub B-tree that is being considered is located at ADDR and + * the item to remove is described by UDATA. If the removed + * item falls at the left or right end of the current level then + * it might be necessary to adjust the left and/or right keys + * (LT_KEY and/or RT_KEY) to to indicate that they changed by + * setting LT_KEY_CHANGED and/or RT_KEY_CHANGED. * - * Return: Success: A B-tree operation, see comments for - * H5B_ins_t declaration. This function is - * called recursively and the return value - * influences the actions of the caller. It is - * also called by H5B_remove(). + * Return: Success: A B-tree operation, see comments for + * H5B_ins_t declaration. This function is + * called recursively and the return value + * influences the actions of the caller. It is + * also called by H5B_remove(). * - * Failure: H5B_INS_ERROR, a negative value. + * Failure: H5B_INS_ERROR, a negative value. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, September 16, 1998 * *------------------------------------------------------------------------- @@ -1551,17 +1543,17 @@ done: } /* end H5B_remove_helper() */ /*------------------------------------------------------------------------- - * Function: H5B_remove + * Function: H5B_remove * - * Purpose: Removes an item from a B-tree. + * Purpose: Removes an item from a B-tree. * - * Note: The current version does not attempt to rebalance the tree. + * Note: The current version does not attempt to rebalance the tree. * (Read the paper Yao & Lehman paper for details on why) * - * Return: Non-negative on success/Negative on failure (failure includes - * not being able to find the object which is to be removed). + * Return: Non-negative on success/Negative on failure (failure includes + * not being able to find the object which is to be removed). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, September 16, 1998 * *------------------------------------------------------------------------- @@ -1598,14 +1590,14 @@ done: } /*------------------------------------------------------------------------- - * Function: H5B_delete + * Function: H5B_delete * - * Purpose: Deletes an entire B-tree from the file, calling the 'remove' + * Purpose: Deletes an entire B-tree from the file, calling the 'remove' * callbacks for each node. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, March 20, 2003 * *------------------------------------------------------------------------- @@ -1672,16 +1664,15 @@ done: } /* end H5B_delete() */ /*------------------------------------------------------------------------- - * Function: H5B_shared_new + * Function: H5B_shared_new * - * Purpose: Allocates & constructs a shared v1 B-tree struct for client. + * Purpose: Allocates & constructs a shared v1 B-tree struct for client. * - * Return: Success: non-NULL pointer to struct allocated - * Failure: NULL + * Return: Success: non-NULL pointer to struct allocated + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * May 27 2008 + * Programmer: Quincey Koziol + * May 27 2008 * *------------------------------------------------------------------------- */ @@ -1711,9 +1702,9 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) shared->sizeof_rkey = sizeof_rkey; HDassert(shared->sizeof_rkey); shared->sizeof_keys = (shared->two_k + 1) * type->sizeof_nkey; - shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */ + shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */ shared->two_k * H5F_SIZEOF_ADDR(f) + /*child pointers */ - (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ + (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ HDassert(shared->sizeof_rnode); /* Allocate shared buffers */ @@ -1746,13 +1737,13 @@ done: } /* end H5B_shared_new() */ /*------------------------------------------------------------------------- - * Function: H5B_shared_free + * Function: H5B_shared_free * - * Purpose: Free B-tree shared info + * Purpose: Free B-tree shared info * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 27, 2008 * *------------------------------------------------------------------------- @@ -1777,17 +1768,16 @@ H5B_shared_free(void *_shared) } /* end H5B_shared_free() */ /*------------------------------------------------------------------------- - * Function: H5B_copy + * Function: H5B_copy * - * Purpose: Deep copies an existing H5B_t node. + * Purpose: Deep copies an existing H5B_t node. * - * Return: Success: Pointer to H5B_t object. + * Return: Success: Pointer to H5B_t object. * - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Apr 18 2000 + * Programmer: Quincey Koziol + * Apr 18 2000 * *------------------------------------------------------------------------- */ @@ -1844,15 +1834,14 @@ done: } /* end H5B_copy() */ /*------------------------------------------------------------------------- - * Function: H5B_get_info_helper + * Function: H5B_get_info_helper * - * Purpose: Walks the B-tree nodes, getting information for all of them. + * Purpose: Walks the B-tree nodes, getting information for all of them. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jun 3 2008 + * Programmer: Quincey Koziol + * Jun 3 2008 * *------------------------------------------------------------------------- */ @@ -1864,8 +1853,8 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad H5RC_t * rc_shared; /* Ref-counted shared info */ H5B_shared_t * shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - unsigned level; /* Node level */ - size_t sizeof_rnode; /* Size of raw (disk) node */ + unsigned level; /* Node level */ + size_t sizeof_rnode; /* Size of raw (disk) node */ haddr_t next_addr; /* Address of next node to the right */ haddr_t left_child; /* Address of left-most child in node */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2064,7 +2053,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26, 2008 * *------------------------------------------------------------------------- @@ -15,7 +15,7 @@ * * Created: H5B2.c * Jan 31 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Implements a B-tree, with several modifications from * the "standard" methods. @@ -109,7 +109,6 @@ H5FL_DEFINE_STATIC(H5B2_t); * filled in), negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 31 2005 * *------------------------------------------------------------------------- @@ -185,7 +184,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 15 2009 * *------------------------------------------------------------------------- @@ -253,7 +251,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -315,7 +312,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 5 2009 * *------------------------------------------------------------------------- @@ -349,7 +345,6 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p) * Return: Value from callback: non-negative on success, negative on error * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 11 2005 * *------------------------------------------------------------------------- @@ -373,11 +368,10 @@ H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, void *op_data) hdr = bt2->hdr; /* Iterate through records */ - if (hdr->root.node_nrec > 0) { + if (hdr->root.node_nrec > 0) /* Iterate through nodes */ if ((ret_value = H5B2_iterate_node(hdr, dxpl_id, hdr->depth, &hdr->root, op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_iterate() */ @@ -400,7 +394,6 @@ H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, void *op_data) * Return: Non-negative (TRUE/FALSE) on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 23 2005 * *------------------------------------------------------------------------- @@ -625,7 +618,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 23 2005 * *------------------------------------------------------------------------- @@ -787,7 +779,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 25 2005 * *------------------------------------------------------------------------- @@ -861,7 +852,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -944,7 +934,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 25 2005 * *------------------------------------------------------------------------- @@ -984,7 +973,6 @@ H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec) * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 8 2005 * *------------------------------------------------------------------------- @@ -1041,7 +1029,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 10 2005 * *------------------------------------------------------------------------- @@ -1257,7 +1244,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 15 2009 * *------------------------------------------------------------------------- @@ -1370,7 +1356,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 9 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2cache.c b/src/H5B2cache.c index f32b195..0d2bb56 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -15,7 +15,7 @@ * * Created: H5B2cache.c * Jan 31 2005 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Implement v2 B-tree metadata cache methods. * @@ -132,7 +132,6 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 1 2005 * *------------------------------------------------------------------------- @@ -254,7 +253,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 1 2005 * *------------------------------------------------------------------------- @@ -468,7 +466,6 @@ H5B2__cache_hdr_size(const H5F_t H5_ATTR_UNUSED *f, const H5B2_hdr_t *hdr, size_ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -604,7 +601,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 3 2005 * *------------------------------------------------------------------------- @@ -760,9 +756,7 @@ H5B2__cache_internal_clear(H5F_t *f, H5B2_internal_t *internal, hbool_t destroy) FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(internal); /* Reset the dirty flag. */ @@ -816,7 +810,6 @@ H5B2__cache_internal_size(const H5F_t H5_ATTR_UNUSED *f, const H5B2_internal_t * * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -1009,7 +1002,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 9c1b380..757d333 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -15,7 +15,7 @@ * * Created: H5B2dbg.c * Feb 2 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Dump debugging information about a v2 B-tree. * @@ -72,7 +72,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -169,7 +168,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 4 2005 * *------------------------------------------------------------------------- @@ -288,7 +286,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 7 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index af457cd..d71cf3b 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -15,7 +15,7 @@ * * Created: H5B2int.c * Feb 27 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Internal routines for managing v2 B-trees. * @@ -91,7 +91,6 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -223,7 +222,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- @@ -268,7 +266,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- @@ -322,7 +319,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 13 2009 * *------------------------------------------------------------------------- @@ -357,7 +353,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 13 2009 * *------------------------------------------------------------------------- @@ -393,7 +388,6 @@ done: * Return: SUCCEED (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- @@ -420,7 +414,6 @@ H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr) * Return: The file's reference count after the decrement. (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- @@ -448,7 +441,6 @@ H5B2_hdr_fuse_decr(H5B2_hdr_t *hdr) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 13 2009 * *------------------------------------------------------------------------- @@ -479,7 +471,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -554,7 +545,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 15 2009 * *------------------------------------------------------------------------- diff --git a/src/H5B2int.c b/src/H5B2int.c index 73db537..601399d 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -15,7 +15,7 @@ * * Created: H5B2int.c * Feb 27 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Internal routines for managing v2 B-trees. * @@ -119,7 +119,6 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t); * record to locate is greater than all records to search). * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 3 2005 * *------------------------------------------------------------------------- @@ -162,7 +161,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 28 2006 * *------------------------------------------------------------------------- @@ -362,7 +360,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 3 2005 * *------------------------------------------------------------------------- @@ -446,7 +443,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 9 2005 * *------------------------------------------------------------------------- @@ -704,7 +700,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 9 2005 * *------------------------------------------------------------------------- @@ -1059,52 +1054,6 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_internal /* Mark parent as dirty */ *internal_flags_ptr |= H5AC__DIRTIED_FLAG; -#ifdef QAK - { - unsigned u; - - HDfprintf(stderr, "%s: Internal records:\n", FUNC); - for (u = 0; u < internal->nrec; u++) { - HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_INT_NREC(internal, hdr, u), NULL); - } /* end for */ - - HDfprintf(stderr, "%s: Left Child records:\n", FUNC); - for (u = 0; u < *left_nrec; u++) { - HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_NAT_NREC(left_native, hdr, u), NULL); - } /* end for */ - - HDfprintf(stderr, "%s: Middle Child records:\n", FUNC); - for (u = 0; u < *middle_nrec; u++) { - HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_NAT_NREC(middle_native, hdr, u), NULL); - } /* end for */ - - HDfprintf(stderr, "%s: Right Child records:\n", FUNC); - for (u = 0; u < *right_nrec; u++) { - HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_NAT_NREC(right_native, hdr, u), NULL); - } /* end for */ - - for (u = 0; u < internal->nrec + 1; u++) - HDfprintf(stderr, "%s: internal->node_ptrs[%u] = (%Hu/%u/%a)\n", FUNC, u, - internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, - internal->node_ptrs[u].addr); - if (depth > 1) { - for (u = 0; u < *left_nrec + 1; u++) - HDfprintf(stderr, "%s: left_node_ptr[%u] = (%Hu/%u/%a)\n", FUNC, u, - left_node_ptrs[u].all_nrec, left_node_ptrs[u].node_nrec, left_node_ptrs[u].addr); - for (u = 0; u < *middle_nrec + 1; u++) - HDfprintf(stderr, "%s: middle_node_ptr[%u] = (%Hu/%u/%a)\n", FUNC, u, - middle_node_ptrs[u].all_nrec, middle_node_ptrs[u].node_nrec, - middle_node_ptrs[u].addr); - for (u = 0; u < *right_nrec + 1; u++) - HDfprintf(stderr, "%s: right_node_ptr[%u] = (%Hu/%u/%a)\n", FUNC, u, - right_node_ptrs[u].all_nrec, right_node_ptrs[u].node_nrec, right_node_ptrs[u].addr); - } /* end if */ - } -#endif /* QAK */ #ifdef H5B2_DEBUG H5B2_assert_internal((hsize_t)0, hdr, internal); if (depth > 1) { @@ -1149,7 +1098,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 4 2005 * *------------------------------------------------------------------------- @@ -1316,7 +1264,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 4 2005 * *------------------------------------------------------------------------- @@ -2152,7 +2099,6 @@ done: * Return: Value from callback, non-negative on success, negative on error * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 11 2005 * *------------------------------------------------------------------------- @@ -3148,7 +3094,6 @@ done: * Return: Value from callback, non-negative on success, negative on error * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 9 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 92b2975..4e12416 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Monday, January 31, 2005 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5B2private.h b/src/H5B2private.h index 46c7843..b1e6dd0 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -15,7 +15,7 @@ * * Created: H5B2private.h * Jan 31 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Private header for library accessible B-tree routines. * diff --git a/src/H5B2stat.c b/src/H5B2stat.c index 23f9e84..0d9d2f7 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@hdfgroup.org> +/* Programmer: Quincey Koziol * Monday, March 6, 2006 * * Purpose: v2 B-tree metadata statistics functions. diff --git a/src/H5B2test.c b/src/H5B2test.c index 14b01e6..f5420c9 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Thursday, February 3, 2005 * * Purpose: v2 B-tree testing functions. @@ -110,9 +110,9 @@ H5FL_DEFINE_STATIC(H5B2_test_ctx_t); static void * H5B2_test_crt_context(void *_f) { - H5F_t * f = (H5F_t *)_f; /* User data for building callback context */ - H5B2_test_ctx_t *ctx; /* Callback context structure */ - void * ret_value; /* Return value */ + H5F_t * f = (H5F_t *)_f; /* User data for building callback context */ + H5B2_test_ctx_t *ctx; /* Callback context structure */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -358,12 +358,11 @@ H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) } /* H5B2_get_root_addr_test() */ /*------------------------------------------------------------------------- - * Function: H5B2_get_node_info_test + * Function: H5B2_get_node_info_test * - * Purpose: Determine information about a node holding a record in the B-tree + * Purpose: Determine information about a node holding a record in the B-tree * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, August 31, 2006 @@ -480,15 +479,16 @@ done: } /* H5B2_get_node_info_test() */ /*------------------------------------------------------------------------- - * Function: H5B2_get_node_depth_test + * Function: H5B2_get_node_depth_test * - * Purpose: Determine the depth of a node holding a record in the B-tree + * Purpose: Determine the depth of a node holding a record in the B-tree * - * Note: Just a simple wrapper around the H5B2_get_node_info_test() routine + * Note: Just a simple wrapper around the H5B2_get_node_info_test() routine * - * Return: Success: non-negative depth of the node where the record - * was found - * Failure: negative + * Return: Success: Non-negative depth of the node where the record + * was found + * + * Failure: -1 * * Programmer: Quincey Koziol * Saturday, August 26, 2006 @@ -498,17 +498,17 @@ done: int H5B2_get_node_depth_test(H5B2_t *bt2, hid_t dxpl_id, void *udata) { - H5B2_node_info_test_t ninfo; /* Node information */ - int ret_value; /* Return information */ + H5B2_node_info_test_t ninfo; /* Node information */ + int ret_value = -1; /* Return information */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Check arguments. */ HDassert(bt2); /* Get information abou the node */ if (H5B2_get_node_info_test(bt2, dxpl_id, udata, &ninfo) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, (-1), "error looking up node info") /* Set return value */ ret_value = ninfo.depth; diff --git a/src/H5Bcache.c b/src/H5Bcache.c index e6d7e48..0711a0e 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -15,7 +15,7 @@ * * Created: H5Bcache.c * Oct 31 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Implement B-tree metadata cache methods. * diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 127e7eb..6b8e2f7 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Bdbg.c - * Dec 11 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Bdbg.c + * Dec 11 2008 + * Quincey Koziol * - * Purpose: Debugging routines for B-link tree package. + * Purpose: Debugging routines for B-link tree package. * *------------------------------------------------------------------------- */ @@ -37,15 +37,14 @@ #include "H5MMprivate.h" /* Memory management */ /*------------------------------------------------------------------------- - * Function: H5B_debug + * Function: H5B_debug * - * Purpose: Prints debugging info about a B-tree. + * Purpose: Prints debugging info about a B-tree. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 4 1997 + * Programmer: Robb Matzke + * Aug 4 1997 * *------------------------------------------------------------------------- */ @@ -134,16 +133,16 @@ done: } /* end H5B_debug() */ /*------------------------------------------------------------------------- - * Function: H5B_assert + * Function: H5B_assert * - * Purpose: Verifies that the tree is structured correctly. + * Purpose: Verifies that the tree is structured correctly. * - * Return: Success: SUCCEED + * Return: Success: SUCCEED * - * Failure: aborts if something is wrong. + * Failure: aborts if something is wrong. * - * Programmer: Robb Matzke - * Tuesday, November 4, 1997 + * Programmer: Robb Matzke + * Tuesday, November 4, 1997 * *------------------------------------------------------------------------- */ diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index 1a3906c..9039004 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, May 15, 2003 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index c4c7bf2..e2c71f2 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -15,12 +15,10 @@ * * Created: H5Bprivate.h * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Private non-prototype header. * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -66,8 +66,6 @@ H5CS_t H5CS_stack_g[1]; * Programmer: Quincey Koziol * February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5CS_t * @@ -113,8 +111,6 @@ H5CS_get_stack(void) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -135,11 +131,7 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream) HDfprintf(stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g); /* try show the process or thread id in multiple processes cases*/ -#ifdef H5_HAVE_THREADSAFE - HDfprintf(stream, "thread %lu.", HDpthread_self_ulong()); -#else /* H5_HAVE_THREADSAFE */ - HDfprintf(stream, "thread 0."); -#endif /* H5_HAVE_THREADSAFE */ + HDfprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id()); if (fstack && fstack->nused > 0) HDfprintf(stream, " Back trace follows."); HDfputc('\n', stream); @@ -191,14 +183,12 @@ H5CS_print(FILE *stream) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5CS_push(const char *func_name) { - H5CS_t *fstack = H5CS_get_my_stack(); + H5CS_t *fstack = H5CS_get_my_stack(); /* Current function stack for library */ /* Don't push this function on the function stack... :-) */ FUNC_ENTER_NOAPI_NOERR_NOFS @@ -227,8 +217,6 @@ H5CS_push(const char *func_name) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -259,8 +247,6 @@ H5CS_pop(void) * Programmer: Quincey Koziol * Tuesday, August 9, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -293,8 +279,6 @@ H5CS_copy_stack(H5CS_t *new_stack) * Programmer: Quincey Koziol * Tuesday, August 9, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -23,11 +23,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ /****************/ /* Local Macros */ @@ -106,31 +106,28 @@ H5D__term_pub_interface(void) } /* H5D__term_pub_interface() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -138,126 +135,126 @@ 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 */ + 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 = 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 (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") /* Get correct property list */ if (H5P_DEFAULT == dapl_id) dapl_id = H5P_DATASET_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset access property list") /* Create the new dataset & get its ID */ if (NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_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 ID 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_DATASET, 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 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 * *------------------------------------------------------------------------- */ hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_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 */ + 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 = 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") /* Get correct property list */ if (H5P_DEFAULT == dapl_id) dapl_id = H5P_DATASET_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset access property list") /* build and open the new dataset */ if (NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, H5AC_dxpl_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 */ if ((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: /* Release the dataset's object header, if it was created */ @@ -266,36 +263,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, H5AC_dxpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, + 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 * *------------------------------------------------------------------------- */ @@ -310,22 +305,22 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) H5O_type_t obj_type; /* Type of object at location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ - 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") + 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") /* Get correct property list */ if (H5P_DEFAULT == dapl_id) dapl_id = H5P_DATASET_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset access property list") /* Set up dataset location to fill in */ dset_loc.oloc = &oloc; @@ -334,49 +329,46 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) /* Find the dataset object */ if (H5G_loc_find(&loc, name, &dset_loc, dapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, H5I_INVALID_HID, "not found") loc_found = TRUE; /* Check that the object found is the correct type */ if (H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "can't get object type") if (obj_type != H5O_TYPE_DATASET) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") /* Open the dataset */ if (NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "can't 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_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if (ret_value < 0) { + if (H5I_INVALID_HID == ret_value) { if (dset) { if (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") } /* end if */ else { if (loc_found && H5G_loc_free(&dset_loc) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") } /* end else */ - } /* end if */ + } FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ /*------------------------------------------------------------------------- - * Function: H5Dclose + * 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: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -392,8 +384,7 @@ H5Dclose(hid_t dset_id) if (NULL == H5I_object_verify(dset_id, H5I_DATASET)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - /* - * 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. * * Pass in TRUE for the 3rd parameter to tell the function to remove @@ -408,52 +399,44 @@ done: } /* end H5Dclose() */ /*------------------------------------------------------------------------- - * 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; + 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") if ((ret_value = H5D_get_space(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get dataspace") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Dget_space() */ /*------------------------------------------------------------------------- - * 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: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -461,14 +444,14 @@ herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) { H5D_t *dset = NULL; - herr_t ret_value = SUCCEED; + 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 */ if (H5D__get_space_status(dset, allocation, H5AC_ind_dxpl_id) < 0) @@ -476,166 +459,161 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) done: FUNC_LEAVE_API(ret_value) -} +} /* H5Dget_space_status() */ /*------------------------------------------------------------------------- - * 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 = H5I_INVALID_HID; /* Return value */ - H5D_t *dset; /* Dataset */ - hid_t ret_value; /* 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") if ((ret_value = H5D_get_type(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get dataspace") done: FUNC_LEAVE_API(ret_value) } /* end H5Dget_type() */ /*------------------------------------------------------------------------- - * 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 + * Programmer: Robb Matzke + * Tuesday, February 3, 1998 * *------------------------------------------------------------------------- */ hid_t H5Dget_create_plist(hid_t dset_id) { - H5D_t *dataset; /* Dataset structure */ - hid_t ret_value = SUCCEED; /* Return value */ + H5D_t *dataset; /* 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 == (dataset = (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 dataset creation property list */ if ((ret_value = H5D_get_create_plist(dataset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "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) } /* end H5Dget_create_plist() */ /*------------------------------------------------------------------------- - * 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 + * Programmer: Neil Fortner + * Wednesday, October 29, 2008 * *------------------------------------------------------------------------- */ hid_t H5Dget_access_plist(hid_t dset_id) { - H5D_t *dset; /* Dataset structure */ - 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 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) } /* end H5Dget_access_plist() */ /*------------------------------------------------------------------------- - * 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 to query */ + 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, H5AC_ind_dxpl_id, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage") @@ -644,24 +622,21 @@ done: } /* end H5Dget_storage_size() */ /*------------------------------------------------------------------------- - * Function: H5Dget_offset - * - * Purpose: Returns the address of dataset in file. + * Function: H5Dget_offset * - * Return: Success: the address of dataset + * Purpose: Returns the address of dataset in file. * - * Failure: HADDR_UNDEF + * Return: Success: The address of dataset * - * 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 to query */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_API(HADDR_UNDEF) H5TRACE1("a", "i", dset_id); @@ -670,7 +645,7 @@ H5Dget_offset(hid_t dset_id) if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset") - /* Set return value */ + /* Get the offset */ ret_value = H5D__get_offset(dset); done: @@ -678,9 +653,9 @@ done: } /* end H5Dget_offset() */ /*------------------------------------------------------------------------- - * Function: H5Diterate + * Function: H5Diterate * - * Purpose: This routine iterates over all the elements selected in a memory + * Purpose: This routine iterates over all the elements selected in a memory * buffer. The callback function is called once for each element selected * in the dataspace. The selection in the dataspace is modified so * that any elements already iterated over are removed from the selection @@ -727,11 +702,11 @@ done: * indicating failure. The iterator can be restarted at the next * element. * - * Return: Returns the return value of the last operator if it was non-zero, + * Return: Returns the return value of the last operator if it was non-zero, * or zero if all elements were processed. Otherwise returns a * negative value. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, June 11, 1999 * *------------------------------------------------------------------------- @@ -817,9 +792,9 @@ done: } /* end H5Dvlen_reclaim() */ /*------------------------------------------------------------------------- - * Function: H5Dvlen_get_buf_size + * Function: H5Dvlen_get_buf_size * - * Purpose: This routine checks the number of bytes required to store the VL + * Purpose: This routine checks the number of bytes required to store the VL * data from the dataset, using the space_id for the selection in the * dataset on disk and the type_id for the memory representation of the * VL data, in memory. The *size value is modified according to how many @@ -833,9 +808,9 @@ done: * Kinda kludgy, but easier than the other method of trying to figure out * the sizes without actually reading the data in... - QAK * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, August 11, 1999 * *------------------------------------------------------------------------- @@ -930,16 +905,13 @@ done: } /* end H5Dvlen_get_buf_size() */ /*------------------------------------------------------------------------- - * Function: H5Dset_extent + * Function: H5Dset_extent * - * Purpose: Modifies the dimensions of a dataset. - * Can change to a smaller dimension. + * Purpose: Modifies the dimensions of a dataset. + * Can change to a smaller dimension. * * Return: Non-negative on success, negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * April 9, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -968,7 +940,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Dget_chunk_storage_size * - * Purpose: Returns the size of an allocated of chunk. + * Purpose: Returns the size of an allocated chunk. * * Return: Non-negative on success, negative on failure * @@ -981,7 +953,7 @@ 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; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes); @@ -997,7 +969,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n 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, H5AC_ind_dxpl_id, 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 eda8eae..f890cd5 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Wednesday, October 8, 1997 * * Purpose: v1 B-tree indexed (chunked) I/O functions. The chunks are @@ -298,10 +298,10 @@ done: static int H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key) { - H5D_btree_key_t * lt_key = (H5D_btree_key_t *)_lt_key; - H5D_btree_key_t * rt_key = (H5D_btree_key_t *)_rt_key; - H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *)_udata; - int ret_value; + H5D_btree_key_t * lt_key = (H5D_btree_key_t *)_lt_key; + H5D_btree_key_t * rt_key = (H5D_btree_key_t *)_rt_key; + H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *)_udata; + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -406,7 +406,6 @@ H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static htri_t H5D__btree_found(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, const void *_lt_key, void *_udata) @@ -467,7 +466,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static H5B_ins_t H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t H5_ATTR_UNUSED *rt_key_changed, @@ -479,7 +477,7 @@ H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t H5D_chunk_ud_t * udata = (H5D_chunk_ud_t *)_udata; int cmp; unsigned u; - H5B_ins_t ret_value; + H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */ FUNC_ENTER_STATIC @@ -578,13 +576,11 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * March 28, 2002 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static H5B_ins_t H5D__btree_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out */, hbool_t *lt_key_changed /*out */, void H5_ATTR_UNUSED *_udata /*in,out */, @@ -694,7 +690,6 @@ H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, const void *_udata) { @@ -873,8 +868,7 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- * Function: H5D__btree_idx_insert * - * Purpose: Create the chunk it if it doesn't exist, or reallocate the - * chunk if its size changed. + * Purpose: Insert chunk entry into the indexing structure. * * Return: Non-negative on success/Negative on failure * @@ -962,7 +956,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static int H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_lt_key, haddr_t addr, const void H5_ATTR_UNUSED *_rt_key, void *_udata) @@ -970,7 +963,7 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5D_btree_it_ud_t * udata = (H5D_btree_it_ud_t *)_udata; /* User data */ const H5D_btree_key_t *lt_key = (const H5D_btree_key_t *)_lt_key; /* B-tree key for chunk */ H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1009,8 +1002,8 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, static int H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata) { - H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */ - int ret_value; /* Return value */ + H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6847e42..7e651bb 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -11,11 +11,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@hdfgroup.org> +/* Programmer: Quincey Koziol * Thursday, April 24, 2008 * * Purpose: Abstract indexed (chunked) I/O functions. The logical - * multi-dimensional data space is regularly partitioned into + * multi-dimensional dataspace is regularly partitioned into * same-sized "chunks", the first of which is aligned with the * logical origin. The chunks are indexed by different methods, * that map a chunk index to disk address. Each chunk can be @@ -374,9 +374,9 @@ done: /*------------------------------------------------------------------------- * Function: H5D__chunk_direct_read * - * Purpose: Internal routine to read a chunk directly from the file. + * Purpose: Internal routine to read a chunk directly from the file. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Matthew Strong (GE Healthcare) * 14 February 2016 @@ -480,9 +480,9 @@ done: /*------------------------------------------------------------------------- * Function: H5D__get_chunk_storage_size * - * Purpose: Internal routine to read the storage size of a chunk on disk. + * Purpose: Internal routine to read the storage size of a chunk on disk. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Matthew Strong (GE Healthcare) * 20 October 2016 @@ -948,22 +948,20 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf if ((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset") - /* Decide the number of chunks in each dimension*/ - for (u = 0; u < f_ndims; u++) { + /* Decide the number of chunks in each dimension */ + for (u = 0; u < f_ndims; u++) /* Keep the size of the chunk dimensions as hsize_t for various routines */ fm->chunk_dim[u] = fm->layout->u.chunk.dim[u]; - } /* end for */ #ifdef H5_HAVE_PARALLEL /* Calculate total chunk in file map*/ fm->select_chunk = NULL; if (io_info->using_mpi_vfd) { H5_CHECK_OVERFLOW(fm->layout->u.chunk.nchunks, hsize_t, size_t); - if (fm->layout->u.chunk.nchunks) { + if (fm->layout->u.chunk.nchunks) if (NULL == (fm->select_chunk = (H5D_chunk_info_t **)H5MM_calloc( (size_t)fm->layout->u.chunk.nchunks * sizeof(H5D_chunk_info_t *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") - } } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -1004,10 +1002,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf HDassert(fm->single_space); /* Allocate the single chunk information */ - if (NULL == dataset->shared->cache.chunk.single_chunk_info) { + if (NULL == dataset->shared->cache.chunk.single_chunk_info) if (NULL == (dataset->shared->cache.chunk.single_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") - } /* end if */ fm->single_chunk_info = dataset->shared->cache.chunk.single_chunk_info; HDassert(fm->single_chunk_info); @@ -1023,10 +1020,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf hbool_t sel_hyper_flag; /* Whether file selection is a hyperslab */ /* Initialize skip list for chunk selections */ - if (NULL == dataset->shared->cache.chunk.sel_chunks) { + if (NULL == dataset->shared->cache.chunk.sel_chunks) if (NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections") - } /* end if */ fm->sel_chunks = dataset->shared->cache.chunk.sel_chunks; HDassert(fm->sel_chunks); @@ -1121,10 +1117,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf fm->mchunk_tmpl = tmp_mspace; /* Create temporary datatypes for selection iteration */ - if (!file_type) { + if (!file_type) if (NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") - } /* end if */ /* Create selection iterator for memory selection */ if (0 == (elmt_size = H5T_get_size(mem_type))) @@ -1165,12 +1160,10 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf done: /* Release the [potentially partially built] chunk mapping information if an error occurs */ if (ret_value < 0) { - if (tmp_mspace && !fm->mchunk_tmpl) { + if (tmp_mspace && !fm->mchunk_tmpl) if (H5S_close(tmp_mspace) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template") - } /* end if */ - if (H5D__chunk_io_term(fm) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping") } /* end if */ @@ -1434,7 +1427,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t hsize_t sel_points; /* Number of elements in file selection */ hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ - hsize_t end[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */ hsize_t chunk_index; /* Index of chunk */ int curr_dim; /* Current dimension to increment */ unsigned u; /* Local index variable */ @@ -1838,7 +1831,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, const hsize_t *coords, void *_fm) @@ -1872,11 +1864,10 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list") /* Check if the chunk already has a memory space */ - if (NULL == chunk_info->mspace) { + if (NULL == chunk_info->mspace) /* Copy the template memory chunk dataspace */ if (NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space") - } /* end else */ /* Update the "last chunk seen" information */ fm->last_index = chunk_index; @@ -2895,10 +2886,10 @@ H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t { const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); size_t total = rdcc->nbytes_max; - const int nmeth = 2; /*number of methods */ - int w[1]; /*weighting as an interval */ - H5D_rdcc_ent_t * p[2], *cur; /*list pointers */ - H5D_rdcc_ent_t * n[2]; /*list next pointers */ + const int nmeth = 2; /* Number of methods */ + int w[1]; /* Weighting as an interval */ + H5D_rdcc_ent_t * p[2], *cur; /* List pointers */ + H5D_rdcc_ent_t * n[2]; /* List next pointers */ int nerrors = 0; /* Accumulated error count during preemptions */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3031,6 +3022,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel FUNC_ENTER_PACKAGE + /* Sanity checks */ HDassert(io_info); HDassert(io_info->dxpl_cache); HDassert(io_info->store); @@ -3165,7 +3157,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel if (ent) { /* - * The chunk is not at the beginning of the cache; move it backward + * If the chunk is not at the beginning of the cache; move it backward * by one slot. This is how we implement the LRU preemption * algorithm. */ @@ -3296,6 +3288,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbo FUNC_ENTER_PACKAGE + /* Sanity check */ HDassert(io_info); HDassert(udata); @@ -3365,7 +3358,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static int H5D__chunk_allocated_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { @@ -3413,11 +3405,10 @@ H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Search for cached chunks that haven't been written out */ - for (ent = rdcc->head; ent; ent = ent->next) { + for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") - } /* end for */ /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -3670,7 +3661,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hs /* 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_realloc(fb_info.fill_buf, orig_chunk_size, pline))) @@ -3983,8 +3975,8 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * March 26, 2002 + * Programmer: Pedro Vicente + * March 26, 2002 * *------------------------------------------------------------------------- */ @@ -4101,7 +4093,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * Algorithm: Robb Matzke * March 27, 2002 * @@ -5321,7 +5313,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static int H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { @@ -5525,10 +5516,10 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers) miss_rate = 0.0; } if (miss_rate > 100) { - sprintf(ascii, "%7d%%", (int)(miss_rate + 0.5)); + HDsprintf(ascii, "%7d%%", (int)(miss_rate + 0.5)); } else { - sprintf(ascii, "%7.2f%%", miss_rate); + HDsprintf(ascii, "%7.2f%%", miss_rate); } HDfprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->nhits, @@ -5613,8 +5604,8 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, siz size_t chunk_len_arr[], hsize_t chunk_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - H5D_chunk_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ - ssize_t ret_value; /* Return value */ + H5D_chunk_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 9183df4..5d1268d 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> + * Programmer: Raymond Lu * August 5, 2002 * * Purpose: Compact dataset I/O functions. These routines are similar @@ -267,7 +267,7 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -309,7 +309,7 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index c301f45..622e425 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: @@ -30,17 +30,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5VMprivate.h" /* Vector and array functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ /* Local Macros */ @@ -364,7 +364,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset) { @@ -387,7 +386,7 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset) /* * The maximum size of the dataset cannot exceed the storage size. - * Also, only the slowest varying dimension of a simple data space + * Also, only the slowest varying dimension of a simple dataspace * can be extendible (currently only for external data storage). */ @@ -446,7 +445,7 @@ done: hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -843,7 +842,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *d size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1175,7 +1174,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - ssize_t ret_value; /* Return value (Size of sequence in bytes) */ + ssize_t ret_value = -1; /* Return value (Size of sequence in bytes) */ FUNC_ENTER_STATIC @@ -1421,6 +1420,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer") } /* end if */ + /* Loop over copying data */ addr_src = storage_src->addr; addr_dst = storage_dst->addr; diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 4658fa2..69d3c99 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -23,10 +23,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 */ /****************/ /* Local Macros */ @@ -73,17 +73,12 @@ H5D__init_dbg_interface(void) } /* H5D__init_dbg_interface() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 13fe91e..12d9542 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -15,7 +15,7 @@ * * Created: H5Ddeprec.c * April 5 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Deprecated functions from the H5D interface. These * functions are here for compatibility purposes and may be @@ -120,28 +120,28 @@ H5D__term_deprec_interface(void) #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, data spaces, 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 @@ -151,56 +151,56 @@ H5D__term_deprec_interface(void) 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 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 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 (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 || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") 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") /* Build and open the new dataset */ if (NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_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 */ if ((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_DATASET, 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 @@ -219,16 +219,16 @@ H5Dopen1(hid_t loc_id, const char *name) hbool_t loc_found = FALSE; /* Location at 'name' found */ hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */ hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ - 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 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") /* Set up dataset location to fill in */ dset_loc.oloc = &oloc; @@ -237,32 +237,32 @@ H5Dopen1(hid_t loc_id, const char *name) /* Find the dataset object */ if (H5G_loc_find(&loc, name, &dset_loc, H5P_DEFAULT, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, H5I_INVALID_HID, "not found") loc_found = TRUE; /* Check that the object found is the correct type */ if (H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "can't get object type") if (obj_type != H5O_TYPE_DATASET) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") /* Open the dataset */ if (NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "can't 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 (dset != NULL) { if (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") } /* end if */ else { if (loc_found && H5G_loc_free(&dset_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") } /* end else */ } /* end if */ @@ -270,15 +270,15 @@ done: } /* 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 @@ -296,7 +296,7 @@ H5Dextend(hid_t dset_id, const hsize_t 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, "invalid dataset identifier") if (!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") diff --git a/src/H5Defl.c b/src/H5Defl.c index 6b721ea..08d118f 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, September 30, 2004 */ @@ -125,7 +125,7 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset) /* * The maximum size of the dataset cannot exceed the storage size. - * Also, only the slowest varying dimension of a simple data space + * Also, only the slowest varying dimension of a simple dataspace * can be extendible (currently only for external data storage). */ @@ -315,9 +315,6 @@ done: * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ static herr_t @@ -443,8 +440,8 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - H5D_efl_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ - ssize_t ret_value; /* Return value (Total size of sequence in bytes) */ + H5D_efl_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ + ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */ FUNC_ENTER_STATIC @@ -524,8 +521,8 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dse size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - H5D_efl_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ - ssize_t ret_value; /* Return value (Total size of sequence in bytes) */ + H5D_efl_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ + ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */ FUNC_ENTER_STATIC diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 92cb96c..41e0b14 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -15,7 +15,7 @@ * * Created: H5Dfill.c * Jun 19 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Fill value operations for datasets * diff --git a/src/H5Dint.c b/src/H5Dint.c index d0c6488..fc47eff 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -23,14 +23,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -110,17 +110,13 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{ }}; /*------------------------------------------------------------------------- - * Function: H5D_init + * Function: H5D_init * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, March 4, 2000 + * Return: Success: non-negative * + * Failure: negative *------------------------------------------------------------------------- */ herr_t @@ -137,7 +133,7 @@ done: /*-------------------------------------------------------------------------- NAME - H5D__init_interface -- Initialize interface-specific information + H5D__init_interface -- Initialize interface-specific information USAGE herr_t H5D__init_interface() @@ -199,14 +195,9 @@ done: * * Purpose: Terminate this interface. * - * Return: Success: Positive if anything was done that might + * Return: Success: Positive if anything was done that might * affect other interfaces; zero otherwise. - * - * Failure: Negative. - * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * + * Failure: Negative. *------------------------------------------------------------------------- */ int @@ -387,26 +378,22 @@ done: } /* H5D__get_dxpl_cache() */ /*------------------------------------------------------------------------- - * Function: H5D__create_named - * - * Purpose: Internal routine to create a new dataset. + * Function: H5D__create_named * - * Return: Success: Non-NULL, pointer to new dataset object. + * Purpose: Internal routine to create a new dataset. * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Thursday, April 5, 2007 + * Return: Success: Non-NULL, pointer to new dataset object. * + * Failure: NULL *------------------------------------------------------------------------- */ 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, hid_t dxpl_id) { - H5O_obj_create_t ocrt_info; /* Information for object creation */ - H5D_obj_create_t dcrt_info; /* Information for dataset creation */ - H5D_t * ret_value; /* Return value */ + H5O_obj_create_t ocrt_info; /* Information for object creation */ + H5D_obj_create_t dcrt_info; /* Information for dataset creation */ + H5D_t * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -450,11 +437,7 @@ done: * * Return: * Success: Non-negative - * * Failture: Negative - * - * Programmer: Raymond Lu - * *------------------------------------------------------------------------- */ herr_t @@ -511,25 +494,20 @@ done: } /* end H5D__get_space_status() */ /*------------------------------------------------------------------------- - * Function: H5D__new - * - * Purpose: Creates a new, empty dataset structure - * - * Return: Success: Pointer to a new dataset descriptor. + * Function: H5D__new * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Monday, October 12, 1998 + * Purpose: Creates a new, empty dataset structure * + * Return: Success: Pointer to a new dataset descriptor. + * Failure: NULL *------------------------------------------------------------------------- */ static H5D_shared_t * H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type) { - H5D_shared_t * new_dset = NULL; /* New dataset object */ - H5P_genplist_t *plist; /* Property list created */ - H5D_shared_t * ret_value; /* Return value */ + H5D_shared_t * new_dset = NULL; /* New dataset object */ + H5P_genplist_t *plist; /* Property list created */ + H5D_shared_t * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -586,17 +564,13 @@ done: } /* end H5D__new() */ /*------------------------------------------------------------------------- - * Function: H5D__init_type + * Function: H5D__init_type * - * Purpose: Copy a datatype for a dataset's use, performing all the + * Purpose: Copy a datatype for a dataset's use, performing all the * necessary adjustments, etc. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Thursday, June 24, 2004 - * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -632,7 +606,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") @@ -664,17 +639,13 @@ done: } /* end H5D__init_type() */ /*------------------------------------------------------------------------- - * Function: H5D__init_space + * Function: H5D__init_space * - * Purpose: Copy a dataspace for a dataset's use, performing all the + * Purpose: Copy a dataspace for a dataset's use, performing all the * necessary adjustments, etc. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Tuesday, July 24, 2007 - * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -711,16 +682,12 @@ done: } /* end H5D__init_space() */ /*------------------------------------------------------------------------- - * Function: H5D__update_oh_info + * Function: H5D__update_oh_info * - * Purpose: Create and fill object header for dataset - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Bill Wendling - * Thursday, October 31, 2002 + * Purpose: Create and fill object header for dataset * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -783,9 +750,8 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) fill_prop->fill_defined = TRUE; } - else if (fill_status == H5D_FILL_VALUE_UNDEFINED) { + else if (fill_status == H5D_FILL_VALUE_UNDEFINED) fill_prop->fill_defined = FALSE; - } else HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined") @@ -919,9 +885,6 @@ done: * should be used. * * Return: SUCCEED/FAIL - * - * Programmer: Steffen Kiess - * October 16, 2015 *-------------------------------------------------------------------------- */ static herr_t @@ -938,6 +901,7 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix FUNC_ENTER_NOAPI_NOINIT + /* Sanity checks */ HDassert(dset); HDassert(dset->oloc.file); @@ -1003,12 +967,7 @@ done: * affecting the dataset. * * Return: Success: Pointer to a new dataset - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * + * Failure: NULL *------------------------------------------------------------------------- */ H5D_t * @@ -1020,7 +979,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ H5G_loc_t dset_loc; /* Dataset location */ - H5D_t * ret_value; /* Return value */ + H5D_t * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1209,17 +1168,13 @@ done: /* *------------------------------------------------------------------------- - * Function: H5D_open + * Function: H5D_open * - * Purpose: Checks if dataset is already open, or opens a dataset for + * Purpose: Checks if dataset is already open, or opens a dataset for * access. * - * Return: Success: Dataset ID - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Friday, December 20, 2002 - * + * Return: Success: Dataset ID + * Failure: FAIL *------------------------------------------------------------------------- */ H5D_t * @@ -1331,15 +1286,11 @@ done: } /* end H5D_open() */ /*------------------------------------------------------------------------- - * Function: H5D__open_oid + * Function: H5D__open_oid * - * Purpose: Opens a dataset for access. - * - * Return: Dataset pointer on success, NULL on failure - * - * Programmer: Quincey Koziol - * Monday, October 12, 1998 + * Purpose: Opens a dataset for access. * + * Return: Dataset pointer on success, NULL on failure *------------------------------------------------------------------------- */ static herr_t @@ -1488,17 +1439,13 @@ done: } /* end H5D__open_oid() */ /*------------------------------------------------------------------------- - * Function: H5D_close - * - * Purpose: Insures that all data has been saved to the file, closes the - * dataset object header, and frees all resources used by the - * descriptor. + * Function: H5D_close * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Purpose: Insures that all data has been saved to the file, closes the + * dataset object header, and frees all resources used by the + * descriptor. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1520,6 +1467,7 @@ H5D_close(H5D_t *dataset) dataset->shared->fo_count--; if (dataset->shared->fo_count == 0) { + /* Flush the dataset's information. Continue to close even if it fails. */ if (H5D__flush_real(dataset, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") @@ -1610,8 +1558,8 @@ H5D_close(H5D_t *dataset) * above). */ dataset->oloc.file = NULL; + dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); - dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -1646,16 +1594,12 @@ done: } /* end H5D_close() */ /*------------------------------------------------------------------------- - * Function: H5D_oloc - * - * Purpose: Returns a pointer to the object location for a dataset. + * Function: H5D_oloc * - * Return: Success: Ptr to location - * Failure: NULL - * - * Programmer: Robb Matzke - * Friday, April 24, 1998 + * Purpose: Returns a pointer to the object location for a dataset. * + * Return: Success: Ptr to location + * Failure: NULL *------------------------------------------------------------------------- */ H5O_loc_t * @@ -1668,16 +1612,12 @@ H5D_oloc(H5D_t *dataset) } /* end H5D_oloc() */ /*------------------------------------------------------------------------- - * Function: H5D_nameof - * - * Purpose: Returns a pointer to the group hier. path for a dataset. - * - * Return: Success: Ptr to entry - * Failure: NULL + * Function: H5D_nameof * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 + * Purpose: Returns a pointer to the group hier. path for a dataset. * + * Return: Success: Ptr to entry + * Failure: NULL *------------------------------------------------------------------------- */ H5G_name_t * @@ -1690,17 +1630,13 @@ H5D_nameof(H5D_t *dataset) } /* end H5D_nameof() */ /*------------------------------------------------------------------------- - * Function: H5D_typeof + * Function: H5D_typeof * - * Purpose: Returns a pointer to the dataset's datatype. The datatype - * is not copied. - * - * Return: Success: Ptr to the dataset's datatype, uncopied. - * Failure: NULL - * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 + * Purpose: Returns a pointer to the dataset's datatype. The datatype + * is not copied. * + * Return: Success: Ptr to the dataset's datatype, uncopied. + * Failure: NULL *------------------------------------------------------------------------- */ H5T_t * @@ -1717,15 +1653,11 @@ H5D_typeof(const H5D_t *dset) } /* end H5D_typeof() */ /*------------------------------------------------------------------------- - * Function: H5D__alloc_storage - * - * Purpose: Allocate storage for the raw data of a dataset. + * Function: H5D__alloc_storage * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Friday, January 16, 1998 + * Purpose: Allocate storage for the raw data of a dataset. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1884,17 +1816,13 @@ done: } /* end H5D__alloc_storage() */ /*------------------------------------------------------------------------- - * Function: H5D__init_storage - * - * Purpose: Initialize the data for a new dataset. If a selection is - * defined for SPACE then initialize only that part of the - * dataset. - * - * Return: Non-negative on success/Negative on failure + * Function: H5D__init_storage * - * Programmer: Robb Matzke - * Monday, October 5, 1998 + * Purpose: Initialize the data for a new dataset. If a selection is + * defined for SPACE then initialize only that part of the + * dataset. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1957,16 +1885,12 @@ done: } /* end H5D__init_storage() */ /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size + * Function: H5D__get_storage_size * - * Purpose: Determines how much space has been reserved to store the raw - * data of a dataset. - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 + * Purpose: Determines how much space has been reserved to store the raw + * data of a dataset. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2012,15 +1936,12 @@ done: /*------------------------------------------------------------------------- * Function: H5D__get_offset * - * Purpose: Private function for H5D__get_offset. Returns the address + * Purpose: Private function for H5Dget_offset(). Returns the address * of dataset in file. * - * Return: Success: the address of dataset - * - * Failure: HADDR_UNDEF + * Return: Success: The address of dataset * - * Programmer: Raymond Lu - * November 6, 2002 + * Failure: HADDR_UNDEF (but also a valid value) * *------------------------------------------------------------------------- */ @@ -2040,7 +1961,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. */ @@ -2051,25 +1973,21 @@ 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) } /* end H5D__get_offset() */ /*------------------------------------------------------------------------- - * Function: H5D_vlen_reclaim + * Function: H5D_vlen_reclaim * - * Purpose: Frees the buffers allocated for storing variable-length data - * in memory. Only frees the VL data in the selection defined in the - * dataspace. The dataset transfer property list is required to find the - * correct allocation/free methods for the VL data in the buffer. - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, November 22, 2005 + * Purpose: Frees the buffers allocated for storing variable-length data + * in memory. Only frees the VL data in the selection defined in the + * dataspace. The dataset transfer property list is required to find the + * correct allocation/free methods for the VL data in the buffer. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2108,25 +2026,21 @@ done: } /* end H5D_vlen_reclaim() */ /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size_alloc - * - * Purpose: This routine makes certain there is enough space in the temporary - * buffer for the new data to read in. All the VL data read in is actually - * placed in this buffer, overwriting the previous data. Needless to say, - * this data is not actually usable. + * Function: H5D__vlen_get_buf_size_alloc * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, August 17, 1999 + * Purpose: This routine makes certain there is enough space in the temporary + * buffer for the new data to read in. All the VL data read in is actually + * placed in this buffer, overwriting the previous data. Needless to say, + * this data is not actually usable. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ void * H5D__vlen_get_buf_size_alloc(size_t size, void *info) { H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)info; - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2141,14 +2055,14 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) } /* end H5D__vlen_get_buf_size_alloc() */ /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size + * Function: H5D__vlen_get_buf_size * - * Purpose: This routine checks the number of bytes required to store a single - * element from a dataset in memory, creating a selection with just the - * single element selected to read in the element and using a custom memory - * allocator for any VL data encountered. - * The *size value is modified according to how many bytes are - * required to store the element in memory. + * Purpose: This routine checks the number of bytes required to store a single + * element from a dataset in memory, creating a selection with just the + * single element selected to read in the element and using a custom memory + * allocator for any VL data encountered. + * The *size value is modified according to how many bytes are + * required to store the element in memory. * * Implementation: This routine actually performs the read with a custom * memory manager which basically just counts the bytes requested and @@ -2158,14 +2072,9 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) * Kinda kludgy, but easier than the other method of trying to figure out * the sizes without actually reading the data in... - QAK * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, August 17, 1999 - * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ -/* ARGSUSED */ herr_t H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data) @@ -2202,15 +2111,11 @@ done: } /* end H5D__vlen_get_buf_size() */ /*------------------------------------------------------------------------- - * Function: H5D__check_filters + * Function: H5D__check_filters * - * Purpose: Check if the filters have be initialized for the dataset - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, October 11, 2007 + * Purpose: Check if the filters have be initialized for the dataset * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2255,16 +2160,12 @@ done: } /* end H5D__check_filters() */ /*------------------------------------------------------------------------- - * Function: H5D__set_extent - * - * Purpose: Based on H5D_extend, allows change to a lower dimension, - * calls H5S_set_extent and H5D__chunk_prune_by_extent instead + * Function: H5D__set_extent * - * Return: Non-negative on success, negative on failure - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * April 9, 2002 + * Purpose: Based on H5D_extend, allows change to a lower dimension, + * calls H5S_set_extent and H5D__chunk_prune_by_extent instead * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2328,7 +2229,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) */ /* Update the index values for the cached chunks for this dataset */ if (H5D_CHUNKED == dset->shared->layout.type) { - /* Update the cached chunk info */ + /* Set the cached chunk info */ if (H5D__chunk_set_info(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks") if (H5D__chunk_update_cache(dset, dxpl_id) < 0) @@ -2364,16 +2265,12 @@ done: } /* end H5D__set_extent() */ /*------------------------------------------------------------------------- - * Function: H5D__flush_sieve_buf - * - * Purpose: Flush any dataset sieve buffer info cached in memory - * - * Return: Success: Non-negative - * Failure: Negative + * Function: H5D__flush_sieve_buf * - * Programmer: Quincey Koziol - * July 27, 2009 + * Purpose: Flush any dataset sieve buffer info cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2406,16 +2303,12 @@ done: } /* end H5D__flush_sieve_buf() */ /*------------------------------------------------------------------------- - * Function: H5D__flush_real - * - * Purpose: Flush any dataset information cached in memory - * - * Return: Success: Non-negative - * Failure: Negative + * Function: H5D__flush_real * - * Programmer: Quincey Koziol - * December 6, 2007 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2508,16 +2401,12 @@ H5D__mark(const H5D_t *dataset, hid_t H5_ATTR_UNUSED dxpl_id, unsigned flags) } /* end H5D__mark() */ /*------------------------------------------------------------------------- - * Function: H5D__flush_cb - * - * Purpose: Flush any dataset information cached in memory + * Function: H5D__flush_cb * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 8, 2007 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ static int @@ -2544,16 +2433,12 @@ done: } /* end H5D__flush_cb() */ /*------------------------------------------------------------------------- - * Function: H5D_flush - * - * Purpose: Flush any dataset information cached in memory - * - * Return: Success: Non-negative - * Failure: Negative + * Function: H5D_flush * - * Programmer: Ray Lu - * August 14, 2002 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2580,19 +2465,14 @@ done: } /* end H5D_flush() */ /*------------------------------------------------------------------------- - * Function: H5D_get_create_plist + * Function: H5D_get_create_plist * - * Purpose: Private function for H5Dget_create_plist + * Purpose: Private function for H5Dget_create_plist * - * Return: Success: ID for a copy of the dataset creation + * Return: Success: ID for a copy of the dataset creation * property list. The template should be * released by calling H5P_close(). - * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 - * + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -2602,7 +2482,7 @@ H5D_get_create_plist(H5D_t *dset) H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */ H5O_fill_t copied_fill; /* Fill value to tweak */ hid_t new_dcpl_id = FAIL; - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2699,18 +2579,13 @@ done: } /* end H5D_get_create_plist() */ /*------------------------------------------------------------------------- - * Function: H5D_get_access_plist - * - * Purpose: Returns a copy of the dataset access property list. + * Function: H5D_get_access_plist * - * Return: Success: ID for a copy of the dataset access - * property list. - * - * Failure: FAIL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns a copy of the dataset access property list. * + * Return: Success: ID for a copy of the dataset access + * property list. + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -2772,40 +2647,34 @@ H5D_get_access_plist(H5D_t *dset) ret_value = new_dapl_id; done: - if (ret_value < 0) { + if (ret_value < 0) if (new_dapl_id > 0) if (H5I_dec_app_ref(new_dapl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_get_access_plist() */ /*------------------------------------------------------------------------- - * Function: H5D_get_space - * - * Purpose: Returns and ID for the dataspace of the dataset. + * Function: H5D_get_space * - * Return: Success: ID for dataspace - * - * Failure: FAIL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns and ID for the dataspace of the dataset. * + * Return: Success: ID for dataspace + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5D_get_space(H5D_t *dset) { H5S_t *space = NULL; - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT - /* Read the data space message and return a data space object */ + /* Read the dataspace message and return a dataspace object */ if (NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get data space") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") /* Create an atom */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) @@ -2821,16 +2690,12 @@ done: } /* end H5D_get_space() */ /*------------------------------------------------------------------------- - * Function: H5D_get_type + * Function: H5D_get_type * - * Purpose: Returns and ID for the datatype of the dataset. + * Purpose: Returns and ID for the datatype of the dataset. * - * Return: Success: ID for datatype - * - * Failure: FAIL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Return: Success: ID for datatype + * Failure: FAIL * *------------------------------------------------------------------------- */ @@ -2862,10 +2727,9 @@ H5D_get_type(H5D_t *dset) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") done: - if (ret_value < 0) { + if (ret_value < 0) if (dt && H5T_close(dt) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_get_type() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index a5025fe..39dcb5e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -84,30 +84,30 @@ H5FL_BLK_DEFINE(type_conv); /*------------------------------------------------------------------------- * 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 - * 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. + * 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 + * 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. * - * The FILE_SPACE_ID can be the constant H5S_ALL which indicates - * that the entire file data space is to be referenced. + * The FILE_SPACE_ID can be the constant H5S_ALL which indicates + * that the entire file dataspace is to be referenced. * - * The MEM_SPACE_ID can be the constant H5S_ALL in which case - * the memory data space is the same as the file data space - * defined when the dataset was created. + * The MEM_SPACE_ID can be the constant H5S_ALL in which case + * the memory dataspace is the same as the file dataspace + * defined when the dataset was created. * - * The number of elements in the memory data space must match - * the number of elements in the file data space. + * The number of elements in the memory dataspace must match + * the number of elements in the file dataspace. * - * The PLIST_ID can be the constant H5P_DEFAULT in which - * case the default data transfer properties are used. + * 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: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ @@ -219,31 +219,31 @@ done: /*------------------------------------------------------------------------- * Function: H5Dwrite * - * Purpose: Writes (part of) a DSET from application memory BUF to the - * file. The part of the dataset to write is defined with the - * MEM_SPACE_ID and FILE_SPACE_ID arguments. The data points - * are converted from their current type (MEM_TYPE_ID) to their - * file datatype. Additional miscellaneous data transfer - * properties can be passed to this function with the - * PLIST_ID argument. + * Purpose: Writes (part of) a DSET from application memory BUF to the + * file. The part of the dataset to write is defined with the + * MEM_SPACE_ID and FILE_SPACE_ID arguments. The data points + * are converted from their current type (MEM_TYPE_ID) to their + * file datatype. Additional miscellaneous data transfer + * properties can be passed to this function with the + * PLIST_ID argument. * - * The FILE_SPACE_ID can be the constant H5S_ALL which indicates - * that the entire file data space is to be referenced. + * The FILE_SPACE_ID can be the constant H5S_ALL which indicates + * that the entire file dataspace is to be referenced. * - * The MEM_SPACE_ID can be the constant H5S_ALL in which case - * the memory data space is the same as the file data space - * defined when the dataset was created. + * The MEM_SPACE_ID can be the constant H5S_ALL in which case + * the memory dataspace is the same as the file dataspace + * defined when the dataset was created. * - * The number of elements in the memory data space must match - * the number of elements in the file data space. + * The number of elements in the memory dataspace must match + * the number of elements in the file dataspace. * - * The PLIST_ID can be the constant H5P_DEFAULT in which - * case the default data transfer properties are used. + * 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: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ @@ -261,7 +261,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); - /* check arguments */ + /* Get dataset pointer and ensure it's associated with a file */ 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->oloc.file) @@ -994,8 +994,7 @@ H5D__typeinfo_init(const H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t type_info->dst_type_id = mem_type_id; } /* end else */ - /* - * Locate the type conversion function and data space 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 @@ -1066,8 +1065,7 @@ H5D__typeinfo_init(const H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t if (type_info->request_nelmts == 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small") - /* - * Get a temporary buffer for type conversion unless the app has already + /* Get a temporary buffer for type conversion unless the app has already * supplied one through the xfer properties. Instead of allocating a * buffer which is the exact size, we allocate the target size. The * malloc() is usually less resource-intensive if we allocate/free the diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 71f64ba..7187590 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -20,10 +20,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLprivate.h" /* Local heaps */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLprivate.h" /* Local heaps */ /****************/ /* Local Macros */ @@ -50,15 +50,15 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5D__layout_set_io_ops + * Function: H5D__layout_set_io_ops * - * Purpose: Set the I/O operation function pointers for a dataset, + * Purpose: Set the I/O operation function pointers for a dataset, * according to the dataset's layout * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 + * Programmer: Quincey Koziol + * Thursday, March 20, 2008 * *------------------------------------------------------------------------- */ @@ -121,7 +121,7 @@ done: size_t H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data) { - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_PACKAGE @@ -134,6 +134,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ switch (layout->type) { case H5D_COMPACT: + /* This information only present in older versions of message */ /* Size of raw data */ ret_value += 2; if (include_compact_data) @@ -141,6 +142,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ break; case H5D_CONTIGUOUS: + /* This information only present in older versions of message */ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */ break; @@ -168,15 +170,15 @@ done: } /* end H5D__layout_meta_size() */ /*------------------------------------------------------------------------- - * Function: H5D__layout_oh_create + * Function: H5D__layout_oh_create * - * Purpose: Create layout/pline/efl information for dataset + * Purpose: Create layout/pline/efl information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ @@ -298,15 +300,15 @@ done: } /* end H5D__layout_oh_create() */ /*------------------------------------------------------------------------- - * Function: H5D__layout_oh_read + * Function: H5D__layout_oh_read * - * Purpose: Read layout/pline/efl information for dataset + * Purpose: Read layout/pline/efl information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ @@ -441,15 +443,15 @@ done: } /* end H5D__layout_oh_read() */ /*------------------------------------------------------------------------- - * Function: H5D__layout_oh_write + * Function: H5D__layout_oh_write * - * Purpose: Write layout/pline/efl information for dataset + * Purpose: Write layout information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index de60f6c..a2a5514 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -133,7 +133,7 @@ static herr_t H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_ch * Purpose: Checks if an direct I/O transfer is possible between memory and * the file. * - * Return: Sauccess: Non-negative: TRUE or FALSE + * Return: Success: Non-negative: TRUE or FALSE * Failure: Negative * * Programmer: Quincey Koziol @@ -758,11 +758,6 @@ done: * Programmer: Muqun Yang * Monday, Feb. 13th, 2006 * - * Modification: - * - Set H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME and H5D_MPIO_ACTUAL_IO_MODE_NAME - * dxpl in this. - * Programmer: Jonathan Kim - * Date: 2012-10-10 *------------------------------------------------------------------------- */ static herr_t @@ -1101,12 +1096,6 @@ done: * Programmer: Muqun Yang * Monday, Feb. 13th, 2006 * - * Modification: - * - Set H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME dxpl in this to go along with - * setting H5D_MPIO_ACTUAL_IO_MODE_NAME dxpl at the bottom. - * Programmer: Jonathan Kim - * Date: 2012-10-10 - * *------------------------------------------------------------------------- */ static herr_t @@ -1473,7 +1462,7 @@ done: static int H5D__cmp_chunk_addr(const void *chunk_addr_info1, const void *chunk_addr_info2) { - haddr_t addr1, addr2; + haddr_t addr1 = HADDR_UNDEF, addr2 = HADDR_UNDEF; FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Doh.c b/src/H5Doh.c index 87cffd7..286ba41 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -95,7 +95,7 @@ H5FL_DEFINE(H5D_copy_file_ud_t); static void * H5O__dset_get_copy_file_udata(void) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -259,9 +259,9 @@ done: static void * H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) { - H5D_obj_create_t *crt_info = (H5D_obj_create_t *)_crt_info; /* Dataset creation parameters */ - H5D_t * dset = NULL; /* New dataset created */ - void * ret_value; /* Return value */ + H5D_obj_create_t *crt_info = (H5D_obj_create_t *)_crt_info; /* Dataset creation parameters */ + H5D_t * dset = NULL; /* New dataset created */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -308,8 +308,8 @@ done: static H5O_loc_t * H5O__dset_get_oloc(hid_t obj_id) { - H5D_t * dset; /* Dataset opened */ - H5O_loc_t *ret_value; /* Return value */ + H5D_t * dset; /* Dataset opened */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -337,10 +337,6 @@ done: * Programmer: Vailin Choi * July 11, 2007 * - * Modification:Raymond Lu - * 5 February, 2010 - * I added the call to H5O_msg_reset after H5D_chunk_bh_info - * to free the PLINE. *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index a730531..678c062 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * Monday, April 14, 2003 + * Programmer: Quincey Koziol + * Monday, April 14, 2003 * - * Purpose: This file contains declarations which are visible only within - * the H5D package. Source files outside the H5D package should - * include H5Dprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5D package. Source files outside the H5D package should + * include H5Dprivate.h instead. */ #ifndef H5D_PACKAGE #error "Do not include this file outside the H5D package!" @@ -30,10 +30,10 @@ #include "H5Dprivate.h" /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Gprivate.h" /* Groups */ -#include "H5SLprivate.h" /* Skip lists */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Gprivate.h" /* Groups */ +#include "H5SLprivate.h" /* Skip lists */ +#include "H5Tprivate.h" /* Datatypes */ /**************************/ /* Package Private Macros */ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index d1d1bfa..ce94f9c 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -21,10 +21,10 @@ #include "H5Dpublic.h" /* Private headers needed by this file */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ -#include "H5Zprivate.h" /* Data filters */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Zprivate.h" /* Data filters */ /**************************/ /* Library Private Macros */ @@ -32,8 +32,8 @@ /* * Feature: Define H5D_DEBUG on the compiler command line if you want to - * debug dataset I/O. NDEBUG must not be defined in order for this - * to have any effect. + * debug dataset I/O. NDEBUG must not be defined in order for this + * to have any effect. */ #ifdef NDEBUG #undef H5D_DEBUG diff --git a/src/H5Dselect.c b/src/H5Dselect.c index 6169f5f..1a3a0b5 100644 --- a/src/H5Dselect.c +++ b/src/H5Dselect.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.ued> +/* Programmer: Quincey Koziol * Thursday, September 30, 2004 * * Purpose: Dataspace I/O functions. diff --git a/src/H5Dtest.c b/src/H5Dtest.c index ea17072..4a167cd 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Thursday, May 27, 2004 * * Purpose: Dataset testing functions. @@ -27,10 +27,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 */ /****************/ /* Local Macros */ @@ -51,11 +51,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 "H5Epkg.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -134,13 +134,11 @@ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ }}; /*------------------------------------------------------------------------- - * 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 @@ -252,14 +250,14 @@ done: } /* end H5E_init_interface() */ /*------------------------------------------------------------------------- - * Function: H5E_term_interface + * Function: H5E_term_interface * - * 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 @@ -328,14 +326,14 @@ H5E_term_interface(void) #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 @@ -345,7 +343,7 @@ H5E_term_interface(void) H5E_t * H5E_get_stack(void) { - H5E_t *estack; + H5E_t *estack = NULL; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -354,10 +352,13 @@ H5E_get_stack(void) if (!estack) { /* No associated value with current thread - create one */ #ifdef H5_HAVE_WIN_THREADS - estack = (H5E_t *)LocalAlloc( - LPTR, sizeof(H5E_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ + /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ + estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); #else - estack = (H5E_t *)H5FL_MALLOC(H5E_t); + /* Use HDmalloc here since this has to match the HDfree in the + * destructor and we want to avoid the codestack there. + */ + estack = (H5E_t *)HDmalloc(sizeof(H5E_t)); #endif /* H5_HAVE_WIN_THREADS */ HDassert(estack); @@ -378,11 +379,11 @@ H5E_get_stack(void) #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 @@ -407,11 +408,12 @@ H5E_free_class(H5E_cls_t *cls) } /* end H5E_free_class() */ /*------------------------------------------------------------------------- - * 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 @@ -421,34 +423,35 @@ H5E_free_class(H5E_cls_t *cls) 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 */ + H5E_cls_t *cls; /* Pointer to error class */ + 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") + 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) } /* end H5Eregister_class() */ /*------------------------------------------------------------------------- - * 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 @@ -458,8 +461,8 @@ done: static H5E_cls_t * 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; /* Return value */ + H5E_cls_t *cls = NULL; /* Pointer to error class */ + H5E_cls_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -492,13 +495,13 @@ done: } /* 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: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 11, 2003 * *------------------------------------------------------------------------- @@ -527,11 +530,11 @@ done: } /* end H5Eunregister_class() */ /*------------------------------------------------------------------------- - * 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 @@ -561,12 +564,12 @@ done: } /* 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 @@ -576,31 +579,31 @@ done: 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 */ + H5E_cls_t *cls; /* Pointer to error class */ + 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") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error class name") done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_class_name() */ /*------------------------------------------------------------------------- - * 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 @@ -610,7 +613,7 @@ done: static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) { - ssize_t len; /* Length of error class's name */ + ssize_t len = -1; /* Length of error class's name */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -669,11 +672,11 @@ done: } /* 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 @@ -701,11 +704,11 @@ done: } /* end H5Eclose_msg() */ /*------------------------------------------------------------------------- - * 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 @@ -729,11 +732,12 @@ H5E_close_msg(H5E_msg_t *err) } /* 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 @@ -743,41 +747,42 @@ H5E_close_msg(H5E_msg_t *err) hid_t 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 */ + H5E_cls_t *cls; /* Pointer to error class */ + H5E_msg_t *msg; /* Pointer to new error message */ + 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") + 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 @@ -787,8 +792,8 @@ done: static H5E_msg_t * 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; /* Return value */ + H5E_msg_t *msg = NULL; /* Pointer to new error message */ + H5E_msg_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -819,12 +824,12 @@ done: } /* 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 @@ -834,30 +839,31 @@ done: 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 */ + H5E_msg_t *msg; /* Pointer to error message */ + 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") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error message text") done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_msg() */ /*------------------------------------------------------------------------- - * 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 @@ -867,34 +873,35 @@ done: hid_t H5Ecreate_stack(void) { - H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + H5E_t *stk; /* Error stack */ + 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); /* 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) } /* end H5Ecreate_stack() */ /*------------------------------------------------------------------------- - * 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 @@ -904,31 +911,32 @@ done: hid_t H5Eget_current_stack(void) { - H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + H5E_t *stk; /* Error stack */ + 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") + 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) } /* end H5Eget_current_stack() */ /*------------------------------------------------------------------------- - * 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 @@ -941,7 +949,7 @@ 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; /* Return value */ + H5E_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1001,21 +1009,16 @@ done: } /* 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: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 15, 2003 * - * Modification: - * Raymond Lu - * 7 September 2010 - * Also closes the stack to avoid potential problem (bug 1799) - * *------------------------------------------------------------------------- */ herr_t @@ -1048,11 +1051,11 @@ done: } /* end H5Eset_current_stack() */ /*------------------------------------------------------------------------- - * 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 @@ -1112,13 +1115,13 @@ done: } /* 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: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 14, 2003 * *------------------------------------------------------------------------- @@ -1149,11 +1152,11 @@ done: } /* end H5Eclose_stack() */ /*------------------------------------------------------------------------- - * 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 @@ -1178,11 +1181,12 @@ H5E_close_stack(H5E_t *estack) } /* 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 @@ -1196,14 +1200,14 @@ 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") + 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 */ @@ -1211,23 +1215,24 @@ 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") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors") done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_num() */ /*------------------------------------------------------------------------- - * 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 @@ -1245,13 +1250,13 @@ H5E_get_num(const H5E_t *estack) } /* 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: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1294,22 +1299,22 @@ done: } /* end H5Epop() */ /*------------------------------------------------------------------------- - * 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: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * 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. * *------------------------------------------------------------------------- @@ -1349,7 +1354,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid */ /* Format the description */ - va_start(ap, fmt); + HDva_start(ap, fmt); va_started = TRUE; #ifdef H5_HAVE_VASPRINTF @@ -1365,8 +1370,8 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ while ((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { /* shutdown & restart the va_list */ - va_end(ap); - va_start(ap, fmt); + HDva_end(ap); + HDva_start(ap, fmt); /* Release the previous description, it's too small */ H5MM_xfree(tmp); @@ -1384,21 +1389,29 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid done: if (va_started) - va_end(ap); + HDva_end(ap); +#ifdef H5_HAVE_VASPRINTF + /* Memory was allocated with HDvasprintf so it needs to be freed + * with HDfree + */ + if (tmp) + HDfree(tmp); +#else /* H5_HAVE_VASPRINTF */ if (tmp) H5MM_xfree(tmp); +#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ /*------------------------------------------------------------------------- - * 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: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1433,16 +1446,16 @@ done: } /* end H5Eclear2() */ /*------------------------------------------------------------------------- - * 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 their + * own more specific error handlers. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1480,14 +1493,14 @@ done: } /* end H5Eprint2() */ /*------------------------------------------------------------------------- - * 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: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1528,23 +1541,18 @@ done: } /* end H5Ewalk2() */ /*------------------------------------------------------------------------- - * 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: Non-negative value on success/Negative on failure * * 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 @@ -1583,28 +1591,25 @@ done: } /* end H5Eget_auto2() */ /*------------------------------------------------------------------------- - * 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: Non-negative value on success/Negative on failure * * 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 @@ -1651,14 +1656,14 @@ done: } /* end H5Eset_auto2() */ /*------------------------------------------------------------------------- - * 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: Non-negative value on success/Negative on failure * * Programmer: Quincey Koziol * Wednesday, September 8, 2004 diff --git a/src/H5Edefin.h b/src/H5Edefin.h index e3f65d3..728224f 100644 --- a/src/H5Edefin.h +++ b/src/H5Edefin.h @@ -14,200 +14,201 @@ /* Generated automatically by bin/make_err -- do not edit */ /* Add new errors to H5err.txt file */ + #ifndef _H5Edefin_H #define _H5Edefin_H /* Major error IDs */ -hid_t H5E_DATASET_g = FAIL; /* Dataset */ -hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ -hid_t H5E_STORAGE_g = FAIL; /* Data storage */ -hid_t H5E_FILE_g = FAIL; /* File accessibilty */ -hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */ -hid_t H5E_SYM_g = FAIL; /* Symbol table */ -hid_t H5E_PLUGIN_g = FAIL; /* Plugin for dynamically loaded library */ -hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */ -hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */ -hid_t H5E_BTREE_g = FAIL; /* B-Tree node */ -hid_t H5E_REFERENCE_g = FAIL; /* References */ -hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */ -hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */ -hid_t H5E_PLIST_g = FAIL; /* Property lists */ -hid_t H5E_LINK_g = FAIL; /* Links */ -hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ -hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */ -hid_t H5E_HEAP_g = FAIL; /* Heap */ -hid_t H5E_OHDR_g = FAIL; /* Object header */ -hid_t H5E_ATOM_g = FAIL; /* Object atom */ -hid_t H5E_ATTR_g = FAIL; /* Attribute */ -hid_t H5E_NONE_MAJOR_g = FAIL; /* No error */ -hid_t H5E_IO_g = FAIL; /* Low-level I/O */ -hid_t H5E_SLIST_g = FAIL; /* Skip Lists */ -hid_t H5E_EFL_g = FAIL; /* External file list */ -hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */ -hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */ -hid_t H5E_ERROR_g = FAIL; /* Error API */ -hid_t H5E_PLINE_g = FAIL; /* Data filters */ -hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */ -hid_t H5E_CACHE_g = FAIL; /* Object cache */ +hid_t H5E_DATASET_g = FAIL; /* Dataset */ +hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ +hid_t H5E_STORAGE_g = FAIL; /* Data storage */ +hid_t H5E_FILE_g = FAIL; /* File accessibility */ +hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */ +hid_t H5E_SYM_g = FAIL; /* Symbol table */ +hid_t H5E_PLUGIN_g = FAIL; /* Plugin for dynamically loaded library */ +hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */ +hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */ +hid_t H5E_BTREE_g = FAIL; /* B-Tree node */ +hid_t H5E_REFERENCE_g = FAIL; /* References */ +hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */ +hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */ +hid_t H5E_PLIST_g = FAIL; /* Property lists */ +hid_t H5E_LINK_g = FAIL; /* Links */ +hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ +hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */ +hid_t H5E_HEAP_g = FAIL; /* Heap */ +hid_t H5E_OHDR_g = FAIL; /* Object header */ +hid_t H5E_ATOM_g = FAIL; /* Object atom */ +hid_t H5E_ATTR_g = FAIL; /* Attribute */ +hid_t H5E_NONE_MAJOR_g = FAIL; /* No error */ +hid_t H5E_IO_g = FAIL; /* Low-level I/O */ +hid_t H5E_SLIST_g = FAIL; /* Skip Lists */ +hid_t H5E_EFL_g = FAIL; /* External file list */ +hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */ +hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */ +hid_t H5E_ERROR_g = FAIL; /* Error API */ +hid_t H5E_PLINE_g = FAIL; /* Data filters */ +hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */ +hid_t H5E_CACHE_g = FAIL; /* Object cache */ /* Minor error IDs */ /* Generic low-level file I/O errors */ -hid_t H5E_SEEKERROR_g = FAIL; /* Seek failed */ -hid_t H5E_READERROR_g = FAIL; /* Read failed */ -hid_t H5E_WRITEERROR_g = FAIL; /* Write failed */ -hid_t H5E_CLOSEERROR_g = FAIL; /* Close failed */ -hid_t H5E_OVERFLOW_g = FAIL; /* Address overflowed */ -hid_t H5E_FCNTL_g = FAIL; /* File control (fcntl) failed */ +hid_t H5E_SEEKERROR_g = FAIL; /* Seek failed */ +hid_t H5E_READERROR_g = FAIL; /* Read failed */ +hid_t H5E_WRITEERROR_g = FAIL; /* Write failed */ +hid_t H5E_CLOSEERROR_g = FAIL; /* Close failed */ +hid_t H5E_OVERFLOW_g = FAIL; /* Address overflowed */ +hid_t H5E_FCNTL_g = FAIL; /* File control (fcntl) failed */ /* Resource errors */ -hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */ -hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate space */ -hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */ -hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */ -hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */ -hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */ -hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */ -hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */ -hid_t H5E_CANTGETSIZE_g = FAIL; /* Unable to compute size */ -hid_t H5E_OBJOPEN_g = FAIL; /* Object is already open */ +hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */ +hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate space */ +hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */ +hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */ +hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */ +hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */ +hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */ +hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */ +hid_t H5E_CANTGETSIZE_g = FAIL; /* Unable to compute size */ +hid_t H5E_OBJOPEN_g = FAIL; /* Object is already open */ /* Heap errors */ -hid_t H5E_CANTRESTORE_g = FAIL; /* Can't restore condition */ -hid_t H5E_CANTCOMPUTE_g = FAIL; /* Can't compute value */ -hid_t H5E_CANTEXTEND_g = FAIL; /* Can't extend heap's space */ -hid_t H5E_CANTATTACH_g = FAIL; /* Can't attach object */ -hid_t H5E_CANTUPDATE_g = FAIL; /* Can't update object */ -hid_t H5E_CANTOPERATE_g = FAIL; /* Can't operate on object */ +hid_t H5E_CANTRESTORE_g = FAIL; /* Can't restore condition */ +hid_t H5E_CANTCOMPUTE_g = FAIL; /* Can't compute value */ +hid_t H5E_CANTEXTEND_g = FAIL; /* Can't extend heap's space */ +hid_t H5E_CANTATTACH_g = FAIL; /* Can't attach object */ +hid_t H5E_CANTUPDATE_g = FAIL; /* Can't update object */ +hid_t H5E_CANTOPERATE_g = FAIL; /* Can't operate on object */ /* Function entry/exit interface errors */ -hid_t H5E_CANTINIT_g = FAIL; /* Unable to initialize object */ -hid_t H5E_ALREADYINIT_g = FAIL; /* Object already initialized */ -hid_t H5E_CANTRELEASE_g = FAIL; /* Unable to release object */ +hid_t H5E_CANTINIT_g = FAIL; /* Unable to initialize object */ +hid_t H5E_ALREADYINIT_g = FAIL; /* Object already initialized */ +hid_t H5E_CANTRELEASE_g = FAIL; /* Unable to release object */ /* Property list errors */ -hid_t H5E_CANTGET_g = FAIL; /* Can't get value */ -hid_t H5E_CANTSET_g = FAIL; /* Can't set value */ -hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */ -hid_t H5E_SETDISALLOWED_g = FAIL; /* Disallowed operation */ +hid_t H5E_CANTGET_g = FAIL; /* Can't get value */ +hid_t H5E_CANTSET_g = FAIL; /* Can't set value */ +hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */ +hid_t H5E_SETDISALLOWED_g = FAIL; /* Disallowed operation */ /* Free space errors */ -hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */ -hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */ -hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */ +hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */ +hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */ +hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */ /* Object header related errors */ -hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */ -hid_t H5E_VERSION_g = FAIL; /* Wrong version number */ -hid_t H5E_ALIGNMENT_g = FAIL; /* Alignment error */ -hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */ -hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */ -hid_t H5E_BADITER_g = FAIL; /* Iteration failed */ -hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */ -hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */ -hid_t H5E_CANTRENAME_g = FAIL; /* Unable to rename object */ +hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */ +hid_t H5E_VERSION_g = FAIL; /* Wrong version number */ +hid_t H5E_ALIGNMENT_g = FAIL; /* Alignment error */ +hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */ +hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */ +hid_t H5E_BADITER_g = FAIL; /* Iteration failed */ +hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */ +hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */ +hid_t H5E_CANTRENAME_g = FAIL; /* Unable to rename object */ /* System level errors */ -hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */ +hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */ /* I/O pipeline errors */ -hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */ -hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */ -hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */ -hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */ -hid_t H5E_NOENCODER_g = FAIL; /* Filter present but encoding disabled */ -hid_t H5E_CANTFILTER_g = FAIL; /* Filter operation failed */ +hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */ +hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */ +hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */ +hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */ +hid_t H5E_NOENCODER_g = FAIL; /* Filter present but encoding disabled */ +hid_t H5E_CANTFILTER_g = FAIL; /* Filter operation failed */ /* Group related errors */ -hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */ -hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */ -hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */ -hid_t H5E_PATH_g = FAIL; /* Problem with path to object */ +hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */ +hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */ +hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */ +hid_t H5E_PATH_g = FAIL; /* Problem with path to object */ /* No error */ -hid_t H5E_NONE_MINOR_g = FAIL; /* No error */ +hid_t H5E_NONE_MINOR_g = FAIL; /* No error */ /* Plugin errors */ -hid_t H5E_OPENERROR_g = FAIL; /* Can't open directory or file */ - -/* File accessibilty errors */ -hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */ -hid_t H5E_FILEOPEN_g = FAIL; /* File already open */ -hid_t H5E_CANTCREATE_g = FAIL; /* Unable to create file */ -hid_t H5E_CANTOPENFILE_g = FAIL; /* Unable to open file */ -hid_t H5E_CANTCLOSEFILE_g = FAIL; /* Unable to close file */ -hid_t H5E_NOTHDF5_g = FAIL; /* Not an HDF5 file */ -hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */ -hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */ -hid_t H5E_MOUNT_g = FAIL; /* File mount error */ +hid_t H5E_OPENERROR_g = FAIL; /* Can't open directory or file */ + +/* File accessibility errors */ +hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */ +hid_t H5E_FILEOPEN_g = FAIL; /* File already open */ +hid_t H5E_CANTCREATE_g = FAIL; /* Unable to create file */ +hid_t H5E_CANTOPENFILE_g = FAIL; /* Unable to open file */ +hid_t H5E_CANTCLOSEFILE_g = FAIL; /* Unable to close file */ +hid_t H5E_NOTHDF5_g = FAIL; /* Not an HDF5 file */ +hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */ +hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */ +hid_t H5E_MOUNT_g = FAIL; /* File mount error */ /* Object atom related errors */ -hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */ -hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */ -hid_t H5E_CANTREGISTER_g = FAIL; /* Unable to register new atom */ -hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count */ -hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */ -hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ +hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */ +hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */ +hid_t H5E_CANTREGISTER_g = FAIL; /* Unable to register new atom */ +hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count */ +hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */ +hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ /* Cache related errors */ -hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */ -hid_t H5E_CANTSERIALIZE_g = FAIL; /* Unable to serialize data from cache */ -hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */ -hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */ -hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */ -hid_t H5E_SYSTEM_g = FAIL; /* Internal error detected */ -hid_t H5E_CANTINS_g = FAIL; /* Unable to insert metadata into cache */ -hid_t H5E_CANTPROTECT_g = FAIL; /* Unable to protect metadata */ -hid_t H5E_CANTUNPROTECT_g = FAIL; /* Unable to unprotect metadata */ -hid_t H5E_CANTPIN_g = FAIL; /* Unable to pin cache entry */ -hid_t H5E_CANTUNPIN_g = FAIL; /* Unable to un-pin cache entry */ -hid_t H5E_CANTMARKDIRTY_g = FAIL; /* Unable to mark a pinned entry as dirty */ -hid_t H5E_CANTDIRTY_g = FAIL; /* Unable to mark metadata as dirty */ -hid_t H5E_CANTEXPUNGE_g = FAIL; /* Unable to expunge a metadata cache entry */ -hid_t H5E_CANTRESIZE_g = FAIL; /* Unable to resize a metadata cache entry */ +hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */ +hid_t H5E_CANTSERIALIZE_g = FAIL; /* Unable to serialize data from cache */ +hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */ +hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */ +hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */ +hid_t H5E_SYSTEM_g = FAIL; /* Internal error detected */ +hid_t H5E_CANTINS_g = FAIL; /* Unable to insert metadata into cache */ +hid_t H5E_CANTPROTECT_g = FAIL; /* Unable to protect metadata */ +hid_t H5E_CANTUNPROTECT_g = FAIL; /* Unable to unprotect metadata */ +hid_t H5E_CANTPIN_g = FAIL; /* Unable to pin cache entry */ +hid_t H5E_CANTUNPIN_g = FAIL; /* Unable to un-pin cache entry */ +hid_t H5E_CANTMARKDIRTY_g = FAIL; /* Unable to mark a pinned entry as dirty */ +hid_t H5E_CANTDIRTY_g = FAIL; /* Unable to mark metadata as dirty */ +hid_t H5E_CANTEXPUNGE_g = FAIL; /* Unable to expunge a metadata cache entry */ +hid_t H5E_CANTRESIZE_g = FAIL; /* Unable to resize a metadata cache entry */ /* Link related errors */ -hid_t H5E_TRAVERSE_g = FAIL; /* Link traversal failure */ -hid_t H5E_NLINKS_g = FAIL; /* Too many soft links in path */ -hid_t H5E_NOTREGISTERED_g = FAIL; /* Link class not registered */ -hid_t H5E_CANTMOVE_g = FAIL; /* Can't move object */ -hid_t H5E_CANTSORT_g = FAIL; /* Can't sort objects */ +hid_t H5E_TRAVERSE_g = FAIL; /* Link traversal failure */ +hid_t H5E_NLINKS_g = FAIL; /* Too many soft links in path */ +hid_t H5E_NOTREGISTERED_g = FAIL; /* Link class not registered */ +hid_t H5E_CANTMOVE_g = FAIL; /* Can't move object */ +hid_t H5E_CANTSORT_g = FAIL; /* Can't sort objects */ /* Parallel MPI errors */ -hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */ -hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */ -hid_t H5E_CANTRECV_g = FAIL; /* Can't receive data */ +hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */ +hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */ +hid_t H5E_CANTRECV_g = FAIL; /* Can't receive data */ /* Dataspace errors */ -hid_t H5E_CANTCLIP_g = FAIL; /* Can't clip hyperslab region */ -hid_t H5E_CANTCOUNT_g = FAIL; /* Can't count elements */ -hid_t H5E_CANTSELECT_g = FAIL; /* Can't select hyperslab */ -hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location */ -hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */ -hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */ +hid_t H5E_CANTCLIP_g = FAIL; /* Can't clip hyperslab region */ +hid_t H5E_CANTCOUNT_g = FAIL; /* Can't count elements */ +hid_t H5E_CANTSELECT_g = FAIL; /* Can't select hyperslab */ +hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location */ +hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */ +hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */ /* Argument errors */ -hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */ -hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */ -hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */ -hid_t H5E_BADRANGE_g = FAIL; /* Out of range */ -hid_t H5E_BADVALUE_g = FAIL; /* Bad value */ +hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */ +hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */ +hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */ +hid_t H5E_BADRANGE_g = FAIL; /* Out of range */ +hid_t H5E_BADVALUE_g = FAIL; /* Bad value */ /* B-tree related errors */ -hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */ -hid_t H5E_EXISTS_g = FAIL; /* Object already exists */ -hid_t H5E_CANTENCODE_g = FAIL; /* Unable to encode value */ -hid_t H5E_CANTDECODE_g = FAIL; /* Unable to decode value */ -hid_t H5E_CANTSPLIT_g = FAIL; /* Unable to split node */ -hid_t H5E_CANTREDISTRIBUTE_g = FAIL; /* Unable to redistribute records */ -hid_t H5E_CANTSWAP_g = FAIL; /* Unable to swap records */ -hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */ -hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */ -hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */ -hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */ +hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */ +hid_t H5E_EXISTS_g = FAIL; /* Object already exists */ +hid_t H5E_CANTENCODE_g = FAIL; /* Unable to encode value */ +hid_t H5E_CANTDECODE_g = FAIL; /* Unable to decode value */ +hid_t H5E_CANTSPLIT_g = FAIL; /* Unable to split node */ +hid_t H5E_CANTREDISTRIBUTE_g = FAIL; /* Unable to redistribute records */ +hid_t H5E_CANTSWAP_g = FAIL; /* Unable to swap records */ +hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */ +hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */ +hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */ +hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */ /* Datatype conversion errors */ -hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */ -hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */ +hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */ +hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */ #endif /* H5Edefin_H */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index a7f2aca..8bd5c70 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -15,7 +15,7 @@ * * Created: H5Edeprec.c * April 11 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Deprecated functions from the H5E interface. These * functions are here for compatibility purposes and may be @@ -37,11 +37,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 "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -117,12 +117,12 @@ H5E__term_deprec_interface(void) #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 @@ -169,12 +169,12 @@ done: } /* end H5Eget_major() */ /*------------------------------------------------------------------------- - * 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 @@ -221,19 +221,19 @@ done: } /* end H5Eget_minor() */ /*------------------------------------------------------------------------- - * 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: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Tuesday, Sep 16, 2003 @@ -258,12 +258,12 @@ done: } /* end H5Epush1() */ /*------------------------------------------------------------------------- - * Function: H5Eclear1 + * Function: H5Eclear1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * Clears the error stack for the specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -288,15 +288,15 @@ done: } /* end H5Eclear1() */ /*------------------------------------------------------------------------- - * Function: H5Eprint1 + * Function: H5Eprint1 * - * Purpose: This function is for backward compatibility. + * 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 - * 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: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -326,13 +326,13 @@ done: } /* end H5Eprint1() */ /*------------------------------------------------------------------------- - * Function: H5Ewalk1 + * Function: H5Ewalk1 * - * Purpose: This function is for backward compatibility. + * 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. + * function for each error along the way. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -365,24 +365,19 @@ done: } /* end H5Ewalk1() */ /*------------------------------------------------------------------------- - * Function: H5Eget_auto1 + * Function: H5Eget_auto1 * - * Purpose: This function is for backward compatibility. + * 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 - * 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: Non-negative on success/Negative on failure * * 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 @@ -416,29 +411,26 @@ done: } /* end H5Eget_auto1() */ /*------------------------------------------------------------------------- - * Function: H5Eset_auto1 + * Function: H5Eset_auto1 * - * Purpose: This function is for backward compatibility. + * 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 * 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: Non-negative on success/Negative on failure * * 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 diff --git a/src/H5Einit.h b/src/H5Einit.h index accd38c..864c702 100644 --- a/src/H5Einit.h +++ b/src/H5Einit.h @@ -14,6 +14,7 @@ /* Generated automatically by bin/make_err -- do not edit */ /* Add new errors to H5err.txt file */ + #ifndef _H5Einit_H #define _H5Einit_H @@ -21,786 +22,787 @@ /* Major error codes */ /*********************/ -HDassert(H5E_DATASET_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset")) == NULL) +HDassert(H5E_DATASET_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FUNC_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit")) == NULL) +HDassert(H5E_FUNC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_STORAGE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Data storage")) == NULL) +HDassert(H5E_STORAGE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FILE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibilty")) == NULL) +HDassert(H5E_FILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibility"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SOHM_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Shared Object Header Messages")) == NULL) +HDassert(H5E_SOHM_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SYM_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table")) == NULL) +HDassert(H5E_SYM_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLUGIN_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library")) == NULL) +HDassert(H5E_PLUGIN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_VFL_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer")) == NULL) +HDassert(H5E_VFL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_INTERNAL_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)")) == NULL) +HDassert(H5E_INTERNAL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BTREE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node")) == NULL) +HDassert(H5E_BTREE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_REFERENCE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "References")) == NULL) +HDassert(H5E_REFERENCE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "References"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATASPACE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace")) == NULL) +HDassert(H5E_DATASPACE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_RESOURCE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable")) == NULL) +HDassert(H5E_RESOURCE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLIST_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists")) == NULL) +HDassert(H5E_PLIST_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_LINK_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Links")) == NULL) +HDassert(H5E_LINK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Links"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATATYPE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Datatype")) == NULL) +HDassert(H5E_DATATYPE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Datatype"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_RS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings")) == NULL) +HDassert(H5E_RS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_HEAP_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap")) == NULL) +HDassert(H5E_HEAP_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OHDR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header")) == NULL) +HDassert(H5E_OHDR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ATOM_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Object atom")) == NULL) +HDassert(H5E_ATOM_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object atom"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_ATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_ATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ATTR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Attribute")) == NULL) +HDassert(H5E_ATTR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Attribute"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NONE_MAJOR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "No error")) == NULL) +HDassert(H5E_NONE_MAJOR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "No error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_IO_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O")) == NULL) +HDassert(H5E_IO_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SLIST_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Skip Lists")) == NULL) +HDassert(H5E_SLIST_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EFL_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list")) == NULL) +HDassert(H5E_EFL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_TST_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees")) == NULL) +HDassert(H5E_TST_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ARGS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Invalid arguments to routine")) == NULL) +HDassert(H5E_ARGS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ERROR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Error API")) == NULL) +HDassert(H5E_ERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Error API"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLINE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters")) == NULL) +HDassert(H5E_PLINE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FSPACE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Free Space Manager")) == NULL) +HDassert(H5E_FSPACE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CACHE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache")) == NULL) +HDassert(H5E_CACHE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /*********************/ /* Minor error codes */ /*********************/ + /* Generic low-level file I/O errors */ -HDassert(H5E_SEEKERROR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Seek failed")) == NULL) +HDassert(H5E_SEEKERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_READERROR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Read failed")) == NULL) +HDassert(H5E_READERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Read failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_WRITEERROR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Write failed")) == NULL) +HDassert(H5E_WRITEERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Write failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CLOSEERROR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Close failed")) == NULL) +HDassert(H5E_CLOSEERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Close failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OVERFLOW_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Address overflowed")) == NULL) +HDassert(H5E_OVERFLOW_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FCNTL_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "File control (fcntl) failed")) == NULL) +HDassert(H5E_FCNTL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Resource errors */ -HDassert(H5E_NOSPACE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation")) == NULL) +HDassert(H5E_NOSPACE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTALLOC_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate space")) == NULL) +HDassert(H5E_CANTALLOC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOPY_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object")) == NULL) +HDassert(H5E_CANTCOPY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTFREE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object")) == NULL) +HDassert(H5E_CANTFREE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALREADYEXISTS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists")) == NULL) +HDassert(H5E_ALREADYEXISTS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLOCK_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object")) == NULL) +HDassert(H5E_CANTLOCK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNLOCK_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object")) == NULL) +HDassert(H5E_CANTUNLOCK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGC_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect")) == NULL) +HDassert(H5E_CANTGC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGETSIZE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to compute size")) == NULL) +HDassert(H5E_CANTGETSIZE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OBJOPEN_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Object is already open")) == NULL) +HDassert(H5E_OBJOPEN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Object is already open"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Heap errors */ -HDassert(H5E_CANTRESTORE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't restore condition")) == NULL) +HDassert(H5E_CANTRESTORE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't restore condition"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTRESTORE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTRESTORE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOMPUTE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compute value")) == NULL) +HDassert(H5E_CANTCOMPUTE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compute value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCOMPUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCOMPUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTEXTEND_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't extend heap's space")) == NULL) +HDassert(H5E_CANTEXTEND_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't extend heap's space"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTEXTEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTEXTEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTATTACH_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't attach object")) == NULL) +HDassert(H5E_CANTATTACH_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't attach object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTATTACH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTATTACH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUPDATE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't update object")) == NULL) +HDassert(H5E_CANTUPDATE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't update object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTUPDATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTUPDATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTOPERATE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't operate on object")) == NULL) +HDassert(H5E_CANTOPERATE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't operate on object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTOPERATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTOPERATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Function entry/exit interface errors */ -HDassert(H5E_CANTINIT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to initialize object")) == NULL) +HDassert(H5E_CANTINIT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALREADYINIT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Object already initialized")) == NULL) +HDassert(H5E_ALREADYINIT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRELEASE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to release object")) == NULL) +HDassert(H5E_CANTRELEASE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Property list errors */ -HDassert(H5E_CANTGET_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value")) == NULL) +HDassert(H5E_CANTGET_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSET_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value")) == NULL) +HDassert(H5E_CANTSET_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DUPCLASS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class")) == NULL) +HDassert(H5E_DUPCLASS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SETDISALLOWED_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Disallowed operation")) == NULL) +HDassert(H5E_SETDISALLOWED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Free space errors */ -HDassert(H5E_CANTMERGE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't merge objects")) == NULL) +HDassert(H5E_CANTMERGE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREVIVE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't revive object")) == NULL) +HDassert(H5E_CANTREVIVE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSHRINK_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't shrink container")) == NULL) +HDassert(H5E_CANTSHRINK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Object header related errors */ -HDassert(H5E_LINKCOUNT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count")) == NULL) +HDassert(H5E_LINKCOUNT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_VERSION_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number")) == NULL) +HDassert(H5E_VERSION_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALIGNMENT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error")) == NULL) +HDassert(H5E_ALIGNMENT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADMESG_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message")) == NULL) +HDassert(H5E_BADMESG_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDELETE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message")) == NULL) +HDassert(H5E_CANTDELETE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADITER_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Iteration failed")) == NULL) +HDassert(H5E_BADITER_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Iteration failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADITER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADITER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTPACK_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages")) == NULL) +HDassert(H5E_CANTPACK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRESET_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object")) == NULL) +HDassert(H5E_CANTRESET_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRENAME_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to rename object")) == NULL) +HDassert(H5E_CANTRENAME_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to rename object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTRENAME_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTRENAME_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* System level errors */ -HDassert(H5E_SYSERRSTR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "System error message")) == NULL) +HDassert(H5E_SYSERRSTR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "System error message"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SYSERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SYSERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* I/O pipeline errors */ -HDassert(H5E_NOFILTER_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available")) == NULL) +HDassert(H5E_NOFILTER_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CALLBACK_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed")) == NULL) +HDassert(H5E_CALLBACK_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANAPPLY_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback")) == NULL) +HDassert(H5E_CANAPPLY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SETLOCAL_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback")) == NULL) +HDassert(H5E_SETLOCAL_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOENCODER_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Filter present but encoding disabled")) == NULL) +HDassert(H5E_NOENCODER_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTFILTER_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Filter operation failed")) == NULL) +HDassert(H5E_CANTFILTER_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Group related errors */ -HDassert(H5E_CANTOPENOBJ_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object")) == NULL) +HDassert(H5E_CANTOPENOBJ_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCLOSEOBJ_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object")) == NULL) +HDassert(H5E_CANTCLOSEOBJ_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_COMPLEN_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long")) == NULL) +HDassert(H5E_COMPLEN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PATH_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with path to object")) == NULL) +HDassert(H5E_PATH_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with path to object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_PATH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_PATH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* No error */ -HDassert(H5E_NONE_MINOR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "No error")) == NULL) +HDassert(H5E_NONE_MINOR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "No error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Plugin errors */ -HDassert(H5E_OPENERROR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open directory or file")) == NULL) +HDassert(H5E_OPENERROR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open directory or file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_OPENERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_OPENERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* File accessibilty errors */ -HDassert(H5E_FILEEXISTS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists")) == NULL) +/* File accessibility errors */ +HDassert(H5E_FILEEXISTS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FILEOPEN_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "File already open")) == NULL) +HDassert(H5E_FILEOPEN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File already open"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCREATE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create file")) == NULL) +HDassert(H5E_CANTCREATE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTOPENFILE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to open file")) == NULL) +HDassert(H5E_CANTOPENFILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCLOSEFILE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to close file")) == NULL) +HDassert(H5E_CANTCLOSEFILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOTHDF5_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Not an HDF5 file")) == NULL) +HDassert(H5E_NOTHDF5_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADFILE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Bad file ID accessed")) == NULL) +HDassert(H5E_BADFILE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_TRUNCATED_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "File has been truncated")) == NULL) +HDassert(H5E_TRUNCATED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_MOUNT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "File mount error")) == NULL) +HDassert(H5E_MOUNT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "File mount error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Object atom related errors */ -HDassert(H5E_BADATOM_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find atom information (already closed?)")) == NULL) +HDassert(H5E_BADATOM_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find atom information (already closed?)"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADGROUP_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find ID group information")) == NULL) +HDassert(H5E_BADGROUP_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREGISTER_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to register new atom")) == NULL) +HDassert(H5E_CANTREGISTER_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to register new atom"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTINC_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to increment reference count")) == NULL) +HDassert(H5E_CANTINC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDEC_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decrement reference count")) == NULL) +HDassert(H5E_CANTDEC_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOIDS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Out of IDs for group")) == NULL) +HDassert(H5E_NOIDS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Cache related errors */ -HDassert(H5E_CANTFLUSH_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache")) == NULL) +HDassert(H5E_CANTFLUSH_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSERIALIZE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache")) == NULL) +HDassert(H5E_CANTSERIALIZE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLOAD_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache")) == NULL) +HDassert(H5E_CANTLOAD_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PROTECT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error")) == NULL) +HDassert(H5E_PROTECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOTCACHED_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached")) == NULL) +HDassert(H5E_NOTCACHED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SYSTEM_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Internal error detected")) == NULL) +HDassert(H5E_SYSTEM_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Internal error detected"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_SYSTEM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_SYSTEM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTINS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert metadata into cache")) == NULL) +HDassert(H5E_CANTINS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert metadata into cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTINS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTINS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTPROTECT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to protect metadata")) == NULL) +HDassert(H5E_CANTPROTECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to protect metadata"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNPROTECT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unprotect metadata")) == NULL) +HDassert(H5E_CANTUNPROTECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unprotect metadata"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTUNPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTUNPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTPIN_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to pin cache entry")) == NULL) +HDassert(H5E_CANTPIN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to pin cache entry"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNPIN_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to un-pin cache entry")) == NULL) +HDassert(H5E_CANTUNPIN_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to un-pin cache entry"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTUNPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTUNPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMARKDIRTY_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as dirty")) == NULL) +HDassert(H5E_CANTMARKDIRTY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as dirty"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTMARKDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTMARKDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDIRTY_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark metadata as dirty")) == NULL) +HDassert(H5E_CANTDIRTY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark metadata as dirty"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTEXPUNGE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to expunge a metadata cache entry")) == NULL) +HDassert(H5E_CANTEXPUNGE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to expunge a metadata cache entry"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTEXPUNGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTEXPUNGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRESIZE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to resize a metadata cache entry")) == NULL) +HDassert(H5E_CANTRESIZE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to resize a metadata cache entry"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTRESIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTRESIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Link related errors */ -HDassert(H5E_TRAVERSE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Link traversal failure")) == NULL) +HDassert(H5E_TRAVERSE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Link traversal failure"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_TRAVERSE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_TRAVERSE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NLINKS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Too many soft links in path")) == NULL) +HDassert(H5E_NLINKS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Too many soft links in path"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOTREGISTERED_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Link class not registered")) == NULL) +HDassert(H5E_NOTREGISTERED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Link class not registered"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMOVE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move object")) == NULL) +HDassert(H5E_CANTMOVE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSORT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't sort objects")) == NULL) +HDassert(H5E_CANTSORT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Parallel MPI errors */ -HDassert(H5E_MPI_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Some MPI function failed")) == NULL) +HDassert(H5E_MPI_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_MPIERRSTR_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "MPI Error String")) == NULL) +HDassert(H5E_MPIERRSTR_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRECV_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive data")) == NULL) +HDassert(H5E_CANTRECV_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Dataspace errors */ -HDassert(H5E_CANTCLIP_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't clip hyperslab region")) == NULL) +HDassert(H5E_CANTCLIP_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't clip hyperslab region"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCLIP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCLIP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOUNT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't count elements")) == NULL) +HDassert(H5E_CANTCOUNT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't count elements"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSELECT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't select hyperslab")) == NULL) +HDassert(H5E_CANTSELECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't select hyperslab"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTNEXT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move to next iterator location")) == NULL) +HDassert(H5E_CANTNEXT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move to next iterator location"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTNEXT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTNEXT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADSELECT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Invalid selection")) == NULL) +HDassert(H5E_BADSELECT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Invalid selection"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOMPARE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects")) == NULL) +HDassert(H5E_CANTCOMPARE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Argument errors */ -HDassert(H5E_UNINITIALIZED_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized")) == NULL) +HDassert(H5E_UNINITIALIZED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_UNSUPPORTED_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported")) == NULL) +HDassert(H5E_UNSUPPORTED_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADTYPE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type")) == NULL) +HDassert(H5E_BADTYPE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADRANGE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range")) == NULL) +HDassert(H5E_BADRANGE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADVALUE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value")) == NULL) +HDassert(H5E_BADVALUE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* B-tree related errors */ -HDassert(H5E_NOTFOUND_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Object not found")) == NULL) +HDassert(H5E_NOTFOUND_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Object not found"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_NOTFOUND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_NOTFOUND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EXISTS_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists")) == NULL) +HDassert(H5E_EXISTS_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_EXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_EXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTENCODE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to encode value")) == NULL) +HDassert(H5E_CANTENCODE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to encode value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTENCODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTENCODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDECODE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decode value")) == NULL) +HDassert(H5E_CANTDECODE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decode value"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTDECODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTDECODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSPLIT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to split node")) == NULL) +HDassert(H5E_CANTSPLIT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to split node"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTSPLIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTSPLIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREDISTRIBUTE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to redistribute records")) == NULL) +HDassert(H5E_CANTREDISTRIBUTE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to redistribute records"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTREDISTRIBUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTREDISTRIBUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSWAP_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to swap records")) == NULL) +HDassert(H5E_CANTSWAP_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to swap records"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTSWAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTSWAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTINSERT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert object")) == NULL) +HDassert(H5E_CANTINSERT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTINSERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTINSERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLIST_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to list node")) == NULL) +HDassert(H5E_CANTLIST_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to list node"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMODIFY_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to modify record")) == NULL) +HDassert(H5E_CANTMODIFY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to modify record"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREMOVE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object")) == NULL) +HDassert(H5E_CANTREMOVE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Datatype conversion errors */ -HDassert(H5E_CANTCONVERT_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes")) == NULL) +HDassert(H5E_CANTCONVERT_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADSIZE_g == (-1)); -if ((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object")) == NULL) +HDassert(H5E_BADSIZE_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if ((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE)) < 0) +if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") #endif /* H5Einit_H */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 18138d5..3474808 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -15,7 +15,7 @@ * * Created: H5Eint.c * April 11 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: General use, "internal" routines for error handling. * @@ -34,10 +34,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Epkg.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5TSprivate.h" /* Thread stuff */ /****************/ /* Local Macros */ @@ -124,12 +125,12 @@ H5E_init_int_interface(void) } /* H5E_init_int_interface() */ /*------------------------------------------------------------------------- - * 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 @@ -139,7 +140,7 @@ H5E_init_int_interface(void) ssize_t H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) { - ssize_t len; /* Length of error message */ + ssize_t len = -1; /* Length of error message */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -167,32 +168,32 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) #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 @@ -269,10 +270,8 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) else HDfprintf(stream, "thread 0"); } /* end block */ -#elif defined(H5_HAVE_THREADSAFE) - HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - HDfprintf(stream, "thread 0"); + HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id()); #endif HDfprintf(stream, ":\n"); } /* end if */ @@ -294,30 +293,30 @@ done: #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 @@ -399,10 +398,8 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) else HDfprintf(stream, "thread 0"); } /* end block */ -#elif defined(H5_HAVE_THREADSAFE) - HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - HDfprintf(stream, "thread 0"); + HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id()); #endif HDfprintf(stream, ":\n"); } /* end if */ @@ -423,15 +420,15 @@ done: } /* 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 + * Users are encouraged to write their own more specific error * handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -482,29 +479,29 @@ done: } /* 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 @@ -595,14 +592,14 @@ done: } /* 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 @@ -626,22 +623,22 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) } /* end H5E_get_auto2() */ /*------------------------------------------------------------------------- - * 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 @@ -663,11 +660,11 @@ H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) } /* 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 @@ -708,7 +705,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin */ /* Start the variable-argument parsing */ - va_start(ap, fmt); + HDva_start(ap, fmt); va_started = TRUE; #ifdef H5_HAVE_VASPRINTF @@ -724,8 +721,8 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ while ((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { /* shutdown & restart the va_list */ - va_end(ap); - va_start(ap, fmt); + HDva_end(ap); + HDva_start(ap, fmt); /* Release the previous description, it's too small */ H5MM_xfree(tmp); @@ -743,27 +740,35 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin done: if (va_started) - va_end(ap); + HDva_end(ap); +#ifdef H5_HAVE_VASPRINTF + /* Memory was allocated with HDvasprintf so it needs to be freed + * with HDfree + */ + if (tmp) + HDfree(tmp); +#else /* H5_HAVE_VASPRINTF */ if (tmp) H5MM_xfree(tmp); +#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ /*------------------------------------------------------------------------- - * 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 @@ -838,12 +843,12 @@ done: } /* end H5E_push_stack() */ /*------------------------------------------------------------------------- - * 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 @@ -893,12 +898,12 @@ done: } /* 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 @@ -929,12 +934,12 @@ done: } /* end H5E_clear_stack() */ /*------------------------------------------------------------------------- - * 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 @@ -961,13 +966,13 @@ done: } /* 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 diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 3014d21..0056e9c 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Wednesday, April 11, 2007 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h index 3c65f07..cf1519e 100644 --- a/src/H5Epubgen.h +++ b/src/H5Epubgen.h @@ -14,6 +14,7 @@ /* Generated automatically by bin/make_err -- do not edit */ /* Add new errors to H5err.txt file */ + #ifndef _H5Epubgen_H #define _H5Epubgen_H @@ -25,98 +26,98 @@ extern "C" { /* Major error codes */ /*********************/ -#define H5E_DATASET (H5OPEN H5E_DATASET_g) -#define H5E_FUNC (H5OPEN H5E_FUNC_g) -#define H5E_STORAGE (H5OPEN H5E_STORAGE_g) -#define H5E_FILE (H5OPEN H5E_FILE_g) -#define H5E_SOHM (H5OPEN H5E_SOHM_g) -#define H5E_SYM (H5OPEN H5E_SYM_g) -#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g) -#define H5E_VFL (H5OPEN H5E_VFL_g) -#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) -#define H5E_BTREE (H5OPEN H5E_BTREE_g) -#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g) -#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g) -#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g) -#define H5E_PLIST (H5OPEN H5E_PLIST_g) -#define H5E_LINK (H5OPEN H5E_LINK_g) -#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) -#define H5E_RS (H5OPEN H5E_RS_g) -#define H5E_HEAP (H5OPEN H5E_HEAP_g) -#define H5E_OHDR (H5OPEN H5E_OHDR_g) -#define H5E_ATOM (H5OPEN H5E_ATOM_g) -#define H5E_ATTR (H5OPEN H5E_ATTR_g) -#define H5E_NONE_MAJOR (H5OPEN H5E_NONE_MAJOR_g) -#define H5E_IO (H5OPEN H5E_IO_g) -#define H5E_SLIST (H5OPEN H5E_SLIST_g) -#define H5E_EFL (H5OPEN H5E_EFL_g) -#define H5E_TST (H5OPEN H5E_TST_g) -#define H5E_ARGS (H5OPEN H5E_ARGS_g) -#define H5E_ERROR (H5OPEN H5E_ERROR_g) -#define H5E_PLINE (H5OPEN H5E_PLINE_g) -#define H5E_FSPACE (H5OPEN H5E_FSPACE_g) -#define H5E_CACHE (H5OPEN H5E_CACHE_g) -H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */ -H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ -H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ -H5_DLLVAR hid_t H5E_FILE_g; /* File accessibilty */ -H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */ -H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ -H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */ -H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */ -H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ -H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ -H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */ -H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */ -H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */ -H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */ -H5_DLLVAR hid_t H5E_LINK_g; /* Links */ -H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ -H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */ -H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ -H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ -H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ -H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */ -H5_DLLVAR hid_t H5E_NONE_MAJOR_g; /* No error */ -H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */ -H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */ -H5_DLLVAR hid_t H5E_EFL_g; /* External file list */ -H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */ -H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */ -H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ -H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */ -H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */ -H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */ +#define H5E_DATASET (H5OPEN H5E_DATASET_g) +#define H5E_FUNC (H5OPEN H5E_FUNC_g) +#define H5E_STORAGE (H5OPEN H5E_STORAGE_g) +#define H5E_FILE (H5OPEN H5E_FILE_g) +#define H5E_SOHM (H5OPEN H5E_SOHM_g) +#define H5E_SYM (H5OPEN H5E_SYM_g) +#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g) +#define H5E_VFL (H5OPEN H5E_VFL_g) +#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) +#define H5E_BTREE (H5OPEN H5E_BTREE_g) +#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g) +#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g) +#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g) +#define H5E_PLIST (H5OPEN H5E_PLIST_g) +#define H5E_LINK (H5OPEN H5E_LINK_g) +#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) +#define H5E_RS (H5OPEN H5E_RS_g) +#define H5E_HEAP (H5OPEN H5E_HEAP_g) +#define H5E_OHDR (H5OPEN H5E_OHDR_g) +#define H5E_ATOM (H5OPEN H5E_ATOM_g) +#define H5E_ATTR (H5OPEN H5E_ATTR_g) +#define H5E_NONE_MAJOR (H5OPEN H5E_NONE_MAJOR_g) +#define H5E_IO (H5OPEN H5E_IO_g) +#define H5E_SLIST (H5OPEN H5E_SLIST_g) +#define H5E_EFL (H5OPEN H5E_EFL_g) +#define H5E_TST (H5OPEN H5E_TST_g) +#define H5E_ARGS (H5OPEN H5E_ARGS_g) +#define H5E_ERROR (H5OPEN H5E_ERROR_g) +#define H5E_PLINE (H5OPEN H5E_PLINE_g) +#define H5E_FSPACE (H5OPEN H5E_FSPACE_g) +#define H5E_CACHE (H5OPEN H5E_CACHE_g) +H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */ +H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ +H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ +H5_DLLVAR hid_t H5E_FILE_g; /* File accessibility */ +H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */ +H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ +H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */ +H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */ +H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ +H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ +H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */ +H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */ +H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */ +H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */ +H5_DLLVAR hid_t H5E_LINK_g; /* Links */ +H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ +H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */ +H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ +H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ +H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ +H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */ +H5_DLLVAR hid_t H5E_NONE_MAJOR_g; /* No error */ +H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */ +H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */ +H5_DLLVAR hid_t H5E_EFL_g; /* External file list */ +H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */ +H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */ +H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ +H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */ +H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */ +H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */ /*********************/ /* Minor error codes */ /*********************/ /* Generic low-level file I/O errors */ -#define H5E_SEEKERROR (H5OPEN H5E_SEEKERROR_g) -#define H5E_READERROR (H5OPEN H5E_READERROR_g) -#define H5E_WRITEERROR (H5OPEN H5E_WRITEERROR_g) -#define H5E_CLOSEERROR (H5OPEN H5E_CLOSEERROR_g) -#define H5E_OVERFLOW (H5OPEN H5E_OVERFLOW_g) -#define H5E_FCNTL (H5OPEN H5E_FCNTL_g) -H5_DLLVAR hid_t H5E_SEEKERROR_g; /* Seek failed */ -H5_DLLVAR hid_t H5E_READERROR_g; /* Read failed */ -H5_DLLVAR hid_t H5E_WRITEERROR_g; /* Write failed */ -H5_DLLVAR hid_t H5E_CLOSEERROR_g; /* Close failed */ -H5_DLLVAR hid_t H5E_OVERFLOW_g; /* Address overflowed */ -H5_DLLVAR hid_t H5E_FCNTL_g; /* File control (fcntl) failed */ +#define H5E_SEEKERROR (H5OPEN H5E_SEEKERROR_g) +#define H5E_READERROR (H5OPEN H5E_READERROR_g) +#define H5E_WRITEERROR (H5OPEN H5E_WRITEERROR_g) +#define H5E_CLOSEERROR (H5OPEN H5E_CLOSEERROR_g) +#define H5E_OVERFLOW (H5OPEN H5E_OVERFLOW_g) +#define H5E_FCNTL (H5OPEN H5E_FCNTL_g) +H5_DLLVAR hid_t H5E_SEEKERROR_g; /* Seek failed */ +H5_DLLVAR hid_t H5E_READERROR_g; /* Read failed */ +H5_DLLVAR hid_t H5E_WRITEERROR_g; /* Write failed */ +H5_DLLVAR hid_t H5E_CLOSEERROR_g; /* Close failed */ +H5_DLLVAR hid_t H5E_OVERFLOW_g; /* Address overflowed */ +H5_DLLVAR hid_t H5E_FCNTL_g; /* File control (fcntl) failed */ /* Resource errors */ -#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g) -#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g) -#define H5E_CANTCOPY (H5OPEN H5E_CANTCOPY_g) -#define H5E_CANTFREE (H5OPEN H5E_CANTFREE_g) -#define H5E_ALREADYEXISTS (H5OPEN H5E_ALREADYEXISTS_g) -#define H5E_CANTLOCK (H5OPEN H5E_CANTLOCK_g) -#define H5E_CANTUNLOCK (H5OPEN H5E_CANTUNLOCK_g) -#define H5E_CANTGC (H5OPEN H5E_CANTGC_g) -#define H5E_CANTGETSIZE (H5OPEN H5E_CANTGETSIZE_g) -#define H5E_OBJOPEN (H5OPEN H5E_OBJOPEN_g) +#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g) +#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g) +#define H5E_CANTCOPY (H5OPEN H5E_CANTCOPY_g) +#define H5E_CANTFREE (H5OPEN H5E_CANTFREE_g) +#define H5E_ALREADYEXISTS (H5OPEN H5E_ALREADYEXISTS_g) +#define H5E_CANTLOCK (H5OPEN H5E_CANTLOCK_g) +#define H5E_CANTUNLOCK (H5OPEN H5E_CANTUNLOCK_g) +#define H5E_CANTGC (H5OPEN H5E_CANTGC_g) +#define H5E_CANTGETSIZE (H5OPEN H5E_CANTGETSIZE_g) +#define H5E_OBJOPEN (H5OPEN H5E_OBJOPEN_g) H5_DLLVAR hid_t H5E_NOSPACE_g; /* No space available for allocation */ H5_DLLVAR hid_t H5E_CANTALLOC_g; /* Can't allocate space */ H5_DLLVAR hid_t H5E_CANTCOPY_g; /* Unable to copy object */ @@ -129,111 +130,111 @@ H5_DLLVAR hid_t H5E_CANTGETSIZE_g; /* Unable to compute size */ H5_DLLVAR hid_t H5E_OBJOPEN_g; /* Object is already open */ /* Heap errors */ -#define H5E_CANTRESTORE (H5OPEN H5E_CANTRESTORE_g) -#define H5E_CANTCOMPUTE (H5OPEN H5E_CANTCOMPUTE_g) -#define H5E_CANTEXTEND (H5OPEN H5E_CANTEXTEND_g) -#define H5E_CANTATTACH (H5OPEN H5E_CANTATTACH_g) -#define H5E_CANTUPDATE (H5OPEN H5E_CANTUPDATE_g) -#define H5E_CANTOPERATE (H5OPEN H5E_CANTOPERATE_g) -H5_DLLVAR hid_t H5E_CANTRESTORE_g; /* Can't restore condition */ -H5_DLLVAR hid_t H5E_CANTCOMPUTE_g; /* Can't compute value */ -H5_DLLVAR hid_t H5E_CANTEXTEND_g; /* Can't extend heap's space */ -H5_DLLVAR hid_t H5E_CANTATTACH_g; /* Can't attach object */ -H5_DLLVAR hid_t H5E_CANTUPDATE_g; /* Can't update object */ -H5_DLLVAR hid_t H5E_CANTOPERATE_g; /* Can't operate on object */ +#define H5E_CANTRESTORE (H5OPEN H5E_CANTRESTORE_g) +#define H5E_CANTCOMPUTE (H5OPEN H5E_CANTCOMPUTE_g) +#define H5E_CANTEXTEND (H5OPEN H5E_CANTEXTEND_g) +#define H5E_CANTATTACH (H5OPEN H5E_CANTATTACH_g) +#define H5E_CANTUPDATE (H5OPEN H5E_CANTUPDATE_g) +#define H5E_CANTOPERATE (H5OPEN H5E_CANTOPERATE_g) +H5_DLLVAR hid_t H5E_CANTRESTORE_g; /* Can't restore condition */ +H5_DLLVAR hid_t H5E_CANTCOMPUTE_g; /* Can't compute value */ +H5_DLLVAR hid_t H5E_CANTEXTEND_g; /* Can't extend heap's space */ +H5_DLLVAR hid_t H5E_CANTATTACH_g; /* Can't attach object */ +H5_DLLVAR hid_t H5E_CANTUPDATE_g; /* Can't update object */ +H5_DLLVAR hid_t H5E_CANTOPERATE_g; /* Can't operate on object */ /* Function entry/exit interface errors */ -#define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g) -#define H5E_ALREADYINIT (H5OPEN H5E_ALREADYINIT_g) -#define H5E_CANTRELEASE (H5OPEN H5E_CANTRELEASE_g) -H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */ -H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */ -H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */ +#define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g) +#define H5E_ALREADYINIT (H5OPEN H5E_ALREADYINIT_g) +#define H5E_CANTRELEASE (H5OPEN H5E_CANTRELEASE_g) +H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */ +H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */ +H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */ /* Property list errors */ -#define H5E_CANTGET (H5OPEN H5E_CANTGET_g) -#define H5E_CANTSET (H5OPEN H5E_CANTSET_g) -#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g) -#define H5E_SETDISALLOWED (H5OPEN H5E_SETDISALLOWED_g) +#define H5E_CANTGET (H5OPEN H5E_CANTGET_g) +#define H5E_CANTSET (H5OPEN H5E_CANTSET_g) +#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g) +#define H5E_SETDISALLOWED (H5OPEN H5E_SETDISALLOWED_g) H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */ H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */ H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */ H5_DLLVAR hid_t H5E_SETDISALLOWED_g; /* Disallowed operation */ /* Free space errors */ -#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g) -#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g) -#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g) -H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */ -H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */ -H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */ +#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g) +#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g) +#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g) +H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */ +H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */ +H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */ /* Object header related errors */ -#define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g) -#define H5E_VERSION (H5OPEN H5E_VERSION_g) -#define H5E_ALIGNMENT (H5OPEN H5E_ALIGNMENT_g) -#define H5E_BADMESG (H5OPEN H5E_BADMESG_g) -#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g) -#define H5E_BADITER (H5OPEN H5E_BADITER_g) -#define H5E_CANTPACK (H5OPEN H5E_CANTPACK_g) -#define H5E_CANTRESET (H5OPEN H5E_CANTRESET_g) -#define H5E_CANTRENAME (H5OPEN H5E_CANTRENAME_g) -H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */ -H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */ -H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */ -H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */ -H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */ -H5_DLLVAR hid_t H5E_BADITER_g; /* Iteration failed */ -H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */ -H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */ -H5_DLLVAR hid_t H5E_CANTRENAME_g; /* Unable to rename object */ +#define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g) +#define H5E_VERSION (H5OPEN H5E_VERSION_g) +#define H5E_ALIGNMENT (H5OPEN H5E_ALIGNMENT_g) +#define H5E_BADMESG (H5OPEN H5E_BADMESG_g) +#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g) +#define H5E_BADITER (H5OPEN H5E_BADITER_g) +#define H5E_CANTPACK (H5OPEN H5E_CANTPACK_g) +#define H5E_CANTRESET (H5OPEN H5E_CANTRESET_g) +#define H5E_CANTRENAME (H5OPEN H5E_CANTRENAME_g) +H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */ +H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */ +H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */ +H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */ +H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */ +H5_DLLVAR hid_t H5E_BADITER_g; /* Iteration failed */ +H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */ +H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */ +H5_DLLVAR hid_t H5E_CANTRENAME_g; /* Unable to rename object */ /* System level errors */ -#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g) -H5_DLLVAR hid_t H5E_SYSERRSTR_g; /* System error message */ +#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g) +H5_DLLVAR hid_t H5E_SYSERRSTR_g; /* System error message */ /* I/O pipeline errors */ -#define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g) -#define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g) -#define H5E_CANAPPLY (H5OPEN H5E_CANAPPLY_g) -#define H5E_SETLOCAL (H5OPEN H5E_SETLOCAL_g) -#define H5E_NOENCODER (H5OPEN H5E_NOENCODER_g) -#define H5E_CANTFILTER (H5OPEN H5E_CANTFILTER_g) -H5_DLLVAR hid_t H5E_NOFILTER_g; /* Requested filter is not available */ -H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */ -H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */ -H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */ -H5_DLLVAR hid_t H5E_NOENCODER_g; /* Filter present but encoding disabled */ -H5_DLLVAR hid_t H5E_CANTFILTER_g; /* Filter operation failed */ +#define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g) +#define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g) +#define H5E_CANAPPLY (H5OPEN H5E_CANAPPLY_g) +#define H5E_SETLOCAL (H5OPEN H5E_SETLOCAL_g) +#define H5E_NOENCODER (H5OPEN H5E_NOENCODER_g) +#define H5E_CANTFILTER (H5OPEN H5E_CANTFILTER_g) +H5_DLLVAR hid_t H5E_NOFILTER_g; /* Requested filter is not available */ +H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */ +H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */ +H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */ +H5_DLLVAR hid_t H5E_NOENCODER_g; /* Filter present but encoding disabled */ +H5_DLLVAR hid_t H5E_CANTFILTER_g; /* Filter operation failed */ /* Group related errors */ -#define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g) -#define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g) -#define H5E_COMPLEN (H5OPEN H5E_COMPLEN_g) -#define H5E_PATH (H5OPEN H5E_PATH_g) -H5_DLLVAR hid_t H5E_CANTOPENOBJ_g; /* Can't open object */ -H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */ -H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */ -H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */ +#define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g) +#define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g) +#define H5E_COMPLEN (H5OPEN H5E_COMPLEN_g) +#define H5E_PATH (H5OPEN H5E_PATH_g) +H5_DLLVAR hid_t H5E_CANTOPENOBJ_g; /* Can't open object */ +H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */ +H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */ +H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */ /* No error */ -#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g) -H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */ +#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g) +H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */ /* Plugin errors */ -#define H5E_OPENERROR (H5OPEN H5E_OPENERROR_g) -H5_DLLVAR hid_t H5E_OPENERROR_g; /* Can't open directory or file */ +#define H5E_OPENERROR (H5OPEN H5E_OPENERROR_g) +H5_DLLVAR hid_t H5E_OPENERROR_g; /* Can't open directory or file */ -/* File accessibilty errors */ -#define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) -#define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g) -#define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g) -#define H5E_CANTOPENFILE (H5OPEN H5E_CANTOPENFILE_g) -#define H5E_CANTCLOSEFILE (H5OPEN H5E_CANTCLOSEFILE_g) -#define H5E_NOTHDF5 (H5OPEN H5E_NOTHDF5_g) -#define H5E_BADFILE (H5OPEN H5E_BADFILE_g) -#define H5E_TRUNCATED (H5OPEN H5E_TRUNCATED_g) -#define H5E_MOUNT (H5OPEN H5E_MOUNT_g) +/* File accessibility errors */ +#define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) +#define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g) +#define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g) +#define H5E_CANTOPENFILE (H5OPEN H5E_CANTOPENFILE_g) +#define H5E_CANTCLOSEFILE (H5OPEN H5E_CANTCLOSEFILE_g) +#define H5E_NOTHDF5 (H5OPEN H5E_NOTHDF5_g) +#define H5E_BADFILE (H5OPEN H5E_BADFILE_g) +#define H5E_TRUNCATED (H5OPEN H5E_TRUNCATED_g) +#define H5E_MOUNT (H5OPEN H5E_MOUNT_g) H5_DLLVAR hid_t H5E_FILEEXISTS_g; /* File already exists */ H5_DLLVAR hid_t H5E_FILEOPEN_g; /* File already open */ H5_DLLVAR hid_t H5E_CANTCREATE_g; /* Unable to create file */ @@ -245,35 +246,35 @@ H5_DLLVAR hid_t H5E_TRUNCATED_g; /* File has been truncated */ H5_DLLVAR hid_t H5E_MOUNT_g; /* File mount error */ /* Object atom related errors */ -#define H5E_BADATOM (H5OPEN H5E_BADATOM_g) -#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g) -#define H5E_CANTREGISTER (H5OPEN H5E_CANTREGISTER_g) -#define H5E_CANTINC (H5OPEN H5E_CANTINC_g) -#define H5E_CANTDEC (H5OPEN H5E_CANTDEC_g) -#define H5E_NOIDS (H5OPEN H5E_NOIDS_g) -H5_DLLVAR hid_t H5E_BADATOM_g; /* Unable to find atom information (already closed?) */ -H5_DLLVAR hid_t H5E_BADGROUP_g; /* Unable to find ID group information */ -H5_DLLVAR hid_t H5E_CANTREGISTER_g; /* Unable to register new atom */ -H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */ -H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */ -H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ +#define H5E_BADATOM (H5OPEN H5E_BADATOM_g) +#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g) +#define H5E_CANTREGISTER (H5OPEN H5E_CANTREGISTER_g) +#define H5E_CANTINC (H5OPEN H5E_CANTINC_g) +#define H5E_CANTDEC (H5OPEN H5E_CANTDEC_g) +#define H5E_NOIDS (H5OPEN H5E_NOIDS_g) +H5_DLLVAR hid_t H5E_BADATOM_g; /* Unable to find atom information (already closed?) */ +H5_DLLVAR hid_t H5E_BADGROUP_g; /* Unable to find ID group information */ +H5_DLLVAR hid_t H5E_CANTREGISTER_g; /* Unable to register new atom */ +H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */ +H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */ +H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ /* Cache related errors */ -#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) -#define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g) -#define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g) -#define H5E_PROTECT (H5OPEN H5E_PROTECT_g) -#define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g) -#define H5E_SYSTEM (H5OPEN H5E_SYSTEM_g) -#define H5E_CANTINS (H5OPEN H5E_CANTINS_g) -#define H5E_CANTPROTECT (H5OPEN H5E_CANTPROTECT_g) -#define H5E_CANTUNPROTECT (H5OPEN H5E_CANTUNPROTECT_g) -#define H5E_CANTPIN (H5OPEN H5E_CANTPIN_g) -#define H5E_CANTUNPIN (H5OPEN H5E_CANTUNPIN_g) -#define H5E_CANTMARKDIRTY (H5OPEN H5E_CANTMARKDIRTY_g) -#define H5E_CANTDIRTY (H5OPEN H5E_CANTDIRTY_g) -#define H5E_CANTEXPUNGE (H5OPEN H5E_CANTEXPUNGE_g) -#define H5E_CANTRESIZE (H5OPEN H5E_CANTRESIZE_g) +#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) +#define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g) +#define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g) +#define H5E_PROTECT (H5OPEN H5E_PROTECT_g) +#define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g) +#define H5E_SYSTEM (H5OPEN H5E_SYSTEM_g) +#define H5E_CANTINS (H5OPEN H5E_CANTINS_g) +#define H5E_CANTPROTECT (H5OPEN H5E_CANTPROTECT_g) +#define H5E_CANTUNPROTECT (H5OPEN H5E_CANTUNPROTECT_g) +#define H5E_CANTPIN (H5OPEN H5E_CANTPIN_g) +#define H5E_CANTUNPIN (H5OPEN H5E_CANTUNPIN_g) +#define H5E_CANTMARKDIRTY (H5OPEN H5E_CANTMARKDIRTY_g) +#define H5E_CANTDIRTY (H5OPEN H5E_CANTDIRTY_g) +#define H5E_CANTEXPUNGE (H5OPEN H5E_CANTEXPUNGE_g) +#define H5E_CANTRESIZE (H5OPEN H5E_CANTRESIZE_g) H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */ H5_DLLVAR hid_t H5E_CANTSERIALIZE_g; /* Unable to serialize data from cache */ H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */ @@ -291,11 +292,11 @@ H5_DLLVAR hid_t H5E_CANTEXPUNGE_g; /* Unable to expunge a metadata cache entry H5_DLLVAR hid_t H5E_CANTRESIZE_g; /* Unable to resize a metadata cache entry */ /* Link related errors */ -#define H5E_TRAVERSE (H5OPEN H5E_TRAVERSE_g) -#define H5E_NLINKS (H5OPEN H5E_NLINKS_g) -#define H5E_NOTREGISTERED (H5OPEN H5E_NOTREGISTERED_g) -#define H5E_CANTMOVE (H5OPEN H5E_CANTMOVE_g) -#define H5E_CANTSORT (H5OPEN H5E_CANTSORT_g) +#define H5E_TRAVERSE (H5OPEN H5E_TRAVERSE_g) +#define H5E_NLINKS (H5OPEN H5E_NLINKS_g) +#define H5E_NOTREGISTERED (H5OPEN H5E_NOTREGISTERED_g) +#define H5E_CANTMOVE (H5OPEN H5E_CANTMOVE_g) +#define H5E_CANTSORT (H5OPEN H5E_CANTSORT_g) H5_DLLVAR hid_t H5E_TRAVERSE_g; /* Link traversal failure */ H5_DLLVAR hid_t H5E_NLINKS_g; /* Too many soft links in path */ H5_DLLVAR hid_t H5E_NOTREGISTERED_g; /* Link class not registered */ @@ -303,33 +304,33 @@ H5_DLLVAR hid_t H5E_CANTMOVE_g; /* Can't move object */ H5_DLLVAR hid_t H5E_CANTSORT_g; /* Can't sort objects */ /* Parallel MPI errors */ -#define H5E_MPI (H5OPEN H5E_MPI_g) -#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g) -#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g) -H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */ -H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */ -H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */ +#define H5E_MPI (H5OPEN H5E_MPI_g) +#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g) +#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g) +H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */ +H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */ +H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */ /* Dataspace errors */ -#define H5E_CANTCLIP (H5OPEN H5E_CANTCLIP_g) -#define H5E_CANTCOUNT (H5OPEN H5E_CANTCOUNT_g) -#define H5E_CANTSELECT (H5OPEN H5E_CANTSELECT_g) -#define H5E_CANTNEXT (H5OPEN H5E_CANTNEXT_g) -#define H5E_BADSELECT (H5OPEN H5E_BADSELECT_g) -#define H5E_CANTCOMPARE (H5OPEN H5E_CANTCOMPARE_g) -H5_DLLVAR hid_t H5E_CANTCLIP_g; /* Can't clip hyperslab region */ -H5_DLLVAR hid_t H5E_CANTCOUNT_g; /* Can't count elements */ -H5_DLLVAR hid_t H5E_CANTSELECT_g; /* Can't select hyperslab */ -H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */ -H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */ -H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */ +#define H5E_CANTCLIP (H5OPEN H5E_CANTCLIP_g) +#define H5E_CANTCOUNT (H5OPEN H5E_CANTCOUNT_g) +#define H5E_CANTSELECT (H5OPEN H5E_CANTSELECT_g) +#define H5E_CANTNEXT (H5OPEN H5E_CANTNEXT_g) +#define H5E_BADSELECT (H5OPEN H5E_BADSELECT_g) +#define H5E_CANTCOMPARE (H5OPEN H5E_CANTCOMPARE_g) +H5_DLLVAR hid_t H5E_CANTCLIP_g; /* Can't clip hyperslab region */ +H5_DLLVAR hid_t H5E_CANTCOUNT_g; /* Can't count elements */ +H5_DLLVAR hid_t H5E_CANTSELECT_g; /* Can't select hyperslab */ +H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */ +H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */ +H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */ /* Argument errors */ -#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g) -#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g) -#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g) -#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g) -#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g) +#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g) +#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g) +#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g) +#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g) +#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g) H5_DLLVAR hid_t H5E_UNINITIALIZED_g; /* Information is uinitialized */ H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */ H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */ @@ -348,23 +349,23 @@ H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */ #define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g) #define H5E_CANTMODIFY (H5OPEN H5E_CANTMODIFY_g) #define H5E_CANTREMOVE (H5OPEN H5E_CANTREMOVE_g) -H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */ -H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */ -H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */ -H5_DLLVAR hid_t H5E_CANTDECODE_g; /* Unable to decode value */ -H5_DLLVAR hid_t H5E_CANTSPLIT_g; /* Unable to split node */ +H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */ +H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */ +H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */ +H5_DLLVAR hid_t H5E_CANTDECODE_g; /* Unable to decode value */ +H5_DLLVAR hid_t H5E_CANTSPLIT_g; /* Unable to split node */ H5_DLLVAR hid_t H5E_CANTREDISTRIBUTE_g; /* Unable to redistribute records */ -H5_DLLVAR hid_t H5E_CANTSWAP_g; /* Unable to swap records */ -H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */ -H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */ -H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */ -H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */ +H5_DLLVAR hid_t H5E_CANTSWAP_g; /* Unable to swap records */ +H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */ +H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */ +H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */ +H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */ /* Datatype conversion errors */ -#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g) -#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g) -H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */ -H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */ +#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g) +#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g) +H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */ +H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */ #ifdef __cplusplus } diff --git a/src/H5Eterm.h b/src/H5Eterm.h index 1d9f0f2..247af68 100644 --- a/src/H5Eterm.h +++ b/src/H5Eterm.h @@ -14,89 +14,203 @@ /* Generated automatically by bin/make_err -- do not edit */ /* Add new errors to H5err.txt file */ + #ifndef _H5Eterm_H #define _H5Eterm_H /* Reset major error IDs */ - -H5E_DATASET_g = H5E_FUNC_g = H5E_STORAGE_g = H5E_FILE_g = H5E_SOHM_g = H5E_SYM_g = H5E_PLUGIN_g = H5E_VFL_g = - H5E_INTERNAL_g = H5E_BTREE_g = H5E_REFERENCE_g = H5E_DATASPACE_g = H5E_RESOURCE_g = H5E_PLIST_g = - H5E_LINK_g = H5E_DATATYPE_g = H5E_RS_g = H5E_HEAP_g = H5E_OHDR_g = H5E_ATOM_g = H5E_ATTR_g = - H5E_NONE_MAJOR_g = H5E_IO_g = H5E_SLIST_g = H5E_EFL_g = H5E_TST_g = H5E_ARGS_g = H5E_ERROR_g = - H5E_PLINE_g = H5E_FSPACE_g = H5E_CACHE_g = (-1); + +H5E_DATASET_g= +H5E_FUNC_g= +H5E_STORAGE_g= +H5E_FILE_g= +H5E_SOHM_g= +H5E_SYM_g= +H5E_PLUGIN_g= +H5E_VFL_g= +H5E_INTERNAL_g= +H5E_BTREE_g= +H5E_REFERENCE_g= +H5E_DATASPACE_g= +H5E_RESOURCE_g= +H5E_PLIST_g= +H5E_LINK_g= +H5E_DATATYPE_g= +H5E_RS_g= +H5E_HEAP_g= +H5E_OHDR_g= +H5E_ATOM_g= +H5E_ATTR_g= +H5E_NONE_MAJOR_g= +H5E_IO_g= +H5E_SLIST_g= +H5E_EFL_g= +H5E_TST_g= +H5E_ARGS_g= +H5E_ERROR_g= +H5E_PLINE_g= +H5E_FSPACE_g= +H5E_CACHE_g= (-1); /* Reset minor error IDs */ -/* Generic low-level file I/O errors */ -H5E_SEEKERROR_g = H5E_READERROR_g = H5E_WRITEERROR_g = H5E_CLOSEERROR_g = H5E_OVERFLOW_g = H5E_FCNTL_g = - - /* Resource errors */ - H5E_NOSPACE_g = H5E_CANTALLOC_g = H5E_CANTCOPY_g = H5E_CANTFREE_g = H5E_ALREADYEXISTS_g = H5E_CANTLOCK_g = - H5E_CANTUNLOCK_g = H5E_CANTGC_g = H5E_CANTGETSIZE_g = H5E_OBJOPEN_g = - - /* Heap errors */ - H5E_CANTRESTORE_g = H5E_CANTCOMPUTE_g = H5E_CANTEXTEND_g = H5E_CANTATTACH_g = H5E_CANTUPDATE_g = - H5E_CANTOPERATE_g = - - /* Function entry/exit interface errors */ - H5E_CANTINIT_g = H5E_ALREADYINIT_g = H5E_CANTRELEASE_g = - - /* Property list errors */ - H5E_CANTGET_g = H5E_CANTSET_g = H5E_DUPCLASS_g = H5E_SETDISALLOWED_g = - - /* Free space errors */ - H5E_CANTMERGE_g = H5E_CANTREVIVE_g = H5E_CANTSHRINK_g = - - /* Object header related errors */ - H5E_LINKCOUNT_g = H5E_VERSION_g = H5E_ALIGNMENT_g = H5E_BADMESG_g = H5E_CANTDELETE_g = H5E_BADITER_g = - H5E_CANTPACK_g = H5E_CANTRESET_g = H5E_CANTRENAME_g = - - /* System level errors */ - H5E_SYSERRSTR_g = - - /* I/O pipeline errors */ - H5E_NOFILTER_g = H5E_CALLBACK_g = H5E_CANAPPLY_g = H5E_SETLOCAL_g = H5E_NOENCODER_g = H5E_CANTFILTER_g = - - /* Group related errors */ - H5E_CANTOPENOBJ_g = H5E_CANTCLOSEOBJ_g = H5E_COMPLEN_g = H5E_PATH_g = - - /* No error */ - H5E_NONE_MINOR_g = - - /* Plugin errors */ - H5E_OPENERROR_g = - - /* File accessibilty errors */ - H5E_FILEEXISTS_g = H5E_FILEOPEN_g = H5E_CANTCREATE_g = H5E_CANTOPENFILE_g = H5E_CANTCLOSEFILE_g = - H5E_NOTHDF5_g = H5E_BADFILE_g = H5E_TRUNCATED_g = H5E_MOUNT_g = - - /* Object atom related errors */ - H5E_BADATOM_g = H5E_BADGROUP_g = H5E_CANTREGISTER_g = H5E_CANTINC_g = H5E_CANTDEC_g = H5E_NOIDS_g = - - /* Cache related errors */ - H5E_CANTFLUSH_g = H5E_CANTSERIALIZE_g = H5E_CANTLOAD_g = H5E_PROTECT_g = H5E_NOTCACHED_g = H5E_SYSTEM_g = - H5E_CANTINS_g = H5E_CANTPROTECT_g = H5E_CANTUNPROTECT_g = H5E_CANTPIN_g = H5E_CANTUNPIN_g = - H5E_CANTMARKDIRTY_g = H5E_CANTDIRTY_g = H5E_CANTEXPUNGE_g = H5E_CANTRESIZE_g = - - /* Link related errors */ - H5E_TRAVERSE_g = H5E_NLINKS_g = H5E_NOTREGISTERED_g = H5E_CANTMOVE_g = H5E_CANTSORT_g = - - /* Parallel MPI errors */ - H5E_MPI_g = H5E_MPIERRSTR_g = H5E_CANTRECV_g = - - /* Dataspace errors */ - H5E_CANTCLIP_g = H5E_CANTCOUNT_g = H5E_CANTSELECT_g = H5E_CANTNEXT_g = H5E_BADSELECT_g = - H5E_CANTCOMPARE_g = - - /* Argument errors */ - H5E_UNINITIALIZED_g = H5E_UNSUPPORTED_g = H5E_BADTYPE_g = H5E_BADRANGE_g = H5E_BADVALUE_g = - - /* B-tree related errors */ - H5E_NOTFOUND_g = H5E_EXISTS_g = H5E_CANTENCODE_g = H5E_CANTDECODE_g = H5E_CANTSPLIT_g = - H5E_CANTREDISTRIBUTE_g = H5E_CANTSWAP_g = H5E_CANTINSERT_g = H5E_CANTLIST_g = H5E_CANTMODIFY_g = - H5E_CANTREMOVE_g = - /* Datatype conversion errors */ - H5E_CANTCONVERT_g = H5E_BADSIZE_g = (-1); +/* Generic low-level file I/O errors */ +H5E_SEEKERROR_g= +H5E_READERROR_g= +H5E_WRITEERROR_g= +H5E_CLOSEERROR_g= +H5E_OVERFLOW_g= +H5E_FCNTL_g= + +/* Resource errors */ +H5E_NOSPACE_g= +H5E_CANTALLOC_g= +H5E_CANTCOPY_g= +H5E_CANTFREE_g= +H5E_ALREADYEXISTS_g= +H5E_CANTLOCK_g= +H5E_CANTUNLOCK_g= +H5E_CANTGC_g= +H5E_CANTGETSIZE_g= +H5E_OBJOPEN_g= + +/* Heap errors */ +H5E_CANTRESTORE_g= +H5E_CANTCOMPUTE_g= +H5E_CANTEXTEND_g= +H5E_CANTATTACH_g= +H5E_CANTUPDATE_g= +H5E_CANTOPERATE_g= + +/* Function entry/exit interface errors */ +H5E_CANTINIT_g= +H5E_ALREADYINIT_g= +H5E_CANTRELEASE_g= + +/* Property list errors */ +H5E_CANTGET_g= +H5E_CANTSET_g= +H5E_DUPCLASS_g= +H5E_SETDISALLOWED_g= + +/* Free space errors */ +H5E_CANTMERGE_g= +H5E_CANTREVIVE_g= +H5E_CANTSHRINK_g= + +/* Object header related errors */ +H5E_LINKCOUNT_g= +H5E_VERSION_g= +H5E_ALIGNMENT_g= +H5E_BADMESG_g= +H5E_CANTDELETE_g= +H5E_BADITER_g= +H5E_CANTPACK_g= +H5E_CANTRESET_g= +H5E_CANTRENAME_g= + +/* System level errors */ +H5E_SYSERRSTR_g= + +/* I/O pipeline errors */ +H5E_NOFILTER_g= +H5E_CALLBACK_g= +H5E_CANAPPLY_g= +H5E_SETLOCAL_g= +H5E_NOENCODER_g= +H5E_CANTFILTER_g= + +/* Group related errors */ +H5E_CANTOPENOBJ_g= +H5E_CANTCLOSEOBJ_g= +H5E_COMPLEN_g= +H5E_PATH_g= + +/* No error */ +H5E_NONE_MINOR_g= + +/* Plugin errors */ +H5E_OPENERROR_g= + +/* File accessibility errors */ +H5E_FILEEXISTS_g= +H5E_FILEOPEN_g= +H5E_CANTCREATE_g= +H5E_CANTOPENFILE_g= +H5E_CANTCLOSEFILE_g= +H5E_NOTHDF5_g= +H5E_BADFILE_g= +H5E_TRUNCATED_g= +H5E_MOUNT_g= + +/* Object atom related errors */ +H5E_BADATOM_g= +H5E_BADGROUP_g= +H5E_CANTREGISTER_g= +H5E_CANTINC_g= +H5E_CANTDEC_g= +H5E_NOIDS_g= + +/* Cache related errors */ +H5E_CANTFLUSH_g= +H5E_CANTSERIALIZE_g= +H5E_CANTLOAD_g= +H5E_PROTECT_g= +H5E_NOTCACHED_g= +H5E_SYSTEM_g= +H5E_CANTINS_g= +H5E_CANTPROTECT_g= +H5E_CANTUNPROTECT_g= +H5E_CANTPIN_g= +H5E_CANTUNPIN_g= +H5E_CANTMARKDIRTY_g= +H5E_CANTDIRTY_g= +H5E_CANTEXPUNGE_g= +H5E_CANTRESIZE_g= + +/* Link related errors */ +H5E_TRAVERSE_g= +H5E_NLINKS_g= +H5E_NOTREGISTERED_g= +H5E_CANTMOVE_g= +H5E_CANTSORT_g= + +/* Parallel MPI errors */ +H5E_MPI_g= +H5E_MPIERRSTR_g= +H5E_CANTRECV_g= + +/* Dataspace errors */ +H5E_CANTCLIP_g= +H5E_CANTCOUNT_g= +H5E_CANTSELECT_g= +H5E_CANTNEXT_g= +H5E_BADSELECT_g= +H5E_CANTCOMPARE_g= + +/* Argument errors */ +H5E_UNINITIALIZED_g= +H5E_UNSUPPORTED_g= +H5E_BADTYPE_g= +H5E_BADRANGE_g= +H5E_BADVALUE_g= + +/* B-tree related errors */ +H5E_NOTFOUND_g= +H5E_EXISTS_g= +H5E_CANTENCODE_g= +H5E_CANTDECODE_g= +H5E_CANTSPLIT_g= +H5E_CANTREDISTRIBUTE_g= +H5E_CANTSWAP_g= +H5E_CANTINSERT_g= +H5E_CANTLIST_g= +H5E_CANTMODIFY_g= +H5E_CANTREMOVE_g= + +/* Datatype conversion errors */ +H5E_CANTCONVERT_g= +H5E_BADSIZE_g= (-1); #endif /* H5Eterm_H */ @@ -23,20 +23,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#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 "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#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 "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ /* Local Macros */ @@ -175,97 +175,86 @@ H5F_term_interface(void) } /* end H5F_term_interface() */ /*------------------------------------------------------------------------- - * 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. - * - * Return: Success: template ID - * - * Failure: FAIL - * - * Programmer: Unknown + * 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 *------------------------------------------------------------------------- */ 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 file creation 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_INTERNAL, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy file creation properties") done: FUNC_LEAVE_API(ret_value) } /* end H5Fget_create_plist() */ /*------------------------------------------------------------------------- - * 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 - * - * Programmer: Robb Matzke - * Wednesday, February 18, 1998 - * + * 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 *f; /* 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") + 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") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: FUNC_LEAVE_API(ret_value) } /* end H5Fget_access_plist() */ /*------------------------------------------------------------------------- - * Function: H5Fget_obj_count - * - * Purpose: Public function returning the number of opened object IDs - * (files, datasets, groups and datatypes) in the same file. + * Function: H5Fget_obj_count * - * Return: Non-negative on success; negative on failure. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 + * 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 *------------------------------------------------------------------------- */ ssize_t @@ -273,22 +262,22 @@ 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") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "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") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, (-1), "H5F_get_obj_count failed") - /* Set the return value */ + /* Set return value */ ret_value = (ssize_t)obj_count; done: @@ -296,21 +285,12 @@ done: } /* end H5Fget_obj_count() */ /*------------------------------------------------------------------------- - * Function: H5Fget_object_ids - * - * Purpose: Public function to return a list of opened object IDs. - * - * Return: Non-negative on success; negative on failure. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 + * Function: H5Fget_object_ids * - * Modification: - * Raymond Lu - * 24 September 2008 - * Changed the return value to ssize_t and MAX_OBJTS to size_t to - * accommadate potential large number of objects. + * Purpose: Public function to return a list of opened object IDs. * + * Return: Success: The number of IDs in oid_list + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -318,22 +298,22 @@ 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") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "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 is 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") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, (-1), "H5F_get_obj_ids failed") /* Set the return value */ ret_value = (ssize_t)obj_id_count; @@ -348,57 +328,47 @@ done: * Purpose: Returns a pointer to the file handle of the low-level file * driver. * - * Return: Success: non-negative value. - * Failure: negative. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ 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 */ 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) } /* end H5Fget_vfd_handle() */ /*------------------------------------------------------------------------- - * Function: H5Fis_hdf5 - * - * 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. + * Function: H5Fis_hdf5 * - * Return: Success: TRUE/FALSE + * Purpose: Check the file signature to detect an HDF5 file. * - * Failure: Negative + * 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. * - * Programmer: Unknown + * Return: Success: TRUE/FALSE + * Failure: -1 (includes file does not exist) * - * Modifications: - * Robb Matzke, 1999-08-02 - * Rewritten to use the virtual file layer. *------------------------------------------------------------------------- */ htri_t @@ -418,72 +388,68 @@ H5Fis_hdf5(const char *name) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file") done: - FUNC_LEAVE_API(ret_value) } /* end H5Fis_hdf5() */ /*------------------------------------------------------------------------- - * Function: H5Fcreate - * - * Purpose: This is the primary function for creating HDF5 files . The - * flags parameter determines whether an existing file will be - * overwritten or not. All newly created files are opened for - * both reading and writing. All flags may be combined with the - * bit-wise OR operator (`|') to change the behavior of the file - * create call. - * - * The more complex behaviors of a file's creation and access - * are controlled through the file-creation and file-access - * property lists. The value of H5P_DEFAULT for a template - * value indicates that the library should use the default - * values for the appropriate template. - * - * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for - * the list of file creation and file access properties. - * - * Return: Success: A file ID - * - * Failure: FAIL - * - * Programmer: Unknown - * + * Function: H5Fcreate + * + * Purpose: This is the primary function for creating HDF5 files . The + * flags parameter determines whether an existing file will be + * overwritten or not. All newly created files are opened for + * both reading and writing. All flags may be combined with the + * bit-wise OR operator (`|') to change the behavior of the file + * create call. + * + * The more complex behaviors of a file's creation and access + * are controlled through the file-creation and file-access + * property lists. The value of H5P_DEFAULT for a template + * value indicates that the library should use the default + * values for the appropriate template. + * + * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for + * the list of file creation and file access properties. + * + * Return: Success: A file ID + * 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(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") + /* In this routine, we only accept the following flags: * H5F_ACC_EXCL and H5F_ACC_TRUNC */ if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags") + /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation") /* Check file creation property list */ if (H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list") /* Check the file access property list */ if (H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file access property list") - /* - * Adjust bit flags by turning on the creation bit and making sure that + /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. */ @@ -491,15 +457,13 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; - /* - * Create a new file or truncate an existing file. - */ + /* Create a new file or truncate an existing file */ if (NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") + 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) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") /* Keep this ID in file object structure */ new_file->file_id = ret_value; @@ -507,101 +471,74 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) done: if (ret_value < 0 && new_file) if (H5F_close(new_file) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ /*------------------------------------------------------------------------- - * Function: H5Fopen - * - * Purpose: This is the primary function for accessing existing HDF5 - * files. The FLAGS argument determines whether writing to an - * existing file will be allowed or not. All flags may be - * combined with the bit-wise OR operator (`|') to change the - * behavior of the file open call. The more complex behaviors - * of a file's access are controlled through the file-access - * property list. - * - * See Also: H5Fpublic.h for a list of possible values for FLAGS. + * Function: H5Fopen * - * Return: Success: A file ID + * Purpose: This is the primary function for accessing existing HDF5 + * files. The FLAGS argument determines whether writing to an + * existing file will be allowed or not. All flags may be + * combined with the bit-wise OR operator (`|') to change the + * behavior of the file open call. The more complex behaviors + * of a file's access are controlled through the file-access + * property list. * - * Failure: FAIL + * See Also: H5Fpublic.h for a list of possible values for FLAGS. * - * Programmer: Unknown - * - * Modifications: - * Robb Matzke, 1997-07-18 - * File struct creation and destruction is through H5F_new() and - * H5F_dest(). Reading the root symbol table entry is done with - * H5G_decode(). - * - * Robb Matzke, 1997-09-23 - * Most of the work is now done by H5F_open() since H5Fcreate() - * and H5Fopen() originally contained almost identical code. - * - * Robb Matzke, 1998-02-18 - * Added better error checking for the flags and the file access - * property list. It used to be possible to make the library - * dump core by passing an object ID that was not a file access - * property list. - * - * Robb Matzke, 1999-08-02 - * The file access property list is passed to the H5F_open() as - * object IDs. + * Return: Success: A file ID + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t H5Fopen(const char *filename, unsigned flags, 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(FAIL) + 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, FAIL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* Reject undefined flags (~H5F_ACC_PUBLIC_FLAGS) and the H5F_ACC_TRUNC & H5F_ACC_EXCL flags */ if ((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags") if (H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file access property list") /* Open the file */ if (NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Get an atom for the file */ + /* Get an ID 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 && H5F_try_close(new_file) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") - + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ /*------------------------------------------------------------------------- - * 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. - * - * Return: Non-negative on success/Negative on failure + * Function: H5Fflush * - * Programmer: Robb Matzke - * Thursday, August 6, 1998 + * 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: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -609,7 +546,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); @@ -677,7 +614,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) /* Flush the file */ /* - * Nothing to do if the file is read only. This determination is + * Nothing to do if the file is read only. This determination is * made at the shared open(2) flags level, implying that opening a * file twice, once for read-only and once for read-write, and then * calling H5Fflush() with the read-only handle, still causes data @@ -702,24 +639,17 @@ done: } /* end H5Fflush() */ /*------------------------------------------------------------------------- - * 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. - * - * Return: Success: Non-negative + * Function: H5Fclose * - * Failure: Negative - * - * Programmer: Robb Matzke - * Saturday, February 20, 1999 - * - * Modifications: + * 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: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -732,7 +662,7 @@ H5Fclose(hid_t file_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* Check/fix arguments. */ + /* Check arguments */ if (H5I_FILE != H5I_get_type(file_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") @@ -762,41 +692,36 @@ done: } /* end H5Fclose() */ /*------------------------------------------------------------------------- - * 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. - * - * Return: Success: New file ID - * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Friday, October 16, 1998 + * 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 *------------------------------------------------------------------------- */ 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 */ 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, "invalid file identifier") /* 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") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Duplicate old file's names */ new_file->open_name = H5MM_xstrdup(old_file->open_name); @@ -804,7 +729,7 @@ H5Freopen(hid_t file_id) new_file->extpath = H5MM_xstrdup(old_file->extpath); 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; @@ -812,22 +737,19 @@ H5Freopen(hid_t file_id) done: if (ret_value < 0 && new_file) if (H5F_dest(new_file, H5AC_dxpl_id, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") + 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 + * Purpose: Public API to retrieve the file's 'intent' flags passed * during H5Fopen() * - * Return: Non-negative on success/negative on failure - * - * Programmer: James Laird - * August 23, 2006 - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -865,13 +787,8 @@ done: * * Purpose: Retrieves the amount of free space in the file. * - * Return: Success: Amount of free space for type - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Oct 6, 2003 - * + * Return: Success: Amount of free space for type + * Failure: -1 *------------------------------------------------------------------------- */ hssize_t @@ -881,16 +798,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 */ if (H5MF_get_freespace(file, H5AC_ind_dxpl_id, &tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to check free space for file") ret_value = (hssize_t)tot_space; @@ -903,15 +820,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: Success: Non-negative * Failure: Negative - * - * Programmer: David Pitt - * david.pitt@bigpond.com - * Apr 27, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -932,6 +844,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) /* Go get the actual file size */ if (HADDR_UNDEF == (eof = H5FD_get_eof(file->shared->lf))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + base_addr = H5FD_get_base_addr(file->shared->lf); if (size) @@ -945,59 +858,55 @@ 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. - * - * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value - * - * Programmer: John Mainzer - * 11/15/11 + * 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 *------------------------------------------------------------------------- */ 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 */ + 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 */ 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) @@ -1007,18 +916,14 @@ done: * Function: H5Fget_mdc_config * * 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. - * - * Return: Success: SUCCEED - * Failure: FAIL + * from the metadata cache, and return it in *config_ptr. * - * Programmer: John Mainzer - * 3/24/05 + * 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: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1048,15 +953,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. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 + * configuration, using the contents of the instance of + * H5AC_cache_config_t pointed to by config_ptr. * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1068,11 +969,11 @@ 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.") @@ -1084,16 +985,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. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 + * This rate is the overall hit rate since the last time + * the hit rate statistics were reset either manually or + * automatically. * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1106,13 +1003,12 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); /* 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") - if (NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") + 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 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.") @@ -1124,17 +1020,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. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 + * 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: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1152,11 +1044,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.") - if (cur_num_entries_ptr != NULL) *cur_num_entries_ptr = (int)cur_num_entries; @@ -1168,20 +1059,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. - * - * 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. + * 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. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 3/24/05 + * 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: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1193,7 +1080,7 @@ 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") @@ -1209,22 +1096,19 @@ 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. - * - * Note: This routine returns the name that was used to open the file, - * not the actual name after resolving symlinks, etc. + * 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. * - * Return: Success: The length of the file name - * Failure: Negative - * - * Programmer: Raymond Lu - * June 29, 2004 + * 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: -1 *------------------------------------------------------------------------- */ ssize_t @@ -1232,9 +1116,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; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); /* For file IDs, get the file object directly */ @@ -1250,7 +1134,7 @@ H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size) /* 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 */ @@ -1271,10 +1155,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_info - * 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. - * Consider success when there is no superblock extension and/or SOHM table + * Consider success when there is no superblock extension and/or SOHM table * * Return: Success: non-negative on success * Failure: Negative @@ -1338,11 +1222,8 @@ done: * provided file, potentially closing any cached files * unless they are held open from somewhere\ else. * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Neil Fortner; December 30, 2010 - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -12,14 +12,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> - * Monday, July 26, 1999 - * - * Purpose: The Virtual File Layer as described in documentation. - * This is the greatest common denominator for all types of - * storage access whether a file, memory, network, etc. This - * layer usually just dispatches the request to an actual - * file driver layer. + * Purpose: The Virtual File Layer as described in documentation. + * This is the greatest common denominator for all types of + * storage access whether a file, memory, network, etc. This + * layer usually just dispatches the request to an actual + * file driver layer. */ /****************/ @@ -35,25 +32,25 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5FDcore.h" /* Files stored entirely in memory */ -#include "H5FDfamily.h" /* File families */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5FDcore.h" /* Files stored entirely in memory */ +#include "H5FDfamily.h" /* File families */ #include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /* Usage-partitioned file family */ -#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Windows buffered I/O */ #endif -#include "H5FDdirect.h" /* Direct file I/O */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5FDdirect.h" /* Direct file I/O */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -173,20 +170,15 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_term_interface * - * 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. - * - * Programmer: Robb Matzke - * Friday, February 19, 1999 - * - * Modifications: + * Failure: Never fails. * *------------------------------------------------------------------------- */ @@ -238,18 +230,11 @@ H5FD_term_interface(void) /*------------------------------------------------------------------------- * 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_interface). - * - * Return: Success: Non-negative - * - * Failure: 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). * - * Programmer: Robb Matzke - * Monday, July 26, 1999 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -266,54 +251,49 @@ H5FD_free_cls(H5FD_class_t *cls) /*------------------------------------------------------------------------- * Function: H5FDregister * - * Purpose: Registers a new file driver as a member of the virtual file - * driver class. Certain fields of the class struct are - * required and that is checked here so it doesn't have to be - * checked every time the field is accessed. + * Purpose: Registers a new file driver as a member of the virtual file + * driver class. Certain fields of the class struct are + * required and that is checked here so it doesn't have to be + * checked every time the field is accessed. * - * Return: Success: A file driver ID which is good until the - * library is closed or the driver is - * unregistered. + * Return: Success: A file driver ID which is good until the + * library is closed or the driver is + * unregistered. * - * Failure: A negative value. - * - * Programmer: Robb Matzke - * Monday, July 26, 1999 - * - * Modifications: - * Copied guts of function into H5FD_register - * Quincey Koziol - * Friday, January 30, 2004 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5FDregister(const H5FD_class_t *cls) { - hid_t ret_value; 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) @@ -322,27 +302,16 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_register * - * Purpose: Registers a new file driver as a member of the virtual file - * driver class. Certain fields of the class struct are - * required and that is checked here so it doesn't have to be - * checked every time the field is accessed. + * Purpose: Registers a new file driver as a member of the virtual file + * driver class. Certain fields of the class struct are + * required and that is checked here so it doesn't have to be + * checked every time the field is accessed. * - * Return: Success: A file driver ID which is good until the - * library is closed or the driver is - * unregistered. + * Return: Success: A file driver ID which is good until the + * library is closed or the driver is + * unregistered. * - * Failure: A negative value. - * - * Programmer: Robb Matzke - * Monday, July 26, 1999 - * - * Modifications: - * Broke into public and internal routines & added 'size' - * parameter to internal routine, which allows us to create - * sub-classes of H5FD_class_t for internal support (see the - * MPI drivers, etc.) - * Quincey Koziol - * January 30, 2004 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -352,11 +321,11 @@ 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; + 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); @@ -367,15 +336,16 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) /* 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); @@ -385,17 +355,12 @@ done: /*------------------------------------------------------------------------- * Function: H5FDunregister * - * Purpose: Removes a driver ID from the library. This in no way affects - * file access property lists which have been defined to use - * this driver or files which are already opened under this - * driver. - * - * Return: Success: Non-negative + * Purpose: Removes a driver ID from the library. This in no way affects + * file access property lists which have been defined to use + * this driver or files which are already opened under this + * driver. * - * Failure: Negative - * - * Programmer: Robb Matzke - * Monday, July 26, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -422,20 +387,17 @@ done: /*------------------------------------------------------------------------- * 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 - * - * Programmer: Robb Matzke - * Friday, August 20, 1999 + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -472,18 +434,13 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_sb_size * - * Purpose: Obtains the number of bytes required to store the driver file - * access data in the HDF5 superblock. - * - * Return: Success: Number of bytes required. + * Purpose: Obtains the number of bytes required to store the driver file + * access data in the HDF5 superblock. * - * Failure: 0 if an error occurs or if the driver has no - * data to store in the superblock. + * Return: Success: Number of bytes required. May be zero if the + * driver has no data to store in the superblock. * - * Programmer: Robb Matzke - * Monday, August 16, 1999 - * - * Modifications: + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ @@ -494,8 +451,11 @@ H5FD_sb_size(H5FD_t *file) 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); @@ -506,21 +466,14 @@ done: /*------------------------------------------------------------------------- * 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. - * - * Return: Success: Non-negative + * 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. * - * Failure: Negative - * - * Programmer: Robb Matzke - * Monday, August 16, 1999 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -531,24 +484,24 @@ H5FD_sb_encode(H5FD_t *file, char *name /*out*/, uint8_t *buf) 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") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_sb_encode() */ /*------------------------------------------------------------------------- * Function: H5FD_sb_decode * - * Purpose: Decodes the driver information block. + * Purpose: Decodes the driver information block. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Robb Matzke - * Monday, August 16, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -559,7 +512,11 @@ H5FD_sb_decode(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); + + /* 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") @@ -660,26 +617,22 @@ done: /*------------------------------------------------------------------------- * 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. * - * Failure: NULL, including when the file has no - * properties. + * This can be NULL if the file has no properties. * - * Programmer: Robb Matzke - * Friday, August 13, 1999 - * - * Modifications: + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ @@ -690,8 +643,11 @@ H5FD_fapl_get(H5FD_t *file) 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); @@ -819,55 +775,50 @@ done: /*------------------------------------------------------------------------- * 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). - * - * 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). + * 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). * - * H5F_ACC_CREATE: Create the file if it doesn't already exist. - * However, see H5F_ACC_EXCL below. + * Possible values for the FLAGS bits are: * - * 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_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_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_CREATE: Create the file if it doesn't already exist. + * However, see H5F_ACC_EXCL below. * - * 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. + * H5F_ACC_TRUNC: Truncate the file if it already exists. This + * is equivalent to deleting the file and then + * creating a new empty file. * - * 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. + * 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. * - * Return: Success: Pointer to a new file driver struct. + * 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. * - * Failure: NULL + * 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. * - * Programmer: Robb Matzke - * Tuesday, July 27, 1999 + * Return: Success: Pointer to a new file driver struct. * - * Modifications: + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -885,6 +836,7 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + /* Call private function */ if (NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") @@ -895,21 +847,11 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_open * - * Purpose: Private version of H5FDopen() - * - * Return: Success: Pointer to a new file driver struct + * Purpose: Private version of H5FDopen() * - * Failure: NULL + * Return: Success: Pointer to a new file driver struct * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -922,11 +864,11 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5P_genplist_t * plist; /* Property list pointer */ unsigned long driver_flags = 0; /* File-inspecific driver feature flags */ H5FD_file_image_info_t file_image_info; /* Initial file image */ - H5FD_t * ret_value; /* Return value */ + H5FD_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) - /* Sanity check */ + /* Sanity checks */ if (0 == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") @@ -1003,17 +945,13 @@ done: /*------------------------------------------------------------------------- * 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 - * - * Programmer: Robb Matzke - * Tuesday, July 27, 1999 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -1025,9 +963,13 @@ H5FDclose(H5FD_t *file) 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") @@ -1038,13 +980,9 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_close * - * Purpose: Private version of H5FDclose() - * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDclose() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1056,16 +994,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); @@ -1079,63 +1017,54 @@ done: /*------------------------------------------------------------------------- * 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. - * - * Return: Success: A value like strcmp() + * 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. * - * 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. + * Return: Success: A value like strcmp() * - * Programmer: Robb Matzke - * Tuesday, July 27, 1999 - * - * Modifications: + * 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 * - * Purpose: Private version of H5FDcmp() - * - * Return: Success: A value like strcmp() - * - * Failure: Must never fail. + * Purpose: Private version of H5FDcmp() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: Success: A value like strcmp() * - * Modifications: + * Failure: Must never fail. * *------------------------------------------------------------------------- */ int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { - int ret_value; + 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) @@ -1157,40 +1086,42 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) 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) + * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h) * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * - * Modifications: + * 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) @@ -1199,33 +1130,33 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_query * - * Purpose: Private version of H5FDquery() - * - * Return: Success: non-negative - * - * Failure: negative + * Purpose: Private version of H5FDquery() * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static int -H5FD_query(const H5FD_t *f, unsigned long *flags /*out*/) +H5FD_query(const H5FD_t *file, unsigned long *flags /*out*/) { int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI(FAIL) - 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() */ @@ -1267,12 +1198,12 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) /*------------------------------------------------------------------------- * 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 @@ -1288,18 +1219,15 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) * 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 - * - * Programmer: Robb Matzke - * Tuesday, July 27, 1999 + * Failure: The undefined address HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1311,9 +1239,11 @@ 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") if (size == 0) @@ -1323,7 +1253,7 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list") - /* Do the real work */ + /* Call private function */ if (HADDR_UNDEF == (ret_value = H5FD_alloc_real(file, dxpl_id, type, size, NULL, NULL))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory") @@ -1337,21 +1267,14 @@ done: /*------------------------------------------------------------------------- * 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. + * 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 - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, July 28, 1999 - * - * Modifications: + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -1363,9 +1286,11 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz 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) @@ -1373,7 +1298,7 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - /* Do the real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD_free_real(file, dxpl_id, type, addr - file->base_addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed") @@ -1385,14 +1310,11 @@ done: /*------------------------------------------------------------------------- * Function: H5FDget_eoa * - * Purpose: Returns the address of the first byte after the last - * allocated memory in the file. - * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF + * Purpose: Returns the address of the first byte after the last + * allocated memory in the file. * - * Programmer: Robb Matzke - * Friday, July 30, 1999 + * Return: Success: First byte after allocated memory. + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1404,13 +1326,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") @@ -1422,26 +1346,23 @@ done: } /* end H5FDget_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FDset_eoa + * Function: H5FDset_eoa * - * Purpose: Set the end-of-address marker for the file. The ADDR is the - * address of the first byte past the last allocated byte of the - * file. This function is called from two places: + * Purpose: Set the end-of-address marker for the file. The ADDR is the + * address of the first byte past the last allocated byte of the + * file. This function is called from two places: * - * It is called after an existing file is opened in order to - * "allocate" enough space to read the superblock and then - * to "allocate" the entire hdf5 file based on the contents - * of the superblock. + * It is called after an existing file is opened in order to + * "allocate" enough space to read the superblock and then + * to "allocate" the entire hdf5 file based on the contents + * of the superblock. * - * It is called during file memory allocation if the - * allocation request cannot be satisfied from the free list - * and the driver didn't supply an allocation callback. + * It is called during file memory allocation if the + * allocation request cannot be satisfied from the free list + * and the driver didn't supply an allocation callback. * - * Return: Success: Non-negative - * Failure: Negative, no side effect - * - * Programmer: Robb Matzke - * Friday, July 30, 1999 + * Return: Success: Non-negative + * Failure: Negative, no side effect * *------------------------------------------------------------------------- */ @@ -1453,15 +1374,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") @@ -1473,26 +1396,21 @@ done: /*------------------------------------------------------------------------- * 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 - * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * - * Modifications: + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1505,10 +1423,12 @@ H5FDget_eof(H5FD_t *file) H5TRACE1("a", "*x", file); /* 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))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed") @@ -1522,23 +1442,21 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_get_maxaddr * - * Purpose: Private version of H5FDget_eof() - * - * Return: Success: The maximum address allowed in the file. - * Failure: HADDR_UNDEF + * Purpose: Private version of H5FDget_eof() * - * Programmer: Quincey Koziol - * Thursday, January 3, 2008 + * Return: Success: The maximum address allowed in the file. + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ haddr_t H5FD_get_maxaddr(const H5FD_t *file) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) + /* Sanity checks */ HDassert(file); /* Set return value */ @@ -1551,13 +1469,9 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_get_feature_flags * - * Purpose: Retrieve the feature flags for the VFD - * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Retrieve the feature flags for the VFD * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1566,6 +1480,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); @@ -1578,13 +1493,9 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) /*------------------------------------------------------------------------- * 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 - * - * Programmer: Quincey Koziol - * Thursday, January 17, 2008 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1595,8 +1506,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 */ @@ -1616,19 +1528,17 @@ done: /*------------------------------------------------------------------------- * 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: Non-negative + * The read result is written into the BUF buffer + * which should be allocated by the caller. * - * Failure: Negative. The contents of BUF is undefined. - * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Failure: Negative + * The contents of BUF are undefined. * *------------------------------------------------------------------------- */ @@ -1641,23 +1551,25 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size 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) 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 result buffer") /* Get the DXPL plist object for DXPL ID */ if (NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - /* Do the real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD_read(file, dxpl, type, addr - file->base_addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") @@ -1669,17 +1581,12 @@ done: /*------------------------------------------------------------------------- * 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. + * 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 - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -1692,22 +1599,25 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz 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") /* Get the DXPL plist object for DXPL ID */ if (NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - /* The real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD_write(file, dxpl, type, addr - file->base_addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") @@ -1719,19 +1629,10 @@ 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 - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Purpose: Notify driver to flush all cached data. If the driver has no + * flush method then nothing happens. * - * Modifications: - * Quincey Koziol, May 20, 2002 - * Added 'closing' parameter + * Return: Non-negative on success/Negative on failureL * *------------------------------------------------------------------------- */ @@ -1743,9 +1644,12 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xiIu", 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 if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) @@ -1757,18 +1661,14 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5FDflush() */ /*------------------------------------------------------------------------- * Function: H5FD_flush * - * Purpose: Private version of H5FDflush() - * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDflush() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1779,8 +1679,11 @@ H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if (file->cls->flush && (file->cls->flush)(file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed") @@ -1791,13 +1694,9 @@ done: /*------------------------------------------------------------------------- * 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 - * - * Programmer: Quincey Koziol - * Thursday, January 31, 2008 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -1809,32 +1708,30 @@ 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 if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - /* Do the real work */ + /* Call private function */ if (H5FD_truncate(file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5FDtruncate() */ /*------------------------------------------------------------------------- * Function: H5FD_truncate * - * Purpose: Private version of H5FDtruncate() - * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDtruncate() * - * Programmer: Quincey Koziol - * Thursday, January 31, 2008 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1845,8 +1742,11 @@ H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if (file->cls->truncate && (file->cls->truncate)(file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver truncate request failed") @@ -1857,14 +1757,11 @@ done: /*------------------------------------------------------------------------- * 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 - * - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * March 27, 2002 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1873,6 +1770,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(filenum); @@ -1888,59 +1786,62 @@ 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 - * - * Modifications: + * Return: Non-negative on success/Negative on failure * *-------------------------------------------------------------------------- */ 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 (!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() */ /*-------------------------------------------------------------------------- * 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) + 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: @@ -1952,10 +1853,7 @@ done: * * Purpose: Set the base address for the file * - * Return: Non-negative if succeed; negative if fails. - * - * Programmer: Quincey Koziol - * Jan. 17, 2008 + * Return: SUCCEED (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1964,6 +1862,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)); @@ -1978,11 +1877,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) - * - * Programmer: Quincey Koziol - * Sept. 10, 2009 + * Return: Success: The absolute base address of the file + * (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1991,6 +1887,7 @@ H5FD_get_base_addr(const H5FD_t *file) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Return the file's base address */ @@ -2005,7 +1902,7 @@ H5FD_get_base_addr(const H5FD_t *file) * can't use the file to get the driver, the driver ID is passed * in as a parameter. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 0cec769..fad26ec 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -195,9 +195,6 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) haddr_t a_addr = 0; hbool_t create_new_node = TRUE; herr_t ret_value = SUCCEED; -#ifdef DER - hbool_t was_adjusted = FALSE; -#endif FUNC_ENTER_NOAPI_NOINIT @@ -205,34 +202,15 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) HDassert(file->dirty_list); HDassert(start <= end); -#ifdef DER - HDfprintf(stderr, "Add region: (%llu, %llu)\n", start, end); -#endif - /* Adjust the dirty region to the nearest block boundaries */ - if (start % file->bstore_page_size != 0) { + if (start % file->bstore_page_size != 0) start = (start / file->bstore_page_size) * file->bstore_page_size; -#ifdef DER - was_adjusted = TRUE; -#endif - } + if (end % file->bstore_page_size != (file->bstore_page_size - 1)) { end = (((end / file->bstore_page_size) + 1) * file->bstore_page_size) - 1; - if (end > file->eof) { -#ifdef DER - HDfprintf(stderr, "Adjusted to EOF\n"); -#endif + if (end > file->eof) end = file->eof - 1; - } -#ifdef DER - was_adjusted = TRUE; -#endif - } - -#ifdef DER - if (was_adjusted) - HDfprintf(stderr, "Adjusted region: (%llu, %llu)\n", start, end); -#endif + } /* end if */ /* Get the regions before and after the intended insertion point */ b_addr = start + 1; @@ -241,15 +219,13 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) a_item = (H5FD_core_region_t *)H5SL_less(file->dirty_list, &a_addr); /* Check to see if we need to extend the upper end of the NEW region */ - if (a_item) { + if (a_item) if (start < a_item->start && end < a_item->end) { - /* Extend the end of the NEW region to match the existing AFTER region */ end = a_item->end; - } - } + } /* end if */ /* Attempt to extend the PREV region */ - if (b_item) { + if (b_item) if (start <= b_item->end + 1) { /* Need to set this for the delete algorithm */ @@ -259,8 +235,7 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) * just update an existing one instead. */ create_new_node = FALSE; - } - } + } /* end if */ /* Remove any old nodes that are no longer needed */ while (a_item && a_item->start > start) { @@ -278,7 +253,7 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) /* Set up to check the next node */ if (less) a_item = less; - } + } /* end while */ /* Insert the new node */ if (create_new_node) { @@ -304,7 +279,7 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_add_dirty_region() */ +} /* end H5FD__core_add_dirty_region() */ /*------------------------------------------------------------------------- * Function: H5FD_core_destroy_dirty_list @@ -328,20 +303,13 @@ H5FD_core_destroy_dirty_list(H5FD_core_t *file) if (file->dirty_list) { H5FD_core_region_t *region = NULL; -#ifdef DER - { - size_t count = H5SL_count(file->dirty_list); - if (count != 0) - HDfprintf(stderr, "LIST NOT EMPTY AT DESTROY\n"); - } -#endif while (NULL != (region = (H5FD_core_region_t *)H5SL_remove_first(file->dirty_list))) region = H5FL_FREE(H5FD_core_region_t, region); if (H5SL_close(file->dirty_list) < 0) HGOTO_ERROR(H5E_SLIST, H5E_CLOSEERROR, FAIL, "can't close core vfd dirty list") file->dirty_list = NULL; - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -385,14 +353,8 @@ H5FD_core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) else bytes_in = (h5_posix_io_t)size; -#ifdef DER - HDfprintf(stderr, "\nNEW\n"); -#endif do { bytes_wrote = HDwrite(file->fd, ptr, bytes_in); -#ifdef DER - HDfprintf(stderr, "bytes wrote: %lu\n", bytes_wrote); -#endif } while (-1 == bytes_wrote && EINTR == errno); if (-1 == bytes_wrote) { /* error */ @@ -419,7 +381,6 @@ H5FD_core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_core_write_to_bstore() */ /*------------------------------------------------------------------------- @@ -427,8 +388,7 @@ done: * * Purpose: Initializes any interface-specific data or routines. * - * Return: Success: The driver ID for the core driver. - * Failure: Negative. + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -446,8 +406,8 @@ H5FD_core_init_interface(void) * Purpose: Initialize this driver by registering the driver with the * library. * - * Return: Success: The driver ID for the core driver. - * Failure: Negative. + * Return: Success: The driver ID for the core driver + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, July 29, 1999 @@ -457,9 +417,9 @@ H5FD_core_init_interface(void) hid_t H5FD_core_init(void) { - hid_t ret_value = H5FD_CORE_g; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if (H5I_VFL != H5I_get_type(H5FD_CORE_g)) H5FD_CORE_g = H5FD_register(&H5FD_core_g, sizeof(H5FD_class_t), FALSE); @@ -469,7 +429,7 @@ H5FD_core_init(void) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_core_init() */ /*--------------------------------------------------------------------------- * Function: H5FD_core_term @@ -529,7 +489,7 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_fapl_core() */ /*------------------------------------------------------------------------- * Function: H5Pget_fapl_core @@ -546,9 +506,9 @@ done: herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/) { - H5FD_core_fapl_t *fa; - H5P_genplist_t * plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t * plist; /* Property list pointer */ + const H5FD_core_fapl_t *fa; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, increment, backing_store); @@ -567,7 +527,7 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_stor done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_core() */ /*------------------------------------------------------------------------- * Function: H5FD_core_fapl_get @@ -575,7 +535,6 @@ done: * Purpose: Returns a copy of the file access properties. * * Return: Success: Ptr to new file access properties. - * * Failure: NULL * * Programmer: Robb Matzke @@ -588,7 +547,7 @@ H5FD_core_fapl_get(H5FD_t *_file) { H5FD_core_t * file = (H5FD_core_t *)_file; H5FD_core_fapl_t *fa; - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -613,7 +572,6 @@ done: * Return: Success: A pointer to a new file data structure. The * public fields will be initialized by the * caller, which is always H5FD_open(). - * * Failure: NULL * * Programmer: Robb Matzke @@ -624,17 +582,17 @@ done: static H5FD_t * H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - int o_flags; - H5FD_core_t * file = NULL; - H5FD_core_fapl_t *fa = NULL; - H5P_genplist_t * plist; /* Property list pointer */ + int o_flags; + H5FD_core_t * file = NULL; + const H5FD_core_fapl_t *fa = NULL; + H5P_genplist_t * plist; /* Property list pointer */ #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif h5_stat_t sb; int fd = -1; H5FD_file_image_info_t file_image_info; - H5FD_t * ret_value; + H5FD_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -844,9 +802,6 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (use_write_tracking) { if (NULL == (file->dirty_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, NULL, "can't create core vfd dirty region list"); -#ifdef DER - HDfprintf(stderr, "\n"); -#endif } /* end if */ } /* end if */ @@ -925,7 +880,6 @@ done: * address. * * Return: Success: A value like strcmp() - * * Failure: never fails (arguments were checked by the * caller). * @@ -1030,12 +984,12 @@ H5FD_core_query(const H5FD_t *_file, unsigned long *flags /* out */) /* Set the VFL feature flags that this driver supports */ if(flags) { *flags = 0; - *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ - *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ - *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ - *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */ - *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */ + *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */ + *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */ /* If the backing store is open, a POSIX file handle is available */ if(file && file->fd >= 0 && file->backing_store) @@ -1195,7 +1149,6 @@ done: * * Return: Success: SUCCEED. Result is stored in caller-supplied * buffer BUF. - * * Failure: FAIL, Contents of buffer BUF are undefined. * * Programmer: Robb Matzke @@ -1365,9 +1318,6 @@ H5FD_core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UN H5FD_core_region_t *item = NULL; size_t size; -#ifdef DER - HDfprintf(stderr, "FLUSHING. DIRTY LIST:\n"); -#endif while (NULL != (item = (H5FD_core_region_t *)H5SL_remove_first(file->dirty_list))) { /* The file may have been truncated, so check for that @@ -1376,10 +1326,8 @@ H5FD_core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UN if (item->start < file->eof) { if (item->end >= file->eof) item->end = file->eof - 1; + size = (size_t)((item->end - item->start) + 1); -#ifdef DER - HDfprintf(stderr, "(%llu, %llu : %lu)\n", item->start, item->end, size); -#endif if (H5FD_core_write_to_bstore(file, item->start, size) != SUCCEED) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") } /* end if */ @@ -1387,20 +1335,10 @@ H5FD_core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UN item = H5FL_FREE(H5FD_core_region_t, item); } /* end while */ -#ifdef DER - HDfprintf(stderr, "EOF: %llu\n", file->eof); - HDfprintf(stderr, "EOA: %llu\n", file->eoa); - if (file->eoa > file->eof) - HDfprintf(stderr, "*** EOA BADNESS ***\n"); - HDfprintf(stderr, "\n"); -#endif - } + } /* end if */ /* Otherwise, write the entire file out at once */ - else { - if (H5FD_core_write_to_bstore(file, (haddr_t)0, (size_t)file->eof) != SUCCEED) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") - - } /* end while */ + else if (H5FD_core_write_to_bstore(file, (haddr_t)0, (size_t)file->eof) != SUCCEED) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") file->dirty = FALSE; } @@ -1522,9 +1460,6 @@ H5FD_core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") #endif /* H5_HAVE_WIN32_API */ -#ifdef DER - HDfprintf(stderr, "OLD: Truncated to: %llu\n", file->eoa); -#endif } /* end if */ /* Update the eof value */ diff --git a/src/H5FDcore.h b/src/H5FDcore.h index a733dd5..7db7e9f 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the core driver. @@ -20,8 +20,6 @@ #ifndef H5FDcore_H #define H5FDcore_H -#include "H5Ipublic.h" - #define H5FD_CORE (H5FD_core_init()) #ifdef __cplusplus diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index cd3767b..e1831a6 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu <slu@hdfgroup.uiuc.edu> + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Purpose: The Direct I/O file driver forces the data to be written to @@ -27,15 +27,15 @@ * this file. */ /* #define _XOPEN_SOURCE 600 */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDdirect.h" /* Direct file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDdirect.h" /* Direct file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_DIRECT @@ -95,6 +95,7 @@ typedef struct H5FD_direct_t { DWORD fileindexlo; DWORD fileindexhi; #endif + } H5FD_direct_t; /* @@ -194,28 +195,25 @@ H5FD_direct_init_interface(void) } /* H5FD_direct_init_interface() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_init - * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Function: H5FD_direct_init * - * Return: Success: The driver ID for the direct driver. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Failure: Negative. + * Return: Success: The driver ID for the direct driver + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t H5FD_direct_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if (H5I_VFL != H5I_get_type(H5FD_DIRECT_g)) H5FD_DIRECT_g = H5FD_register(&H5FD_direct_g, sizeof(H5FD_class_t), FALSE); @@ -225,7 +223,7 @@ H5FD_direct_init(void) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_direct_init() */ /*--------------------------------------------------------------------------- * Function: H5FD_direct_term @@ -237,8 +235,6 @@ done: * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modification: - * *--------------------------------------------------------------------------- */ void @@ -264,8 +260,6 @@ H5FD_direct_term(void) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -281,6 +275,7 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HDmemset(&fa, 0, sizeof(H5FD_direct_fapl_t)); if (boundary != 0) fa.mboundary = boundary; else @@ -320,17 +315,15 @@ done: * Programmer: Raymond Lu * Wednesday, October 18, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size /*out*/, size_t *cbuf_size /*out*/) { - H5FD_direct_fapl_t *fa; - H5P_genplist_t * plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t * plist; /* Property list pointer */ + const H5FD_direct_fapl_t *fa; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "ixxx", fapl_id, boundary, block_size, cbuf_size); @@ -350,7 +343,7 @@ H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size / done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_direct() */ /*------------------------------------------------------------------------- * Function: H5FD_direct_fapl_get @@ -367,8 +360,6 @@ done: * Programmer: Raymond Lu * Wednesday, 18 October 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -398,8 +389,6 @@ done: * Programmer: Raymond Lu * Wednesday, 18 October 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -432,8 +421,6 @@ H5FD_direct_fapl_copy(const void *_old_fa) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -449,8 +436,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd #endif h5_stat_t sb; H5P_genplist_t *plist; /* Property list */ - int * buf1, *buf2; - H5FD_t * ret_value; + void * buf1, *buf2; + H5FD_t * ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -581,8 +568,6 @@ done: * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -616,8 +601,6 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -681,8 +664,6 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -716,11 +697,6 @@ H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED *_f, unsigned long *flags /* out * * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t @@ -747,11 +723,6 @@ H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static herr_t @@ -782,8 +753,6 @@ H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t @@ -806,8 +775,6 @@ H5FD_direct_get_eof(const H5FD_t *_file) * Programmer: Raymond Lu * 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -841,8 +808,6 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -985,6 +950,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); if (copy_buf) { + /* Free with HDfree since it came from posix_memalign */ HDfree(copy_buf); copy_buf = NULL; } /* end if */ @@ -996,6 +962,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN done: if (ret_value < 0) { + /* Free with HDfree since it came from posix_memalign */ if (copy_buf) HDfree(copy_buf); @@ -1021,8 +988,6 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1212,6 +1177,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U buf = (const char *)buf + size; if (copy_buf) { + /* Free with HDfree since it came from posix_memalign */ HDfree(copy_buf); copy_buf = NULL; } /* end if */ @@ -1225,6 +1191,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U done: if (ret_value < 0) { + /* Free with HDfree since it came from posix_memalign */ if (copy_buf) HDfree(copy_buf); diff --git a/src/H5FDdirect.h b/src/H5FDdirect.h index e0d5c30..4c35876 100644 --- a/src/H5FDdirect.h +++ b/src/H5FDdirect.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu <slu@hdfgroup.uiuc.edu> + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Purpose: The public header file for the direct driver. @@ -20,8 +20,6 @@ #ifndef H5FDdirect_H #define H5FDdirect_H -#include "H5Ipublic.h" - #ifdef H5_HAVE_DIRECT #define H5FD_DIRECT (H5FD_direct_init()) #else diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 4c85a5b..8f02269 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -160,26 +160,23 @@ H5FD_family_init_interface(void) /*------------------------------------------------------------------------- * Function: H5FD_family_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the family driver. + * Return: Success: The driver ID for the family driver + * Failure: H5I_INVALID_HID * - * Failure: Negative - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t H5FD_family_init(void) { - hid_t ret_value = H5FD_FAMILY_g; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if (H5I_VFL != H5I_get_type(H5FD_FAMILY_g)) H5FD_FAMILY_g = H5FD_register(&H5FD_family_g, sizeof(H5FD_class_t), FALSE); @@ -201,8 +198,6 @@ done: * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ void @@ -227,18 +222,11 @@ H5FD_family_term(void) * * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -278,30 +266,23 @@ done: * Function: H5Pget_fapl_family * * Purpose: Returns information about the family file access property - * list though the function arguments. + * list though the function arguments. * * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize /*out*/, hid_t *memb_fapl_id /*out*/) { - H5FD_family_fapl_t *fa; - H5P_genplist_t * plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t * plist; /* Property list pointer */ + const H5FD_family_fapl_t *fa; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, msize, memb_fapl_id); @@ -332,13 +313,11 @@ done: * * Return: Success: Ptr to new file access property list. * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Friday, August 13, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -346,8 +325,8 @@ H5FD_family_fapl_get(H5FD_t *_file) { H5FD_family_t * file = (H5FD_family_t *)_file; H5FD_family_fapl_t *fa = NULL; - H5P_genplist_t * plist; /* Property list pointer */ - void * ret_value; /* Return value */ + H5P_genplist_t * plist; /* Property list pointer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -363,10 +342,10 @@ H5FD_family_fapl_get(H5FD_t *_file) ret_value = fa; done: - if (ret_value == NULL) { + if (ret_value == NULL) if (fa != NULL) H5MM_xfree(fa); - } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } @@ -377,13 +356,11 @@ done: * * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -391,8 +368,8 @@ H5FD_family_fapl_copy(const void *_old_fa) { const H5FD_family_fapl_t *old_fa = (const H5FD_family_fapl_t *)_old_fa; H5FD_family_fapl_t * new_fa = NULL; - H5P_genplist_t * plist; /* Property list pointer */ - void * ret_value; /* Return value */ + H5P_genplist_t * plist; /* Property list pointer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -417,10 +394,10 @@ H5FD_family_fapl_copy(const void *_old_fa) ret_value = new_fa; done: - if (ret_value == NULL) { + if (ret_value == NULL) if (new_fa != NULL) H5MM_xfree(new_fa); - } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } @@ -431,13 +408,11 @@ done: * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -464,13 +439,11 @@ done: * * Return: Success: The super block driver data size. * - * Failure: never fails + * Failure: never fails * * Programmer: Raymond Lu * Tuesday, May 10, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t @@ -494,13 +467,11 @@ H5FD_family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Raymond Lu * Tuesday, May 10, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -530,7 +501,7 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*ou /*------------------------------------------------------------------------- * Function: H5FD_family_sb_decode * - * Purpose: This function has 2 separate purpose. One is to decodes the + * Purpose: This function has 2 separate purpose. One is to decodes the * superblock information for this driver. The NAME argument is * the eight-character (plus null termination) name stored in i * the file. The FILE argument is updated according to the @@ -538,7 +509,7 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*ou * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Raymond Lu * Tuesday, May 10, 2005 @@ -561,28 +532,23 @@ H5FD_family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsi * h5repart is being used to change member file size. h5repart will open * files for read and write. When the files are closed, metadata will be * flushed to the files and updated to this new size */ - if (file->mem_newsize) { + if (file->mem_newsize) file->memb_size = file->pmem_size = file->mem_newsize; - HGOTO_DONE(ret_value) - } /* end if */ - - /* Default - use the saved member size */ - if (file->pmem_size == H5F_FAMILY_DEFAULT) - file->pmem_size = msize; - - /* Check if member size from file access property is correct */ - if (msize != file->pmem_size) { - char err_msg[128]; - - HDsnprintf(err_msg, sizeof(err_msg), - "Family member size should be %lu. But the size from file access property is %lu", - (unsigned long)msize, (unsigned long)file->pmem_size); - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, err_msg) - } /* end if */ - - /* Update member file size to the size saved in the superblock. - * That's the size intended to be. */ - file->memb_size = msize; + else { + /* Default - use the saved member size */ + if (file->pmem_size == H5F_FAMILY_DEFAULT) + file->pmem_size = msize; + + /* Check if member size from file access property is correct */ + if (msize != file->pmem_size) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, + "Family member size should be %lu. But the size from file access property is %lu", + (unsigned long)msize, (unsigned long)file->pmem_size) + + /* Update member file size to the size saved in the superblock. + * That's the size intended to be. */ + file->memb_size = msize; + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -597,28 +563,11 @@ done: * public fields will be initialized by the * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * Thursday, November 18, 2004 - * When file is re-opened, member size passed in from access property - * is checked to see if it's reasonable. If there is only 1 member - * file, member size can't be smaller than current member size. - * If there are at least 2 member files, member size can only be equal - * the 1st member size. - * - * Raymond Lu - * Tuesday, May 24, 2005 - * The modification described above has been changed. The major checking - * is done in H5F_read_superblock. Member file size is saved in the - * superblock now. H5F_read_superblock() reads this saved size and compare - * to the size passed in from file access property. Wrong size will - * result in a failure. - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here -QAK */ @@ -657,8 +606,8 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd file->mem_newsize = 0; /*New member size used by h5repart only */ } /* end if */ else { - H5P_genplist_t * plist; /* Property list pointer */ - H5FD_family_fapl_t *fa; + H5P_genplist_t * plist; /* Property list pointer */ + const H5FD_family_fapl_t *fa; if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") @@ -736,7 +685,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd file->nmembs++; } - /* If the file is reopened and there's only one member file existing, this file maybe + /* If the file is reopened and there's only one member file existing, this file may be * smaller than the size specified through H5Pset_fapl_family(). Update the actual * member size. */ @@ -780,7 +729,7 @@ H5_GCC_DIAG_ON("format-nonliteral") * * Return: Success: Non-negative * - * Failure: Negative with as many members closed as + * Failure: Negative with as many members closed as * possible. The only subsequent operation * permitted on the file is a close operation. * @@ -832,14 +781,12 @@ H5FD_family_close(H5FD_t *_file) * * Return: Success: like strcmp() * - * Failure: never fails (arguments were checked by the + * Failure: never fails (arguments were checked by the * caller). * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -851,8 +798,8 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_NOAPI_NOINIT_NOERR - assert(f1->nmembs >= 1 && f1->memb[0]); - assert(f2->nmembs >= 1 && f2->memb[0]); + HDassert(f1->nmembs >= 1 && f1->memb[0]); + HDassert(f2->nmembs >= 1 && f2->memb[0]); ret_value = H5FDcmp(f1->memb[0], f2->memb[0]); @@ -867,14 +814,13 @@ done: * (listed in H5FDpublic.h) * * Return: Success: non-negative - * Failure: negative + * Failure: negative * * Programmer: Quincey Koziol * Friday, August 25, 2000 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_family_query(const H5FD_t *_file, unsigned long *flags /* out */) { @@ -908,16 +854,11 @@ H5FD_family_query(const H5FD_t *_file, unsigned long *flags /* out */) * * Return: Success: The end-of-address-marker * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t @@ -937,16 +878,11 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here -QAK */ @@ -1028,13 +964,11 @@ H5_GCC_DIAG_ON("format-nonliteral") * the end of the family of files or the current * EOA, whichever is larger. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t @@ -1042,8 +976,8 @@ H5FD_family_get_eof(const H5FD_t *_file) { const H5FD_family_t *file = (const H5FD_family_t *)_file; haddr_t eof = 0; - int i; /* Local index variable */ - haddr_t ret_value; /* Return value */ + int i; /* Local index variable */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1085,8 +1019,6 @@ H5FD_family_get_eof(const H5FD_t *_file) * Programmer: Raymond Lu * Sept. 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1096,7 +1028,7 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) H5P_genplist_t *plist; hsize_t offset; int memb; - herr_t ret_value; + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1126,13 +1058,11 @@ done: * Return: Success: Zero. Result is stored in caller-supplied * buffer BUF. * - * Failure: -1, contents of buffer BUF are undefined. + * Failure: -1, contents of buffer BUF are undefined. * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1193,13 +1123,11 @@ done: * * Return: Success: Zero * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1257,7 +1185,7 @@ done: * Purpose: Flushes all family members. * * Return: Success: 0 - * Failure: -1, as many files flushed as possible. + * Failure: -1, as many files flushed as possible. * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1291,7 +1219,7 @@ done: * * Return: Success: 0 * - * Failure: -1, as many files truncated as possible. + * Failure: -1, as many files truncated as possible. * * Programmer: Quincey Koziol * Saturday, February 23, 2008 diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index 6300767..55308cd 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, August 4, 1999 * * Purpose: The public header file for the family driver. @@ -20,8 +20,6 @@ #ifndef H5FDfamily_H #define H5FDfamily_H -#include "H5Ipublic.h" - #define H5FD_FAMILY (H5FD_family_init()) #ifdef __cplusplus diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 0f18318..14347f7 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -34,8 +34,20 @@ #include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_LIBHDFS -#include "hdfs.h" -#endif + +/* HDFS routines + * Have to turn off -Wstrict-prototypes as this header contains functions + * defined as foo() instead of foo(void), which triggers warnings that HDF5 + * then interprets as errors. + * -Wundef isn't interpreted as an error by HDF5, but the header does do + * some bad symbol interpretation that raises a warning that is out of our + * control. + */ +H5_GCC_DIAG_OFF("strict-prototypes") +H5_GCC_DIAG_OFF("undef") +#include <hdfs.h> +H5_GCC_DIAG_ON("strict-prototypes") +H5_GCC_DIAG_ON("undef") /* toggle function call prints: 1 turns on */ #define HDFS_DEBUG 0 @@ -117,8 +129,6 @@ static unsigned long long hdfs_stats_boundaries[HDFS_STATS_BIN_COUNT]; * * Programmer: Jacob Smith * - * Changes: None - * ***************************************************************************/ typedef struct { unsigned long long count; @@ -129,8 +139,6 @@ typedef struct { #endif /* HDFS_STATS */ -#ifdef H5_HAVE_LIBHDFS - /* "unique" identifier for `hdfs_t` structures. * Randomly generated by unweighted dice rolls. */ @@ -144,9 +152,7 @@ typedef struct { * * Contain/retain information associated with a file hosted on Hadoop * Distributed File System (HDFS). Instantiated and populated via - * `H5FD_hdfs_handle_open()` and cleaned up via `H5FD_hdfs_handle_close()`. - * - * + * `H5FD__hdfs_handle_open()` and cleaned up via `H5FD_hdfs_handle_close()`. * * `magic` (unisgned long) * @@ -173,8 +179,6 @@ typedef struct { * Programmer: Jacob Smith * May 2018 * - * Changes: None - * *************************************************************************** */ typedef struct { @@ -184,168 +188,6 @@ typedef struct { hdfsFile file; } hdfs_t; -/*-------------------------------------------------------------------------- - * Function: H5FD_hdfs_handle_open - * - * Purpose: Create a HDFS file handle, 'opening' the target file. - * - * Return: Success: Pointer to HDFS container/handle of opened file. - * Failure: NULL - * - * Programmer: Gerd Herber - * May 2018 - * - * Changes: None. - *-------------------------------------------------------------------------- - */ -static hdfs_t * -H5FD_hdfs_handle_open(const char *path, const char *namenode_name, const int32_t namenode_port, - const char *user_name, const char *kerberos_ticket_cache, - const int32_t stream_buffer_size) -{ - struct hdfsBuilder *builder = NULL; - hdfs_t * handle = NULL; - hdfs_t * ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "called H5FD_hdfs_handle_open.\n"); -#endif - - if (path == NULL || path[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "path cannot be null.\n") - } - if (namenode_name == NULL /* || namenode_name[0] == '\0' */) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode name cannot be null.\n") - } - if (namenode_port < 0 || namenode_port > 65535) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode port must be non-negative and <= 65535.\n") - } - if (stream_buffer_size < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "buffer size must non-negative.\n") - } - - handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle.\n") - } - - handle->magic = (unsigned long)HDFS_HDFST_MAGIC; - handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ - handle->fileinfo = NULL; - handle->file = NULL; /* TODO: not a pointer; NULL may cause bug */ - - builder = hdfsNewBuilder(); - if (!builder) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) failed to create builder") - } - hdfsBuilderSetNameNode(builder, namenode_name); - hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); - if (user_name != NULL && user_name[0] != '\0') { - hdfsBuilderSetUserName(builder, user_name); - } - if (kerberos_ticket_cache != NULL && kerberos_ticket_cache[0] != '\0') { - hdfsBuilderSetKerbTicketCachePath(builder, kerberos_ticket_cache); - } - /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ - handle->filesystem = hdfsBuilderConnect(builder); - if (!handle->filesystem) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) could not connect to default namenode") - } - handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); - if (!handle->fileinfo) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "hdfsGetPathInfo failed") - } - handle->file = hdfsOpenFile(handle->filesystem, path, O_RDONLY, stream_buffer_size, 0, 0); - if (!handle->file) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "(hdfs) could not open") - } - - ret_value = handle; - -done: - if (ret_value == NULL && handle != NULL) { - /* error; clean up */ - HDassert(handle->magic == HDFS_HDFST_MAGIC); - handle->magic++; - if (handle->file != NULL) { - if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close hdfs file handle") - } - } - if (handle->fileinfo != NULL) { - hdfsFreeFileInfo(handle->fileinfo, 1); - } - if (handle->filesystem != NULL) { - if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to disconnect from hdfs") - } - } - H5MM_xfree(handle); - } - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_handle_open() */ - -/*-------------------------------------------------------------------------- - * Function: H5FD_hdfs_handle_close - * - * Purpose: 'Close' an HDFS file container/handle, releasing underlying - * resources. - * - * Return: Success: `SUCCEED` (0) - * Failure: `FAIL` (-1) - * - * Programmer: Gerd Herber - * May 2018 - * - * Changes: None. - *-------------------------------------------------------------------------- - */ -static herr_t -H5FD_hdfs_handle_close(hdfs_t *handle) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "called H5FD_hdfs_close.\n"); -#endif - - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.\n") - } - if (handle->magic != HDFS_HDFST_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic.\n") - } - - handle->magic++; - if (handle->file != NULL) { - if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close hdfs file handle") - } - } - if (handle->fileinfo != NULL) { - hdfsFreeFileInfo(handle->fileinfo, 1); - } - if (handle->filesystem != NULL) { - if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to disconnect hdfs file system") - } - } - - H5MM_xfree(handle); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_close() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*************************************************************************** * * Structure: H5FD_hdfs_t @@ -402,17 +244,12 @@ done: * * Programmer: Jacob Smith * - * Changes: None. - * - *************************************************************************** - */ + ***************************************************************************/ typedef struct H5FD_hdfs_t { H5FD_t pub; H5FD_hdfs_fapl_t fa; haddr_t eoa; -#ifdef H5_HAVE_LIBHDFS - hdfs_t *hdfs_handle; -#endif + hdfs_t * hdfs_handle; #if HDFS_STATS hdfs_statsbin meta[HDFS_STATS_BIN_COUNT + 1]; hdfs_statsbin raw[HDFS_STATS_BIN_COUNT + 1]; @@ -429,10 +266,8 @@ typedef struct H5FD_hdfs_t { * Only included if HDFS code should compile. * */ -#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) -#ifdef H5_HAVE_LIBHDFS +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) -#endif /* H5_HAVE_LIBHDFS */ /* Prototypes */ static void * H5FD_hdfs_fapl_get(H5FD_t *_file); @@ -453,7 +288,8 @@ static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_hdfs_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_hdfs_unlock(H5FD_t *_file); -static herr_t H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t *fa); + +static herr_t H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t *fa); static const H5FD_class_t H5FD_hdfs_g = { "hdfs", /* name */ @@ -489,18 +325,15 @@ static const H5FD_class_t H5FD_hdfs_g = { H5FD_FLMAP_DICHOTOMY /* fl_map */ }; -#ifdef H5_HAVE_LIBHDFS /* Declare a free list to manage the H5FD_hdfs_t struct */ H5FL_DEFINE_STATIC(H5FD_hdfs_t); -#endif /* H5_HAVE_LIBHDFS */ /*------------------------------------------------------------------------- * Function: H5FD_hdfs_init_interface * * Purpose: Initializes any interface-specific data or routines. * - * Return: Success: The driver ID for the hdfs driver. - * Failure: Negative + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -521,21 +354,22 @@ H5FD_hdfs_init_interface(void) * Return: Success: The driver ID for the hdfs driver. * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Programmer: Jacob Smith, 2018 * *------------------------------------------------------------------------- */ hid_t H5FD_hdfs_init(void) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ +#if HDFS_STATS unsigned int bin_i; +#endif - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_init() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) @@ -546,6 +380,7 @@ H5FD_hdfs_init(void) */ for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { unsigned long long value = 0; + HDFS_STATS_POW(bin_i, &value) hdfs_stats_boundaries[bin_i] = value; } @@ -558,7 +393,7 @@ done: } /* end H5FD_hdfs_init() */ /*--------------------------------------------------------------------------- - * Function: H5FD_log_term + * Function: H5FD_hdfs_term * * Purpose: Shut down the VFD * @@ -574,7 +409,7 @@ H5FD_hdfs_term(void) FUNC_ENTER_NOAPI_NOINIT_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_term() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* Reset VFL ID */ @@ -583,11 +418,185 @@ H5FD_hdfs_term(void) FUNC_LEAVE_NOAPI_VOID } /* end H5FD_hdfs_term() */ +/*-------------------------------------------------------------------------- + * Function: H5FD_hdfs_handle_open + * + * Purpose: Create a HDFS file handle, 'opening' the target file. + * + * Return: Success: Pointer to HDFS container/handle of opened file. + * Failure: NULL + * + * Programmer: Gerd Herber + * May 2018 + * + *-------------------------------------------------------------------------- + */ +static hdfs_t * +H5FD_hdfs_handle_open(const char *path, const char *namenode_name, const int32_t namenode_port, + const char *user_name, const char *kerberos_ticket_cache, + const int32_t stream_buffer_size) +{ + struct hdfsBuilder *builder = NULL; + hdfs_t * handle = NULL; + hdfs_t * ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if (path == NULL || path[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "path cannot be null") + if (namenode_name == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode name cannot be null") + if (namenode_port < 0 || namenode_port > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode port must be non-negative and <= 65535") + if (stream_buffer_size < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "buffer size must non-negative") + + handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); + if (handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle") + + handle->magic = (unsigned long)HDFS_HDFST_MAGIC; + handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ + handle->fileinfo = NULL; + handle->file = NULL; /* TODO: not a pointer; NULL may cause bug */ + + builder = hdfsNewBuilder(); + if (!builder) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) failed to create builder") + hdfsBuilderSetNameNode(builder, namenode_name); + hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); + if (user_name != NULL && user_name[0] != '\0') + hdfsBuilderSetUserName(builder, user_name); + if (kerberos_ticket_cache != NULL && kerberos_ticket_cache[0] != '\0') + hdfsBuilderSetKerbTicketCachePath(builder, kerberos_ticket_cache); + + /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ + handle->filesystem = hdfsBuilderConnect(builder); + if (!handle->filesystem) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) could not connect to default namenode") + handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); + if (!handle->fileinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "hdfsGetPathInfo failed") + handle->file = hdfsOpenFile(handle->filesystem, path, O_RDONLY, stream_buffer_size, 0, 0); + if (!handle->file) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "(hdfs) could not open") + + ret_value = handle; + +done: + if (ret_value == NULL && handle != NULL) { + /* error; clean up */ + HDassert(handle->magic == HDFS_HDFST_MAGIC); + handle->magic++; + if (handle->file != NULL) + if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close hdfs file handle") + if (handle->fileinfo != NULL) + hdfsFreeFileInfo(handle->fileinfo, 1); + if (handle->filesystem != NULL) + if (FAIL == (hdfsDisconnect(handle->filesystem))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to disconnect from hdfs") + H5MM_xfree(handle); + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_handle_open() */ + +/*-------------------------------------------------------------------------- + * Function: H5FD_hdfs_handle_close + * + * Purpose: 'Close' an HDFS file container/handle, releasing underlying + * resources. + * + * Return: Success: `SUCCEED` (0) + * Failure: `FAIL` (-1) + * + * Programmer: Gerd Herber + * May 2018 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_handle_close(hdfs_t *handle) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if (handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null") + if (handle->magic != HDFS_HDFST_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic") + + handle->magic++; + if (handle->file != NULL) + if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close hdfs file handle") + if (handle->fileinfo != NULL) + hdfsFreeFileInfo(handle->fileinfo, 1); + if (handle->filesystem != NULL) + if (FAIL == (hdfsDisconnect(handle->filesystem))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to disconnect hdfs file system") + + H5MM_xfree(handle); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_handle_close() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_validate_config() + * + * Purpose: Test to see if the supplied instance of H5FD_hdfs_fapl_t + * contains internally consistant data. Return SUCCEED if so, + * and FAIL otherwise. + * + * Note the difference between internally consistant and + * correct. As we will have to try to access the target + * object to determine whether the supplied data is correct, + * we will settle for internal consistancy at this point + * + * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally + * consistant data, FAIL otherwise. + * + * Programmer: Jacob Smith + * 9/10/17 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t *fa) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(fa != NULL); + + if (fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_hdfs_fapl_t version"); + if (fa->namenode_port > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); + if (fa->namenode_port < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD_hdfs_validate_config() */ + /*------------------------------------------------------------------------- * Function: H5Pset_fapl_hdfs * * Purpose: Modify the file access property list to use the H5FD_HDFS - * driver defined in this source file. All driver specfic + * driver defined in this source file. All driver specific * properties are passed in as a pointer to a suitably * initialized instance of H5FD_hdfs_fapl_t * @@ -609,12 +618,12 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) HDassert(fa != NULL); #if HDFS_DEBUG - HDfprintf(stdout, "H5Pset_fapl_hdfs() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (FAIL == H5FD_hdfs_validate_config(fa)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hdfs config") @@ -625,35 +634,247 @@ done: } /* H5Pset_fapl_hdfs() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_open() + * Function: H5Pget_fapl_hdfs + * + * Purpose: Returns information about the hdfs file access property + * list though the function arguments. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: John Mainzer + * 9/10/17 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) +{ + const H5FD_hdfs_fapl_t *fa = NULL; + H5P_genplist_t * plist = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa_out); + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if (fa_out == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") + + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + + if (H5FD_HDFS != H5P_get_driver(plist)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + + fa = (const H5FD_hdfs_fapl_t *)H5P_get_driver_info(plist); + if (fa == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + + /* Copy the hdfs fapl data out */ + HDmemcpy(fa_out, fa, sizeof(H5FD_hdfs_fapl_t)); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pget_fapl_hdfs() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_fapl_get + * + * Purpose: Gets a file access property list which could be used to + * create an identical file. + * + * Return: Success: Ptr to new file access property list value. + * + * Failure: NULL * - * Purpose: Create and/or opens a file as an HDF5 file. + * Programmer: John Mainzer + * 9/8/17 * - * Any flag except H5F_ACC_RDONLY will cause an error. + *------------------------------------------------------------------------- + */ +static void * +H5FD_hdfs_fapl_get(H5FD_t *_file) +{ + H5FD_hdfs_t * file = (H5FD_hdfs_t *)_file; + H5FD_hdfs_fapl_t *fa = NULL; + void * ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t)); + if (fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") + + /* Copy the fields of the structure */ + HDmemcpy(fa, &(file->fa), sizeof(H5FD_hdfs_fapl_t)); + + ret_value = fa; + +done: + if (ret_value == NULL && fa != NULL) + H5MM_xfree(fa); /* clean up on error */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD_hdfs_fapl_get() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_fapl_copy * - * Return: Success: A pointer to a new file data structure. - * The public fields will be initialized by the caller, which is - * always H5FD_open(). - * Failure: NULL + * Purpose: Copies the hdfs-specific file access properties. + * + * Return: Success: Ptr to a new property list + * + * Failure: NULL + * + * Programmer: John Mainzer + * 9/8/17 + * + *------------------------------------------------------------------------- + */ +static void * +H5FD_hdfs_fapl_copy(const void *_old_fa) +{ + const H5FD_hdfs_fapl_t *old_fa = (const H5FD_hdfs_fapl_t *)_old_fa; + H5FD_hdfs_fapl_t * new_fa = NULL; + void * ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t)); + if (new_fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") + + HDmemcpy(new_fa, old_fa, sizeof(H5FD_hdfs_fapl_t)); + ret_value = new_fa; + +done: + if (ret_value == NULL && new_fa != NULL) + H5MM_xfree(new_fa); /* clean up on error */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD_hdfs_fapl_copy() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_fapl_free + * + * Purpose: Frees the hdfs-specific file access properties. + * + * Return: SUCCEED (cannot fail) + * + * Programmer: John Mainzer + * 9/8/17 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_fapl_free(void *_fa) +{ + H5FD_hdfs_fapl_t *fa = (H5FD_hdfs_fapl_t *)_fa; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(fa != NULL); /* sanity check */ + + H5MM_xfree(fa); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5FD_hdfs_fapl_free() */ + +#if HDFS_STATS +/*---------------------------------------------------------------------------- + * + * Function: hdfs_reset_stats() + * + * Purpose: + * + * Reset the stats collection elements in this virtual file structure. + * + * Clears any set data in stats bins; initializes/zeroes values. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - Occurs if the file is invalid somehow + * + * Programmer: Jacob Smith + * 2017-12-08 + * + *---------------------------------------------------------------------------- + */ +static herr_t +hdfs_reset_stats(H5FD_hdfs_t *file) +{ + unsigned i = 0; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if (file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null") + + for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + file->raw[i].bytes = 0; + file->raw[i].count = 0; + file->raw[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; + file->raw[i].max = 0; + + file->meta[i].bytes = 0; + file->meta[i].count = 0; + file->meta[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; + file->meta[i].max = 0; + } + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* hdfs_reset_stats */ +#endif /* HDFS_STATS */ + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_open() + * + * Purpose: + * + * Create and/or opens a file as an HDF5 file. + * + * Any flag except H5F_ACC_RDONLY will cause an error. + * + * Return: + * + * Success: A pointer to a new file data structure. + * The public fields will be initialized by the caller, which is + * always H5FD_open(). + * + * Failure: NULL * * Programmer: Jacob Smith * 2017-11-02 * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS static H5FD_t * H5FD_hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_hdfs_t * file = NULL; - hdfs_t * handle = NULL; - H5FD_hdfs_fapl_t fa; H5FD_t * ret_value = NULL; + H5FD_hdfs_t * file = NULL; + hdfs_t * handle = NULL; + H5FD_hdfs_fapl_t fa; FUNC_ENTER_NOAPI_NOINIT #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_open() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ /* Sanity check on file offsets */ @@ -666,7 +887,6 @@ H5FD_hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") if (ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") - if (flags != H5F_ACC_RDONLY) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed") if (fapl_id == H5P_DEFAULT || fapl_id == H5P_FILE_ACCESS_DEFAULT) @@ -676,16 +896,15 @@ H5FD_hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr) handle = H5FD_hdfs_handle_open(path, fa.namenode_name, fa.namenode_port, fa.user_name, fa.kerberos_ticket_cache, fa.stream_buffer_size); - if (handle == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open") HDassert(handle->magic == HDFS_HDFST_MAGIC); - /* Create the new file struct */ - if (NULL == (file = H5FL_CALLOC(H5FD_hdfs_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") - + /* Create new file struct */ + file = H5FL_CALLOC(H5FD_hdfs_t); + if (file == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") file->hdfs_handle = handle; HDmemcpy(&(file->fa), &fa, sizeof(H5FD_hdfs_fapl_t)); @@ -697,52 +916,293 @@ H5FD_hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr) ret_value = (H5FD_t *)file; done: - if (NULL == ret_value) { - if (handle != NULL) { + if (ret_value == NULL) { + if (handle != NULL) if (FAIL == H5FD_hdfs_handle_close(handle)) HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close HDFS file handle") - } - if (file != NULL) { + if (file != NULL) file = H5FL_FREE(H5FD_hdfs_t, file); - } } /* end if null return value (error) */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_hdfs_open() */ -#else /* H5_HAVE_LIBHDFS not defined */ +#if HDFS_STATS -static H5FD_t * -H5FD_hdfs_open(const char H5_ATTR_UNUSED *path, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, - haddr_t H5_ATTR_UNUSED maxaddr) +/*---------------------------------------------------------------------------- + * + * Function: hdfs_fprint_stats() + * + * Purpose: + * + * Tabulate and pretty-print statistics for this virtual file. + * + * Should be called upon file close. + * + * Shows number of reads and bytes read, broken down by + * "raw" (H5FD_MEM_DRAW) + * or "meta" (any other flag) + * + * Prints filename and listing of total number of reads and bytes read, + * both as a grand total and separate meta- and rawdata reads. + * + * If any reads were done, prints out two tables: + * + * 1. overview of raw- and metadata reads + * - min (smallest size read) + * - average of size read + * - k,M,G suffixes by powers of 1024 (2^10) + * - max (largest size read) + * 2. tabulation of "bins", sepraring reads into exponentially-larger + * ranges of size. + * - columns for number of reads, total bytes, and average size, with + * separate sub-colums for raw- and metadata reads. + * - each row represents one bin, identified by the top of its range + * + * Bin ranges can be modified with pound-defines at the top of this file. + * + * Bins without any reads in their bounds are not printed. + * + * An "overflow" bin is also present, to catch "big" reads. + * + * Output for all bins (and range ceiling and average size report) + * is divied by powers of 1024. By corollary, four digits before the decimal + * is valid. + * + * - 41080 bytes is represented by 40.177k, not 41.080k + * - 1004.831M represents approx. 1052642000 bytes + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - occurs if the file passed in is invalid + * - TODO: if stream is invalid? how can we check this? + * + * Programmer: Jacob Smith + * + *---------------------------------------------------------------------------- + */ +static herr_t +hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file) { - H5FD_t *ret_value = NULL; + herr_t ret_value = SUCCEED; + parsed_url_t * purl = NULL; + unsigned i = 0; + unsigned long count_meta = 0; + unsigned long count_raw = 0; + double average_meta = 0.0; + double average_raw = 0.0; + unsigned long long min_meta = (unsigned long long)HDFS_STATS_STARTING_MIN; + unsigned long long min_raw = (unsigned long long)HDFS_STATS_STARTING_MIN; + unsigned long long max_meta = 0; + unsigned long long max_raw = 0; + unsigned long long bytes_raw = 0; + unsigned long long bytes_meta = 0; + double re_dub = 0.0; /* re-usable double variable */ + unsigned suffix_i = 0; + const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'}; FUNC_ENTER_NOAPI_NOINIT - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "Illegal open of unsupported virtual file (hdfs)"); + if (stream == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null") + if (file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null") + if (file->hdfs_handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle cannot be null") + if (file->hdfs_handle->magic != HDFS_HDFST_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle has invalid magic") + + /******************* + * AGGREGATE STATS * + *******************/ + + for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + const hdfs_statsbin *r = &file->raw[i]; + const hdfs_statsbin *m = &file->meta[i]; + + if (m->min < min_meta) + min_meta = m->min; + if (r->min < min_raw) + min_raw = r->min; + if (m->max > max_meta) + max_meta = m->max; + if (r->max > max_raw) + max_raw = r->max; + + count_raw += r->count; + count_meta += m->count; + bytes_raw += r->bytes; + bytes_meta += m->bytes; + } + if (count_raw > 0) + average_raw = (double)bytes_raw / (double)count_raw; + if (count_meta > 0) + average_meta = (double)bytes_meta / (double)count_meta; + + /****************** + * PRINT OVERVIEW * + ******************/ + + HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, + count_raw); + HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, + bytes_raw); + + if (count_raw + count_meta == 0) + goto done; + + /************************* + * PRINT AGGREGATE STATS * + *************************/ + + HDfprintf(stream, "SIZES meta raw\n"); + HDfprintf(stream, " min "); + if (count_meta == 0) + HDfprintf(stream, " 0.000 "); + else { + re_dub = (double)min_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + } + + if (count_raw == 0) + HDfprintf(stream, " 0.000 \n"); + else { + re_dub = (double)min_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + } + + HDfprintf(stream, " avg "); + re_dub = (double)average_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)average_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + HDfprintf(stream, " max "); + re_dub = (double)max_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)max_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + /****************************** + * PRINT INDIVIDUAL BIN STATS * + ******************************/ + + HDfprintf(stream, "BINS # of reads total bytes average size\n"); + HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); + + for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + const hdfs_statsbin *m; + const hdfs_statsbin *r; + unsigned long long range_end = 0; + char bm_suffix = ' '; /* bytes-meta */ + double bm_val = 0.0; + char br_suffix = ' '; /* bytes-raw */ + double br_val = 0.0; + char am_suffix = ' '; /* average-meta */ + double am_val = 0.0; + char ar_suffix = ' '; /* average-raw */ + double ar_val = 0.0; + + m = &file->meta[i]; + r = &file->raw[i]; + if (r->count == 0 && m->count == 0) + continue; + + range_end = hdfs_stats_boundaries[i]; + + if (i == HDFS_STATS_BIN_COUNT) { + range_end = hdfs_stats_boundaries[i - 1]; + HDfprintf(stream, ">"); + } + else + HDfprintf(stream, " "); + + bm_val = (double)m->bytes; + for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) + bm_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + bm_suffix = suffixes[suffix_i]; + + br_val = (double)r->bytes; + for (suffix_i = 0; br_val >= 1024.0; suffix_i++) + br_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + br_suffix = suffixes[suffix_i]; + + if (m->count > 0) + am_val = (double)(m->bytes) / (double)(m->count); + for (suffix_i = 0; am_val >= 1024.0; suffix_i++) + am_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + am_suffix = suffixes[suffix_i]; + + if (r->count > 0) + ar_val = (double)(r->bytes) / (double)(r->count); + for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) + ar_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + ar_suffix = suffixes[suffix_i]; + + re_dub = (double)range_end; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + + HDfprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, + suffixes[suffix_i], /* bin ceiling */ + m->count, /* metadata reads */ + r->count, /* rawdata reads */ + bm_val, bm_suffix, /* metadata bytes */ + br_val, br_suffix, /* rawdata bytes */ + am_val, am_suffix, /* metadata average */ + ar_val, ar_suffix); /* rawdata average */ + HDfflush(stream); + } done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_open() */ -#endif /* H5_HAVE_LIBHDFS */ + FUNC_LEAVE_NOAPI(ret_value); +} /* hdfs_fprint_stats */ +#endif /* HDFS_STATS */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_close * - * Purpose: Closes an HDF5 file. + * Function: H5FD_hdfs_close + * + * Purpose: * - * Return: Success: SUCCEED - * Failure: FAIL, file not closed. + * Close an HDF5 file. + * + * Return: + * + * SUCCEED/FAIL * * Programmer: Jacob Smith * 2017-11-02 * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t H5FD_hdfs_close(H5FD_t *_file) { @@ -752,7 +1212,7 @@ H5FD_hdfs_close(H5FD_t *_file) FUNC_ENTER_NOAPI_NOINIT #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_close() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* Sanity checks */ @@ -762,9 +1222,8 @@ H5FD_hdfs_close(H5FD_t *_file) /* Close the underlying request handle */ if (file->hdfs_handle != NULL) - if (FAIL == H5FD_hdfs_handle_close(file->hdfs_handle)) { + if (FAIL == H5FD_hdfs_handle_close(file->hdfs_handle)) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close HDFS file handle") - } #if HDFS_STATS /* TODO: mechanism to re-target stats printout */ @@ -779,52 +1238,37 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_hdfs_close() */ -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_close(H5FD_t H5_ATTR_UNUSED *_file) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "Illegal close of unsupported Virtual File (hdfs)") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_close() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_cmp() * - * Purpose: Compares two files using this driver by their HDFS-provided file info, - * field-by-field. + * Function: H5FD_hdfs_cmp() + * + * Purpose: * - * Return: Equivalent: 0 - * Not Equivalent: -1 + * Compares two files using this driver by their HDFS-provided file info, + * field-by-field. + * + * Return: + * Equivalent: 0 + * Not Equivalent: -1 * * Programmer: Gerd Herber * May 2018 * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static int H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { + int ret_value = 0; const H5FD_hdfs_t *f1 = (const H5FD_hdfs_t *)_f1; const H5FD_hdfs_t *f2 = (const H5FD_hdfs_t *)_f2; hdfsFileInfo * finfo1 = NULL; hdfsFileInfo * finfo2 = NULL; - int ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_cmp() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ HDassert(f1->hdfs_handle != NULL); @@ -855,10 +1299,10 @@ H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) if (finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); } - if (strcmp(finfo1->mOwner, finfo2->mOwner)) { + if (HDstrcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); } - if (strcmp(finfo1->mGroup, finfo2->mGroup)) { + if (HDstrcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); } if (finfo1->mPermissions != finfo2->mPermissions) { @@ -872,20 +1316,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_hdfs_cmp() */ -#else /* H5_HAVE_LIBHDFS not defined */ - -static int -H5FD_hdfs_cmp(const H5FD_t H5_ATTR_UNUSED *_f1, const H5FD_t H5_ATTR_UNUSED *_f2) -{ - int ret_value = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_cmp() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*------------------------------------------------------------------------- * Function: H5FD_hdfs_query * @@ -911,7 +1341,7 @@ H5FD_hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) /* out FUNC_ENTER_NOAPI_NOINIT_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_query() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif if (flags) { @@ -923,21 +1353,24 @@ H5FD_hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) /* out } /* H5FD_hdfs_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_get_eoa() * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Function: H5FD_hdfs_get_eoa() + * + * Purpose: + * + * Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. + * + * Return: * - * Return: The end-of-address marker. + * The end-of-address marker. * * Programmer: Jacob Smith * 2017-11-02 * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static haddr_t H5FD_hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { @@ -946,42 +1379,29 @@ H5FD_hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_NOAPI_NOINIT_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif FUNC_LEAVE_NOAPI(file->eoa) } /* end H5FD_hdfs_get_eoa() */ -#else /* H5_HAVE_LIBHDFS not defined */ - -static haddr_t -H5FD_hdfs_get_eoa(const H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); -#endif - - FUNC_LEAVE_NOAPI(0) -} /* end H5FD_hdfs_get_eoa() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_set_eoa() * - * Purpose: Set the end-of-address marker for the file. + * Function: H5FD_hdfs_set_eoa() * - * Return: SUCCEED (Can't fail) + * Purpose: + * + * Set the end-of-address marker for the file. + * + * Return: + * + * SUCCEED (can't fail) * * Programmer: Jacob Smith * 2017-11-03 * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { @@ -990,7 +1410,7 @@ H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_NOAPI_NOINIT_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif file->eoa = addr; @@ -998,37 +1418,24 @@ H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FD_hdfs_set_eoa() */ -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); -#endif - - FUNC_LEAVE_NOAPI(FAIL) -} /* H5FD_hdfs_set_eoa() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_get_eof() * - * Purpose: Returns the end-of-file marker. + * Function: H5FD_hdfs_get_eof() + * + * Purpose: + * + * Returns the end-of-file marker. + * + * Return: * - * Return: EOF: the first address past the end of the "file", either the - * filesystem file or the HDF5 file. + * EOF: the first address past the end of the "file", either the + * filesystem file or the HDF5 file. * * Programmer: Jacob Smith * 2017-11-02 * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static haddr_t H5FD_hdfs_get_eof(const H5FD_t *_file) { @@ -1037,7 +1444,7 @@ H5FD_hdfs_get_eof(const H5FD_t *_file) FUNC_ENTER_NOAPI_NOINIT_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif HDassert(file->hdfs_handle != NULL); @@ -1046,36 +1453,23 @@ H5FD_hdfs_get_eof(const H5FD_t *_file) FUNC_LEAVE_NOAPI((size_t)file->hdfs_handle->fileinfo->mSize) } /* end H5FD_hdfs_get_eof() */ -#else /* H5_HAVE_LIBHDFS not defined */ - -static haddr_t -H5FD_hdfs_get_eof(const H5FD_t H5_ATTR_UNUSED *_file) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); -#endif - - FUNC_LEAVE_NOAPI((size_t)0) -} /* end H5FD_hdfs_get_eof() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_get_handle * - * Purpose: Returns the HDFS handle (hdfs_t) of hdfs file driver. + * Function: H5FD_hdfs_get_handle() + * + * Purpose: + * + * Returns the HDFS handle (hdfs_t) of hdfs file driver. + * + * Returns: * - * Returns: SUCCEED/FAIL + * SUCCEED/FAIL * * Programmer: Jacob Smith * 2017-11-02 * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { @@ -1085,7 +1479,7 @@ H5FD_hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handl FUNC_ENTER_NOAPI_NOINIT #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ if (!file_handle) @@ -1097,54 +1491,35 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_hdfs_get_handle() */ -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_get_handle(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED fapl, - void H5_ATTR_UNUSED **file_handle) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); -#endif /* HDFS_DEBUG */ - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "Illegal get-handle of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_get_handle() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in DXPL_ID. + * Function: H5FD_hdfs_read() * - * Return: Success: SUCCEED - * - Result is stored in caller-supplied buffer BUF. - * Failure: FAIL - * - Unable to complete read. - * - Contents of buffer `buf` are undefined. + * Purpose: + * + * Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in DXPL_ID. + * + * Return: + * + * Success: `SUCCEED` + * - Result is stored in caller-supplied buffer BUF. + * Failure: `FAIL` + * - Unable to complete read. + * - Contents of buffer `buf` are undefined. * * Programmer: Jacob Smith * 2017-11-?? * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, - size_t size, void *buf /*out*/) + size_t size, void *buf) { H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; - herr_t ret_value = SUCCEED; size_t filesize = 0; + herr_t ret_value = SUCCEED; #if HDFS_STATS /* working variables for storing stats */ hdfs_statsbin *bin = NULL; @@ -1154,7 +1529,7 @@ H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS FUNC_ENTER_NOAPI_NOINIT #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ HDassert(file != NULL); @@ -1173,13 +1548,10 @@ H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS #if HDFS_STATS - /* Find which "bin" this read fits in. Can be "overflow" bin. - */ - for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { - if ((unsigned long long)size < hdfs_stats_boundaries[bin_i]) { + /* Find which "bin" this read fits in. Can be "overflow" bin. */ + for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) + if ((unsigned long long)size < hdfs_stats_boundaries[bin_i]) break; - } - } bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i]; /* Store collected stats in appropriate bin */ @@ -1188,12 +1560,10 @@ H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS bin->max = size; } else { - if (size < bin->min) { + if (size < bin->min) bin->min = size; - } - if (size > bin->max) { + if (size > bin->max) bin->max = size; - } } bin->count++; bin->bytes += (unsigned long long)size; @@ -1204,35 +1574,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_hdfs_read() */ -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); -#endif /* HDFS_DEBUG */ - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "Illegal get-handle of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_read() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_write * - * Purpose: Write bytes to file. - * UNSUPPORTED IN READ-ONLY HDFS VFD. + * Function: H5FD_hdfs_write() * - * Return: FAIL (Not possible with Read-Only S3 file.) + * Purpose: + * + * Write bytes to file. + * UNSUPPORTED IN READ-ONLY HDFS VFD. + * + * Return: + * + * FAIL (Not possible with Read-Only S3 file.) * * Programmer: Jacob Smith * 2017-10-23 @@ -1248,24 +1601,29 @@ H5FD_hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hi FUNC_ENTER_NOAPI_NOINIT #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_write() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_hdfs_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Function: H5FD_hdfs_truncate + * + * Purpose: * - * NOT POSSIBLE ON READ-ONLY S3 FILES. + * Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Return: FAIL (Not possible on Read-Only S3 files.) + * NOT POSSIBLE ON READ-ONLY S3 FILES. + * + * Return: + * + * FAIL (Not possible on Read-Only S3 files.) * * Programmer: Jacob Smith * 2017-10-23 @@ -1280,25 +1638,30 @@ H5FD_hdfs_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, h FUNC_ENTER_NOAPI_NOINIT #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_truncate() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_hdfs_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_lock * - * Purpose: Place an advisory lock on a file. - * No effect on Read-Only S3 file. + * Function: H5FD_hdfs_lock + * + * Purpose: + * + * Place an advisory lock on a file. + * No effect on Read-Only S3 file. * - * Suggestion: remove lock/unlock from class - * would result in error at H5FD_[un]lock() (H5FD.c) + * Suggestion: remove lock/unlock from class + * would result in error at H5FD_[un]lock() (H5FD.c) * - * Return: SUCCEED (No-op always succeeds) + * Return: + * + * SUCCEED (No-op always succeeds) * * Programmer: Jacob Smith * 2017-11-03 @@ -1309,16 +1672,22 @@ static herr_t H5FD_hdfs_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_hdfs_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_unlock * - * Purpose: Remove the existing lock on the file. - * No effect on Read-Only S3 file. + * Function: H5FD_hdfs_unlock + * + * Purpose: + * + * Remove the existing lock on the file. + * No effect on Read-Only S3 file. * - * Return: SUCCEED (No-op always succeeds) + * Return: + * + * SUCCEED (No-op always succeeds) * * Programmer: Jacob Smith * 2017-11-03 @@ -1329,522 +1698,56 @@ static herr_t H5FD_hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) { FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_hdfs_unlock() */ -/*------------------------------------------------------------------------- - * Function: H5FD_hdfs_validate_config() - * - * Purpose: Test to see if the supplied instance of H5FD_hdfs_fapl_t - * contains internally consistant data. Return SUCCEED if so, - * and FAIL otherwise. - * - * Note the difference between internally consistant and - * correct. As we will have to try to access the target - * object to determine whether the supplied data is correct, - * we will settle for internal consistancy at this point - * - * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally - * consistant data, FAIL otherwise. - * - * Programmer: Jacob Smith - * 9/10/17 - * - *------------------------------------------------------------------------- +#else /* H5_HAVE_LIBHDFS */ + +/* No-op stubs to avoid binary compatibility problems with previous + * HDF5 1.8 versions. Non-functional versions of these API calls were + * erroneously included in the library even when the HDFS VFD was not + * configured. */ -static herr_t -H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t *fa) +hid_t +H5FD_hdfs_init(void) { - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(fa != NULL); - - if (fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_hdfs_fapl_t version"); - - if (fa->namenode_port > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); - if (fa->namenode_port < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); + /* This should never be called since the header doesn't invoke it */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(H5I_INVALID_HID) +} -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_validate_config() */ +void +H5FD_hdfs_term(void) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI_VOID +} /* end H5FD_hdfs_term() */ -/*------------------------------------------------------------------------- - * Function: H5Pget_fapl_hdfs - * - * Purpose: Returns information about the hdfs file access property - * list though the function arguments. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: John Mainzer - * 9/10/17 - * - *------------------------------------------------------------------------- - */ herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) { - const H5FD_hdfs_fapl_t *fa = NULL; - H5P_genplist_t * plist = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", fapl_id, fa_out); - -#if HDFS_DEBUG - HDfprintf(stdout, "H5Pget_fapl_hdfs() called.\n"); -#endif - - if (fa_out == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") - plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - if (H5FD_HDFS != H5P_get_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - - fa = (const H5FD_hdfs_fapl_t *)H5P_get_driver_info(plist); - if (fa == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - - /* Copy the hdfs fapl data out */ - HDmemcpy(fa_out, fa, sizeof(H5FD_hdfs_fapl_t)); - -done: - FUNC_LEAVE_API(ret_value) -} /* H5Pget_fapl_hdfs() */ - -/*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_get - * - * Purpose: Gets a file access property list which could be used to - * create an identical file. - * - * Return: Success: Ptr to new file access property list value. - * Failure: NULL - * - * Programmer: John Mainzer - * 9/8/17 - * - *------------------------------------------------------------------------- - */ -static void * -H5FD_hdfs_fapl_get(H5FD_t *_file) -{ - H5FD_hdfs_t * file = (H5FD_hdfs_t *)_file; - H5FD_hdfs_fapl_t *fa = NULL; - void * ret_value = NULL; + herr_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT - fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t)); - if (fa == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - /* Copy the fields of the structure */ - HDmemcpy(fa, &(file->fa), sizeof(H5FD_hdfs_fapl_t)); - - ret_value = fa; + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library") done: - if (ret_value == NULL && fa != NULL) { - H5MM_xfree(fa); /* clean up on error */ - } - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_fapl_get() */ +} -/*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_copy - * - * Purpose: Copies the hdfs-specific file access properties. - * - * Return: Success: Ptr to a new property list - * Failure: NULL - * - * Programmer: John Mainzer - * 9/8/17 - * - *------------------------------------------------------------------------- - */ -static void * -H5FD_hdfs_fapl_copy(const void *_old_fa) +herr_t +H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) { - const H5FD_hdfs_fapl_t *old_fa = (const H5FD_hdfs_fapl_t *)_old_fa; - H5FD_hdfs_fapl_t * new_fa = NULL; - void * ret_value = NULL; + herr_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT - new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t)); - if (new_fa == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - HDmemcpy(new_fa, old_fa, sizeof(H5FD_hdfs_fapl_t)); - ret_value = new_fa; + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library") done: - if (ret_value == NULL && new_fa != NULL) - H5MM_xfree(new_fa); /* clean up on error */ - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_fapl_copy() */ - -/*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_free - * - * Purpose: Frees the hdfs-specific file access properties. - * - * Return: SUCCEED (cannot fail) - * - * Programmer: John Mainzer - * 9/8/17 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_hdfs_fapl_free(void *_fa) -{ - H5FD_hdfs_fapl_t *fa = (H5FD_hdfs_fapl_t *)_fa; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(fa != NULL); /* sanity check */ - - H5MM_xfree(fa); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FD_hdfs_fapl_free() */ - -#if HDFS_STATS - -/*---------------------------------------------------------------------------- - * Function: hdfs_reset_stats() - * - * Purpose: Reset the stats collection elements in this virtual file structure. - * Clears any set data in stats bins; initializes/zeroes values. - * - * Return: - SUCCESS: `SUCCEED` - * - FAILURE: `FAIL` - * - Occurs if the file is invalid somehow - * - * Programmer: Jacob Smith - * 2017-12-08 - * - *---------------------------------------------------------------------------- - */ -static herr_t -hdfs_reset_stats(H5FD_hdfs_t *file) -{ - unsigned i = 0; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDprintf("hdfs_reset_stats() called\n"); -#endif - - if (file == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null") - - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { - file->raw[i].bytes = 0; - file->raw[i].count = 0; - file->raw[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; - file->raw[i].max = 0; +} - file->meta[i].bytes = 0; - file->meta[i].count = 0; - file->meta[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; - file->meta[i].max = 0; - } - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* hdfs_reset_stats */ -#endif /* HDFS_STATS */ - -#if HDFS_STATS - -/*---------------------------------------------------------------------------- - * Function: hdfs_fprint_stats() - * - * Purpose: Tabulate and pretty-print statistics for this virtual file. - * - * Should be called upon file close. - * - * Shows number of reads and bytes read, broken down by - * "raw" (H5FD_MEM_DRAW) - * or "meta" (any other flag) - * - * Prints filename and listing of total number of reads and bytes read, - * both as a grand total and separate meta- and rawdata reads. - * - * If any reads were done, prints out two tables: - * - * 1. overview of raw- and metadata reads - * - min (smallest size read) - * - average of size read - * - k,M,G suffixes by powers of 1024 (2^10) - * - max (largest size read) - * 2. tabulation of "bins", sepraring reads into exponentially-larger - * ranges of size. - * - columns for number of reads, total bytes, and average size, with - * separate sub-colums for raw- and metadata reads. - * - each row represents one bin, identified by the top of its range - * - * Bin ranges can be modified with pound-defines at the top of this file. - * - * Bins without any reads in their bounds are not printed. - * - * An "overflow" bin is also present, to catch "big" reads. - * - * Output for all bins (and range ceiling and average size report) - * is divied by powers of 1024. By corollary, four digits before the decimal - * is valid. - * - * - 41080 bytes is represented by 40.177k, not 41.080k - * - 1004.831M represents approx. 1052642000 bytes - * - * Return: - SUCCESS: `SUCCEED` - * - FAILURE: `FAIL` - * - occurs if the file passed in is invalid - * - TODO: if stream is invalid? how can we check this? - * - * Programmer: Jacob Smith - * - *---------------------------------------------------------------------------- - */ -static herr_t -hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file) -{ - herr_t ret_value = SUCCEED; - parsed_url_t * purl = NULL; - unsigned i = 0; - unsigned long count_meta = 0; - unsigned long count_raw = 0; - double average_meta = 0.0; - double average_raw = 0.0; - unsigned long long min_meta = (unsigned long long)HDFS_STATS_STARTING_MIN; - unsigned long long min_raw = (unsigned long long)HDFS_STATS_STARTING_MIN; - unsigned long long max_meta = 0; - unsigned long long max_raw = 0; - unsigned long long bytes_raw = 0; - unsigned long long bytes_meta = 0; - double re_dub = 0.0; /* re-usable double variable */ - unsigned suffix_i = 0; - const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'}; - - FUNC_ENTER_NOAPI_NOINIT - - if (stream == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null") - if (file == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null") - if (file->hdfs_handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle cannot be null") - if (file->hdfs_handle->magic != HDFS_HDFST_MAGIC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle has invalid magic") - - /******************* - * AGGREGATE STATS * - *******************/ - - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { - const hdfs_statsbin *r = &file->raw[i]; - const hdfs_statsbin *m = &file->meta[i]; - - if (m->min < min_meta) { - min_meta = m->min; - } - if (r->min < min_raw) { - min_raw = r->min; - } - if (m->max > max_meta) { - max_meta = m->max; - } - if (r->max > max_raw) { - max_raw = r->max; - } - - count_raw += r->count; - count_meta += m->count; - bytes_raw += r->bytes; - bytes_meta += m->bytes; - } - if (count_raw > 0) { - average_raw = (double)bytes_raw / (double)count_raw; - } - if (count_meta > 0) { - average_meta = (double)bytes_meta / (double)count_meta; - } - - /****************** - * PRINT OVERVIEW * - ******************/ - - HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, - count_raw); - HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, - bytes_raw); - - if (count_raw + count_meta == 0) { - goto done; - } - - /************************* - * PRINT AGGREGATE STATS * - *************************/ - - HDfprintf(stream, "SIZES meta raw\n"); - HDfprintf(stream, " min "); - if (count_meta == 0) { - HDfprintf(stream, " 0.000 "); - } - else { - re_dub = (double)min_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { - re_dub /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); - } - - if (count_raw == 0) { - HDfprintf(stream, " 0.000 \n"); - } - else { - re_dub = (double)min_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { - re_dub /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - } - - HDfprintf(stream, " avg "); - re_dub = (double)average_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { - re_dub /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); - - re_dub = (double)average_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { - re_dub /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - - HDfprintf(stream, " max "); - re_dub = (double)max_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { - re_dub /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); - - re_dub = (double)max_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { - re_dub /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - - /****************************** - * PRINT INDIVIDUAL BIN STATS * - ******************************/ - - HDfprintf(stream, "BINS # of reads total bytes average size\n"); - HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); - - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { - const hdfs_statsbin *m; - const hdfs_statsbin *r; - unsigned long long range_end = 0; - char bm_suffix = ' '; /* bytes-meta */ - double bm_val = 0.0; - char br_suffix = ' '; /* bytes-raw */ - double br_val = 0.0; - char am_suffix = ' '; /* average-meta */ - double am_val = 0.0; - char ar_suffix = ' '; /* average-raw */ - double ar_val = 0.0; - - m = &file->meta[i]; - r = &file->raw[i]; - if (r->count == 0 && m->count == 0) { - continue; - } - - range_end = hdfs_stats_boundaries[i]; - - if (i == HDFS_STATS_BIN_COUNT) { - range_end = hdfs_stats_boundaries[i - 1]; - HDfprintf(stream, ">"); - } - else { - HDfprintf(stream, " "); - } - - bm_val = (double)m->bytes; - for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) { - bm_val /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - bm_suffix = suffixes[suffix_i]; - - br_val = (double)r->bytes; - for (suffix_i = 0; br_val >= 1024.0; suffix_i++) { - br_val /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - br_suffix = suffixes[suffix_i]; - - if (m->count > 0) { - am_val = (double)(m->bytes) / (double)(m->count); - } - for (suffix_i = 0; am_val >= 1024.0; suffix_i++) { - am_val /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - am_suffix = suffixes[suffix_i]; - - if (r->count > 0) { - ar_val = (double)(r->bytes) / (double)(r->count); - } - for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) { - ar_val /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - ar_suffix = suffixes[suffix_i]; - - re_dub = (double)range_end; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { - re_dub /= 1024.0; - } - HDassert(suffix_i < sizeof(suffixes)); - - HDfprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, - suffixes[suffix_i], /* bin ceiling */ - m->count, /* metadata reads */ - r->count, /* rawdata reads */ - bm_val, bm_suffix, /* metadata bytes */ - br_val, br_suffix, /* rawdata bytes */ - am_val, am_suffix, /* metadata average */ - ar_val, ar_suffix); /* rawdata average */ - fflush(stream); - } - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* hdfs_fprint_stats */ -#endif /* HDFS_STATS */ +#endif /* H5_HAVE_LIBHDFS */ diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index dd7b27e..a5d08b2 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -16,17 +16,17 @@ * Programmer: Jacob Smith * 2018-04-23 * - * Purpose: The public header file for the hdfs driver. + * Purpose: The public header file for the hdfs driver. */ #ifndef H5FDhdfs_H #define H5FDhdfs_H +#ifdef H5_HAVE_LIBHDFS #define H5FD_HDFS (H5FD_hdfs_init()) - -#ifdef __cplusplus -extern "C" { -#endif +#else /* H5_HAVE_LIBHDFS */ +#define H5FD_HDFS (-1) +#endif /* H5_HAVE_LIBHDFS */ /**************************************************************************** * @@ -90,8 +90,6 @@ extern "C" { * Programmer: Jacob Smith * 2018-04-23 * - * Changes: None - * ****************************************************************************/ #define H5FD__CURR_HDFS_FAPL_T_VERSION 1 @@ -109,6 +107,10 @@ typedef struct H5FD_hdfs_fapl_t { int32_t stream_buffer_size; } H5FD_hdfs_fapl_t; +#ifdef __cplusplus +extern "C" { +#endif + H5_DLL hid_t H5FD_hdfs_init(void); H5_DLL void H5FD_hdfs_term(void); H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out); diff --git a/src/H5FDint.c b/src/H5FDint.c index 9313952..4f0f5a5 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FDint.c - * Jan 17 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5FDint.c * - * Purpose: Internal routine for VFD operations + * Purpose: Internal routine for VFD operations * *------------------------------------------------------------------------- */ @@ -34,11 +32,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#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 "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ /****************/ /* Local Macros */ @@ -96,20 +94,18 @@ H5FD_int_init_interface(void) * 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, const H5P_genplist_t *dxpl, haddr_t *sig_addr) { - haddr_t addr, eoa; + haddr_t addr = HADDR_UNDEF; + haddr_t eoa = 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 @@ -122,8 +118,7 @@ H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_add 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++) { @@ -134,7 +129,7 @@ H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_add 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 @@ -144,7 +139,7 @@ H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_add 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; @@ -154,15 +149,11 @@ done: } /* end H5FD_locate_signature() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -180,9 +171,11 @@ H5FD_read(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t add HDassert(buf); #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 */ @@ -203,15 +196,11 @@ done: } /* end H5FD_read() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -219,8 +208,8 @@ herr_t H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { - haddr_t eoa = HADDR_UNDEF; - herr_t ret_value = SUCCEED; /* Return value */ + haddr_t eoa = HADDR_UNDEF; /* EOA for file */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -229,9 +218,11 @@ H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t ad HDassert(buf); #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 */ @@ -252,20 +243,16 @@ done: } /* end H5FD_write() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -288,27 +275,25 @@ done: } /* end H5FD_set_eoa() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ haddr_t H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) { - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -326,30 +311,25 @@ done: } /* end H5FD_get_eoa() */ /*------------------------------------------------------------------------- - * 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. - * - * Failure: HADDR_UNDEF - * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: Success: The EOF address. * - * Modifications: + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ haddr_t H5FD_get_eof(const H5FD_t *file) { - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -359,7 +339,7 @@ H5FD_get_eof(const H5FD_t *file) if (file->cls->get_eof) { if (HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file))) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed") - } /* end if */ + } else ret_value = file->maxaddr; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 155bfb6..5a3082e 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Monday, April 17, 2000 * * Purpose: The POSIX unbuffered file driver using only the HDF5 public @@ -231,8 +231,8 @@ H5FD_log_init_interface(void) * Purpose: Initialize this driver by registering the driver with the * library. * - * Return: Success: The driver ID for the log driver. - * Failure: Negative. + * Return: Success: The driver ID for the log driver + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, July 29, 1999 @@ -242,9 +242,9 @@ H5FD_log_init_interface(void) hid_t H5FD_log_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if (H5I_VFL != H5I_get_type(H5FD_LOG_g)) H5FD_LOG_g = H5FD_register(&H5FD_log_g, sizeof(H5FD_class_t), FALSE); @@ -338,8 +338,8 @@ done: static void * H5FD_log_fapl_get(H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t *)_file; - void * ret_value; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -444,11 +444,11 @@ H5FD_log_fapl_free(void *_fa) static H5FD_t * H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_log_t * file = NULL; - H5P_genplist_t * plist; /* Property list */ - H5FD_log_fapl_t *fa; /* File access property list information */ - int fd = -1; /* File descriptor */ - int o_flags; /* Flags for open() call */ + H5FD_log_t * file = NULL; + H5P_genplist_t * plist; /* Property list */ + const H5FD_log_fapl_t *fa; /* File access property list information */ + int fd = -1; /* File descriptor */ + int o_flags; /* Flags for open() call */ #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -910,7 +910,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsi { H5FD_log_t *file = (H5FD_log_t *)_file; haddr_t addr; - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -992,6 +992,7 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) FUNC_ENTER_NOAPI_NOINIT_NOERR if (file->fa.flags != 0) { + /* Check for increasing file size */ if (H5F_addr_gt(addr, file->eoa) && H5F_addr_gt(addr, 0)) { hsize_t size = addr - file->eoa; diff --git a/src/H5FDlog.h b/src/H5FDlog.h index 4655bf6..a463c69 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Monday, April 17, 2000 * * Purpose: The public header file for the log driver. @@ -20,8 +20,6 @@ #ifndef H5FDlog_H #define H5FDlog_H -#include "H5Ipublic.h" - #define H5FD_LOG (H5FD_log_init()) /* Flags for H5Pset_fapl_log() */ diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 100c012..0cf561d 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Friday, January 30, 2004 * * Purpose: Common routines for all MPI-based VFL drivers. @@ -40,8 +40,6 @@ * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -78,8 +76,6 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -115,8 +111,6 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ MPI_Comm @@ -153,13 +147,6 @@ done: * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1999-04-23 - * An error is reported for address overflows. The ADDR output - * argument is optional. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ haddr_t @@ -190,16 +177,6 @@ H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off) * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1999-04-23 - * An error is reported for address overflows. The ADDR output - * argument is optional. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -238,8 +215,6 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off /*out*/) * * Programmer: Albert Cheng * Jan 8, 2003 - * - * Modifications: *------------------------------------------------------------------------- */ herr_t @@ -301,8 +276,6 @@ done: * * Programmer: Albert Cheng * Jan 8, 2003 - * - * Modifications: *------------------------------------------------------------------------- */ herr_t @@ -348,9 +321,6 @@ done: * Programmer: rky * 19981207 * - * Modifications: - * Robb Matzke, 1999-08-09 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -402,9 +372,6 @@ done: * Programmer: rky * 19981207 * - * Modifications: - * Robb Matzke, 1999-08-09 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index d33105e..f22cc67 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Friday, January 30, 2004 * * Purpose: The public header file for common items for all MPI VFL drivers diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b086aab..07ad184 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -12,24 +12,24 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Purpose: This is the MPI-2 I/O driver. + * Purpose: This is the MPI-2 I/O driver. * */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5FD_mpio_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_PARALLEL @@ -180,13 +180,13 @@ H5FD_mpio_init_interface(void) } /* H5FD_mpio_init_interface() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_init + * Function: H5FD_mpio_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the mpio driver. - * Failure: Negative. + * Return: Success: The driver ID for the mpio driver + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, August 5, 1999 @@ -198,11 +198,11 @@ H5FD_mpio_init(void) { #ifdef H5FDmpio_DEBUG static int H5FD_mpio_Debug_inited = 0; -#endif /* H5FDmpio_DEBUG */ - const char *s; /* String for environment variables */ - hid_t ret_value; /* Return value */ +#endif /* H5FDmpio_DEBUG */ + const char *s; /* String for environment variables */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Register the MPI-IO VFD, if it isn't already */ if (H5I_VFL != H5I_get_type(H5FD_MPIO_g)) @@ -236,17 +236,15 @@ done: } /* end H5FD_mpio_init() */ /*--------------------------------------------------------------------------- - * Function: H5FD_mpio_term + * Function: H5FD_mpio_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * * Return: <none> * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ void @@ -261,61 +259,33 @@ H5FD_mpio_term(void) } /* end H5FD_mpio_term() */ /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_mpio + * Function: H5Pset_fapl_mpio * - * Purpose: Store the user supplied MPIO communicator comm and info in - * the file access property list FAPL_ID which can then be used - * to create and/or open the file. This function is available - * only in the parallel HDF5 library and is not collective. + * Purpose: Store the user supplied MPIO communicator comm and info in + * the file access property list FAPL_ID which can then be used + * to create and/or open the file. This function is available + * only in the parallel HDF5 library and is not collective. * - * comm is the MPI communicator to be used for file open as - * defined in MPI_FILE_OPEN of MPI-2. This function makes a - * duplicate of comm. Any modification to comm after this function - * call returns has no effect on the access property list. + * comm is the MPI communicator to be used for file open as + * defined in MPI_FILE_OPEN of MPI-2. This function makes a + * duplicate of comm. Any modification to comm after this function + * call returns has no effect on the access property list. * - * info is the MPI Info object to be used for file open as - * defined in MPI_FILE_OPEN of MPI-2. This function makes a - * duplicate of info. Any modification to info after this - * function call returns has no effect on the access property - * list. + * info is the MPI Info object to be used for file open as + * defined in MPI_FILE_OPEN of MPI-2. This function makes a + * duplicate of info. Any modification to info after this + * function call returns has no effect on the access property + * list. * * If fapl_id has previously set comm and info values, they * will be replaced and the old communicator and Info object * are freed. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Albert Cheng - * Feb 3, 1998 - * - * Modifications: - * Robb Matzke, 1998-02-18 - * Check all arguments before the property list is updated so we - * don't leave the property list in a bad state if something - * goes wrong. Also, the property list data type changed to - * allow more generality so all the mpi-related stuff is in the - * `u.mpi' member. The `access_mode' will contain only - * mpi-related flags defined in H5Fpublic.h. - * - * Albert Cheng, 1998-04-16 - * Removed the ACCESS_MODE argument. The access mode is changed - * to be controlled by data transfer property list during data - * read/write calls. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Raymond Lu, 2001-10-23 - * Changed the file access list to the new generic property - * list. - * - * Albert Cheng, 2003-04-17 - * Modified the description of the function that it now stores - * a duplicate of the communicator and INFO object. Free the - * old duplicates if previously set. (Work is actually done - * by H5P_set_driver.) + * Feb 3, 1998 * *------------------------------------------------------------------------- */ @@ -329,10 +299,9 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) FUNC_ENTER_API(FAIL) H5TRACE3("e", "iMcMi", fapl_id, comm, info); + /* Check arguments */ if (fapl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if (MPI_COMM_NULL == comm) @@ -347,43 +316,28 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) done: FUNC_LEAVE_API(ret_value) -} +} /* H5Pset_fapl_mpio() */ /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_mpio - * - * Purpose: If the file access property list is set to the H5FD_MPIO - * driver then this function returns duplicates of the MPI - * communicator and Info object stored through the comm and - * info pointers. It is the responsibility of the application - * to free the returned communicator and Info object. - * - * Return: Success: Non-negative with the communicator and - * Info object returned through the comm and - * info arguments if non-null. Since they are - * duplicates of the stored objects, future - * modifications to the access property list do - * not affect them and it is the responsibility - * of the application to free them. - * - * Failure: Negative + * Function: H5Pget_fapl_mpio + * + * Purpose: If the file access property list is set to the H5FD_MPIO + * driver then this function returns duplicates of the MPI + * communicator and Info object stored through the comm and + * info pointers. It is the responsibility of the application + * to free the returned communicator and Info object. + * + * Return: Success: Non-negative with the communicator and + * Info object returned through the comm and + * info arguments if non-null. Since they are + * duplicates of the stored objects, future + * modifications to the access property list do + * not affect them and it is the responsibility + * of the application to free them. + * Failure: Negative * * Programmer: Robb Matzke - * Thursday, February 26, 1998 - * - * Modifications: - * - * Albert Cheng, Apr 16, 1998 - * Removed the access_mode argument. The access_mode is changed - * to be controlled by data transfer property list during data - * read/write calls. - * - * Raymond Lu, 2001-10-23 - * Changed the file access list to the new generic property - * list. - * - * Albert Cheng, 2003-04-17 - * Return duplicates of the stored communicator and Info object. + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -419,44 +373,46 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/) if (MPI_INFO_NULL != fa->info) { if (MPI_SUCCESS != (mpi_code = MPI_Info_dup(fa->info, info))) HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) - } - else { + } /* end if */ + else /* do not dup it */ *info = MPI_INFO_NULL; - } - } + } /* end if */ + /* Store the copied communicator, now that the Info object has been + * successfully copied. + */ if (comm) *comm = comm_tmp; done: - if (FAIL == ret_value) { + if (ret_value < 0) /* need to free anything created here */ if (comm_tmp != MPI_COMM_NULL) MPI_Comm_free(&comm_tmp); - } + FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_mpio() */ /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio + * Function: H5Pset_dxpl_mpio * - * Purpose: Set the data transfer property list DXPL_ID to use transfer - * mode XFER_MODE. The property list can then be used to control - * the I/O transfer mode during data I/O operations. The valid - * transfer modes are: + * Purpose: Set the data transfer property list DXPL_ID to use transfer + * mode XFER_MODE. The property list can then be used to control + * the I/O transfer mode during data I/O operations. The valid + * transfer modes are: * - * H5FD_MPIO_INDEPENDENT: - * Use independent I/O access (the default). + * H5FD_MPIO_INDEPENDENT: + * Use independent I/O access (the default). * - * H5FD_MPIO_COLLECTIVE: - * Use collective I/O access. + * H5FD_MPIO_COLLECTIVE: + * Use collective I/O access. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Albert Cheng - * April 2, 1998 + * April 2, 1998 * *------------------------------------------------------------------------- */ @@ -469,10 +425,9 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) FUNC_ENTER_API(FAIL) H5TRACE2("e", "iDt", dxpl_id, xfer_mode); + /* Check arguments */ if (dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") if (H5FD_MPIO_INDEPENDENT != xfer_mode && H5FD_MPIO_COLLECTIVE != xfer_mode) @@ -487,19 +442,18 @@ done: } /* end H5Pset_dxpl_mpio() */ /*------------------------------------------------------------------------- - * Function: H5Pget_dxpl_mpio + * Function: H5Pget_dxpl_mpio * - * Purpose: Queries the transfer mode current set in the data transfer - * property list DXPL_ID. This is not collective. + * Purpose: Queries the transfer mode current set in the data transfer + * property list DXPL_ID. This is not collective. * - * Return: Success: Non-negative, with the transfer mode returned - * through the XFER_MODE argument if it is - * non-null. - * - * Failure: Negative + * Return: Success: Non-negative, with the transfer mode returned + * through the XFER_MODE argument if it is + * non-null. + * Failure: Negative * * Programmer: Albert Cheng - * April 2, 1998 + * April 2, 1998 * *------------------------------------------------------------------------- */ @@ -512,6 +466,7 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", dxpl_id, xfer_mode); + /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -525,21 +480,20 @@ done: } /* end H5Pget_dxpl_mpio() */ /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_collective_opt + * Function: H5Pset_dxpl_mpio_collective_opt * - * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O - * without involving decision-making inside HDF5 + * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O + * without involving decision-making inside HDF5 * - * Note: The library will do linked chunk I/O or multi-chunk I/O without - * involving communications for decision-making process. - * The library won't behave as it asks for only when we find - * that the low-level MPI-IO package doesn't support this. + * Note: The library will do linked chunk I/O or multi-chunk I/O without + * involving communications for decision-making process. + * The library won't behave as it asks for only when we find + * that the low-level MPI-IO package doesn't support this. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -552,10 +506,9 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo FUNC_ENTER_API(FAIL) H5TRACE2("e", "iDc", dxpl_id, opt_mode); + /* Check arguments */ if (dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -568,21 +521,20 @@ done: } /* end H5Pset_dxpl_mpio_collective_opt() */ /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt + * Function: H5Pset_dxpl_mpio_chunk_opt * - * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O - * without involving decision-making inside HDF5 + * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O + * without involving decision-making inside HDF5 * - * Note: The library will do linked chunk I/O or multi-chunk I/O without - * involving communications for decision-making process. - * The library won't behave as it asks for only when we find - * that the low-level MPI-IO package doesn't support this. + * Note: The library will do linked chunk I/O or multi-chunk I/O without + * involving communications for decision-making process. + * The library won't behave as it asks for only when we find + * that the low-level MPI-IO package doesn't support this. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -595,10 +547,9 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode) FUNC_ENTER_API(FAIL) H5TRACE2("e", "iDh", dxpl_id, opt_mode); + /* Check arguments */ if (dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -611,19 +562,18 @@ done: } /* end H5Pset_dxpl_mpio_chunk_opt() */ /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt_num + * Function: H5Pset_dxpl_mpio_chunk_opt_num * - * Purpose: To set a threshold for doing linked chunk IO + * Purpose: To set a threshold for doing linked chunk IO * - * Note: If the number is greater than the threshold set by the user, - * the library will do linked chunk I/O; otherwise, I/O will be - * done for every chunk. + * Note: If the number is greater than the threshold set by the user, + * the library will do linked chunk I/O; otherwise, I/O will be + * done for every chunk. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -636,10 +586,9 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc) FUNC_ENTER_API(FAIL) H5TRACE2("e", "iIu", dxpl_id, num_chunk_per_proc); + /* Check arguments */ if (dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -652,22 +601,21 @@ done: } /* end H5Pset_dxpl_mpio_chunk_opt_num() */ /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt_ratio + * Function: H5Pset_dxpl_mpio_chunk_opt_ratio * - * Purpose: To set a threshold for doing collective I/O for each chunk + * Purpose: To set a threshold for doing collective I/O for each chunk * - * Note: The library will calculate the percentage of the number of - * process holding selections at each chunk. If that percentage - * of number of process in the individual chunk is greater than - * the threshold set by the user, the library will do collective - * chunk I/O for this chunk; otherwise, independent I/O will be - * done for this chunk. + * Note: The library will calculate the percentage of the number of + * process holding selections at each chunk. If that percentage + * of number of process in the individual chunk is greater than + * the threshold set by the user, the library will do collective + * chunk I/O for this chunk; otherwise, independent I/O will be + * done for this chunk. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -680,10 +628,9 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch FUNC_ENTER_API(FAIL) H5TRACE2("e", "iIu", dxpl_id, percent_num_proc_per_chunk); + /* Check arguments */ if (dxpl_id == H5P_DEFAULT) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") @@ -696,17 +643,17 @@ done: } /* end H5Pset_dxpl_mpio_chunk_opt_ratio() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_get + * Function: H5FD_mpio_fapl_get * - * Purpose: Returns a file access property list which could be used to - * create another file the same as this one. + * Purpose: Returns a file access property list which could be used to + * create another file the same as this one. * - * Return: Success: Ptr to new file access property list with all - * fields copied from the file pointer. + * Return: Success: Ptr to new file access property list with all + * fields copied from the file pointer. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 13, 1999 * *------------------------------------------------------------------------- @@ -738,15 +685,15 @@ done: } /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_copy + * Function: H5FD_mpio_fapl_copy * - * Purpose: Copies the mpio-specific file access properties. + * Purpose: Copies the mpio-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Jan 8, 2003 * *------------------------------------------------------------------------- @@ -790,19 +737,17 @@ done: } /* end H5FD_mpio_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_fapl_free + * Function: H5FD_mpio_fapl_free * - * Purpose: Frees the mpio-specific file access properties. + * Purpose: Frees the mpio-specific file access properties. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Jan 8, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -831,16 +776,14 @@ H5FD_mpio_fapl_free(void *_fa) } /* end H5FD_mpio_fapl_free() */ /*------------------------------------------------------------------------- - * Function: H5FD_set_mpio_atomicity + * Function: H5FD_set_mpio_atomicity * - * Purpose: Sets the atomicity mode + * Purpose: Sets the atomicity mode * - * Return: Success: Non-negative + * Return: SUCCEED/FAIL * - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ @@ -856,7 +799,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering H5FD_set_mpio_atomicity\n"); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif if (FALSE == flag) @@ -871,22 +814,21 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving H5FD_set_mpio_atomicity\n"); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_set_mpio_atomicity() */ /*------------------------------------------------------------------------- - * Function: H5FD_get_mpio_atomicity + * Function: H5FD_get_mpio_atomicity * - * Purpose: Returns the atomicity mode + * Purpose: Returns the atomicity mode * - * Return: Success: Non-negative + * Return: SUCCEED/FAIL * - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ @@ -902,10 +844,10 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering H5FD_get_mpio_atomicity\n"); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif - /* get atomicity value */ + /* Get atomicity value */ if (MPI_SUCCESS != (mpi_code = MPI_File_get_atomicity(file->f, &temp_flag))) HMPI_GOTO_ERROR(FAIL, "MPI_File_get_atomicity", mpi_code) @@ -917,54 +859,28 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving H5FD_get_mpio_atomicity\n"); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_get_mpio_atomicity() */ /*------------------------------------------------------------------------- * Function: H5FD_mpio_open * * Purpose: Opens a file with name NAME. The FLAGS are a bit field with - * purpose similar to the second argument of open(2) and which - * are defined in H5Fpublic.h. The file access property list - * FAPL_ID contains the properties driver properties and MAXADDR - * is the largest address which this file will be expected to - * access. This is collective. + * purpose similar to the second argument of open(2) and which + * are defined in H5Fpublic.h. The file access property list + * FAPL_ID contains the properties driver properties and MAXADDR + * is the largest address which this file will be expected to + * access. This is collective. * - * Return: Success: A new file pointer. + * Return: Success: A new file pointer + * Failure: NULL * - * Failure: NULL - * - * Programmer: + * Programmer: Robert Kim Yates * January 30, 1998 * - * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. Moved some error checking - * here from elsewhere. - * - * rky, 1998-01-11 - * Added H5FD_mpio_Debug debug flags controlled by MPI_Info. - * - * rky, 1998-08-28 - * Init flag controlling redundant metadata writes to disk. - * - * rky, 1998-12-07 - * Added barrier after MPI_File_set_size to prevent race - * condition -- subsequent writes were being truncated, causing - * holes in file. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * rky & ppw, 1999-11-07 - * Modified "H5FD_mpio_open" so that file-truncation is - * avoided for brand-new files (with zero filesize). - * - * Albert Cheng, 2003-04-17 - * Duplicate the communicator and Info object so that file is - * insulated from the old one. *------------------------------------------------------------------------- */ static H5FD_t * @@ -996,25 +912,25 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR_ } #endif - /* Obtain a pointer to mpio-specific file access properties */ + /* Get a pointer to the fapl */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_get_driver(plist)) { _fa.comm = MPI_COMM_SELF; /*default*/ _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; - } + } /* end if */ else { if (NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") - } + } /* end else */ /* Duplicate communicator and Info object for use by this file. */ if (FAIL == H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup)) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") - /* convert HDF5 flags to MPI-IO flags */ - /* some combinations are illegal; let MPI-IO figure it out */ + /* Convert HDF5 flags to MPI-IO flags */ + /* Some combinations are illegal; let MPI-IO figure it out */ mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; if (flags & H5F_ACC_CREAT) mpi_amode |= MPI_MODE_CREATE; @@ -1100,32 +1016,22 @@ done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving H5FD_mpio_open\n"); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_mpio_open() */ /*------------------------------------------------------------------------- * Function: H5FD_mpio_close * * Purpose: Closes a file. This is collective. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Albert Cheng, 2003-04-17 - * Free the communicator stored. *------------------------------------------------------------------------- */ static herr_t @@ -1139,8 +1045,10 @@ H5FD_mpio_close(H5FD_t *_file) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering H5FD_mpio_close\n"); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -1155,33 +1063,23 @@ H5FD_mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving H5FD_mpio_close\n"); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif + FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_mpio_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_query + * Function: H5FD_mpio_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, August 25, 2000 * - * Modifications: - * - * John Mainzer -- 9/21/05 - * Modified code to turn off the - * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag. - * With the movement of - * all cache writes to process 0, this flag has become - * problematic in PHDF5. - * *------------------------------------------------------------------------- */ static herr_t @@ -1199,27 +1097,21 @@ H5FD_mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5FD_mpio_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_eoa + * Function: H5FD_mpio_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. - * - * Failure: HADDR_UNDEF + * Return: Success: The end-of-address marker + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Friday, August 6, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t @@ -1229,31 +1121,25 @@ H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->eoa) -} +} /* end H5FD_mpio_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_set_eoa - * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Function: H5FD_mpio_set_eoa * - * Return: Success: 0 + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, August 6, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static herr_t @@ -1263,41 +1149,39 @@ H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5FD_mpio_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_eof + * Function: H5FD_mpio_get_eof * - * Purpose: Gets the end-of-file marker for the file. The EOF marker - * is the real size of the file. + * Purpose: Gets the end-of-file marker for the file. The EOF marker + * is the real size of the file. * - * The MPIO driver doesn't bother keeping this field updated - * since that's a relatively expensive operation. Fortunately - * the library only needs the EOF just after the file is opened - * in order to determine whether the file is empty, truncated, - * or okay. Therefore, any MPIO I/O function will set its value - * to HADDR_UNDEF which is the error return value of this - * function. + * The MPIO driver doesn't bother keeping this field updated + * since that's a relatively expensive operation. Fortunately + * the library only needs the EOF just after the file is opened + * in order to determine whether the file is empty, truncated, + * or okay. Therefore, any MPIO I/O function will set its value + * to HADDR_UNDEF which is the error return value of this + * function. * * Keeping the EOF updated (during write calls) is expensive * because any process may extend the physical end of the * file. -QAK * - * Return: Success: The end-of-address marker. - * - * Failure: HADDR_UNDEF + * Return: Success: The end-of-file marker + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Friday, August 6, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t @@ -1307,24 +1191,23 @@ H5FD_mpio_get_eof(const H5FD_t *_file) FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->eof) -} +} /* end H5FD_mpio_get_eof() */ /*------------------------------------------------------------------------- * Function: H5FD_mpio_get_handle * * Purpose: Returns the file handle of MPIO file driver. * - * Returns: Non-negative if succeed or negative if fails. + * Returns: SUCCEED/FAIL * * Programmer: Raymond Lu * Sept. 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1342,7 +1225,7 @@ H5FD_mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handl done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_mpio_get_handle() */ /*------------------------------------------------------------------------- * Function: H5FD_mpio_read @@ -1434,8 +1317,10 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering H5FD_mpio_read\n"); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); /* Make certain we have the correct type of property list */ @@ -1455,7 +1340,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "in H5FD_mpio_read mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i); + HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); #endif /* Only look for MPI views for raw data transfers */ @@ -1578,131 +1463,31 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving H5FD_mpio_read\n"); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_mpio_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_write - * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Function: H5FD_mpio_write * - * MPI is able to coalesce requests from different processes - * (collective and independent). + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * Return: Success: Zero. USE_TYPES and OLD_USE_TYPES in the - * access params are altered. + * MPI is able to coalesce requests from different processes + * (collective and independent). * - * Failure: -1, USE_TYPES and OLD_USE_TYPES in the - * access params may be altered. + * Return: Success: SUCCEED. USE_TYPES and OLD_USE_TYPES in the + * access params are altered. + * Failure: FAIL. USE_TYPES and OLD_USE_TYPES in the + * access params may be altered. * - * Programmer: Unknown + * Programmer: Robert Kim Yates * January 30, 1998 * - * Modifications: - * rky, 1998-08-28 - * If the file->allsame flag is set, we assume that all the - * procs in the relevant MPI communicator will write identical - * data at identical offsets in the file, so only proc 0 will - * write, and all other procs will wait for p0 to finish. This - * is useful for writing metadata, for example. Note that we - * don't _check_ that the data is identical. Also, the mechanism - * we use to eliminate the redundant writes is by requiring a - * call to H5FD_mpio_tas_allsame before the write, which is - * rather klugey. Would it be better to pass a parameter to - * low-level writes like H5F_block_write and H5F_low_write, - * instead? Or...??? Also, when I created this mechanism I - * wanted to minimize the difference in behavior between the old - * way of doing things (i.e., all procs write) and the new way, - * so the writes are eliminated at the very lowest level, here - * in H5FD_mpio_write. It may be better to rethink that, and - * short-circuit the writes at a higher level (e.g., at the - * points in the code where H5FD_mpio_tas_allsame is called). - * - * - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. - * - * rky, 1998-04-10 - * Call independent or collective MPI write, based on - * ACCESS_PARMS. - * - * rky, 1998-04-24 - * Removed redundant write from H5FD_mpio_write. - * - * Albert Cheng, 1998-06-01 - * Added XFER_MODE to control independent or collective MPI - * write. - * - * rky, 1998-08-16 - * Use BTYPE, FTYPE, and DISP from access parms. The guts of - * H5FD_mpio_read and H5FD_mpio_write should be replaced by a - * single dual-purpose routine. - * - * rky, 1998-08-28 - * Added ALLSAME parameter to make all but proc 0 skip the - * actual write. - * - * Robb Matzke, 1999-04-21 - * Changed XFER_MODE to XFER_PARMS for all H5FD_*_write() - * callbacks. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Albert Cheng, 1999-12-19 - * When only-p0-write-allsame-data, p0 Bcasts the - * ret_value to other processes. This prevents - * a racing condition (that other processes try to - * read the file before p0 finishes writing) and also - * allows all processes to report the same ret_value. - * - * Kim Yates, Pat Weidhaas, 2000-09-26 - * Move block of coding where only p0 writes after the - * MPI_File_set_view call. - * - * Quincey Koziol, 2002-05-10 - * Instead of always writing metadata from process 0, spread the - * burden among all the processes by using a round-robin rotation - * scheme. - * - * Quincey Koziol, 2002-05-10 - * Removed allsame code, keying off the type parameter instead. - * - * Quincey Koziol, 2002-05-14 - * Only call MPI_Get_count if we can use MPI_BYTE for the MPI type - * for the I/O transfer. Someday we might include code to decode - * the MPI type used for more complicated transfers and call - * MPI_Get_count all the time. - * - * Quincey Koziol - 2002/06/17 - * Removed 'disp' parameter from H5FD_mpio_setup routine and use - * the address of the dataset in MPI_File_set_view() calls, as - * necessary. - * - * Quincey Koziol - 2002/06/24 - * Removed "lazy" MPI_File_set_view() calls, since they would fail - * if the first I/O was a collective I/O using MPI derived types - * and the next I/O was an independent I/O. - * - * Quincey Koziol - 2002/07/18 - * Added "block_before_meta_write" dataset transfer flag, which - * is set during writes from a metadata cache flush and indicates - * that all the processes must sync up before (one of them) - * writing metadata. - * - * Quincey Koziol - 2003/10/22-31 - * Restructured code massively, straightening out logic and finally - * getting the bytes_written stuff working. - * *------------------------------------------------------------------------- */ static herr_t @@ -1724,8 +1509,10 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering H5FD_mpio_write\n"); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); /* Make certain we have the correct type of property list */ @@ -1745,7 +1532,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "in H5FD_mpio_write mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i); + HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); #endif if (type == H5FD_MEM_DRAW) { @@ -1810,6 +1597,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz if (H5FD_mpio_Debug[(int)'t']) HDfprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); /* get the transfer mode from the dxpl */ @@ -1871,8 +1659,9 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "proc %d: Leaving H5FD_mpio_write with ret_value=%d\n", file->mpi_rank, ret_value); + HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); #endif + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpio_write() */ @@ -1881,9 +1670,7 @@ done: * * Purpose: Makes sure that all data is on disk. This is collective. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * January 30, 1998 @@ -1901,21 +1688,22 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned closing) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering %s\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); /* Only sync the file if we are not going to immediately close it */ - if (!closing) { + if (!closing) if (MPI_SUCCESS != (mpi_code = MPI_File_sync(file->f))) HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code) - } /* end if */ done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving %s\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1944,8 +1732,10 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Entering %s\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -1980,25 +1770,23 @@ H5FD_mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "Leaving %s\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_mpio_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_mpi_rank + * Function: H5FD_mpio_mpi_rank * - * Purpose: Returns the MPI rank for a process + * Purpose: Returns the MPI rank for a process * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol * Thursday, May 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -2008,6 +1796,7 @@ H5FD_mpio_mpi_rank(const H5FD_t *_file) FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -2015,18 +1804,16 @@ H5FD_mpio_mpi_rank(const H5FD_t *_file) } /* end H5FD_mpio_mpi_rank() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_mpi_size + * Function: H5FD_mpio_mpi_size * - * Purpose: Returns the number of MPI processes + * Purpose: Returns the number of MPI processes * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol * Thursday, May 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -2036,6 +1823,7 @@ H5FD_mpio_mpi_size(const H5FD_t *_file) FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); @@ -2043,19 +1831,16 @@ H5FD_mpio_mpi_size(const H5FD_t *_file) } /* end H5FD_mpio_mpi_size() */ /*------------------------------------------------------------------------- - * Function: H5FD_mpio_communicator - * - * Purpose: Returns the MPI communicator for the file. + * Function: H5FD_mpio_communicator * - * Return: Success: The communicator + * Purpose: Returns the MPI communicator for the file. * - * Failure: NULL + * Return: Success: The communicator + * Failure: Can't fail * * Programmer: Robb Matzke * Monday, August 9, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static MPI_Comm @@ -2065,10 +1850,11 @@ H5FD_mpio_communicator(const H5FD_t *_file) FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->comm) -} +} /* end H5FD_mpio_communicator() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index c056ce5..597eec6 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the mpio driver. diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index b5826c4..5072209 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, November 10, 1997 * * Purpose: Implements a file driver which dispatches I/O requests to @@ -26,11 +26,6 @@ #include <stdlib.h> #include <string.h> -/* Disable certain warnings in PC-Lint: */ -/*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */ -/*lint --emacro( {534, 830}, H5FD_MULTI) */ -/*lint -esym( 534, H5Eclear2, H5Epush2) */ - #include "hdf5.h" /* Our version of MAX */ @@ -83,7 +78,7 @@ typedef struct H5FD_multi_fapl_t { hid_t memb_fapl[H5FD_MEM_NTYPES]; /*member access properties */ char * memb_name[H5FD_MEM_NTYPES]; /*name generators */ haddr_t memb_addr[H5FD_MEM_NTYPES]; /*starting addr per member */ - hbool_t relax; /*less stringent error checking */ + hbool_t relax; /*less stringent error checking */ } H5FD_multi_fapl_t; /* @@ -183,7 +178,7 @@ static const H5FD_class_t H5FD_multi_g = { * * Return: Success: Ptr to new copy of string * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Friday, August 13, 1999 @@ -209,14 +204,13 @@ my_strdup(const char *s) /*------------------------------------------------------------------------- * Function: H5FD_multi_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the multi driver. + * Return: Success: The driver ID for the multi driver + * Failure: H5I_INVALID_HID * - * Failure: Negative - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -231,14 +225,14 @@ H5FD_multi_init(void) H5FD_MULTI_g = H5FDregister(&H5FD_multi_g); return H5FD_MULTI_g; -} +} /* end H5FD_multi_init() */ /*--------------------------------------------------------------------------- * Function: H5FD_multi_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * - * Return: <none> + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 @@ -262,7 +256,7 @@ H5FD_multi_term(void) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 11, 1999 @@ -371,7 +365,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c * memb_map: The default member map has the value * H5FD_MEM_DEFAULT for each element. * - * memb_fapl: The value H5P_DEFAULT for each element. + * memb_fapl: The value H5P_DEFAULT for each element. * * memb_name: The string `%s-X.h5' where `X' is one of the * letters `s' (H5FD_MEM_SUPER), @@ -379,26 +373,26 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP), * `o' (H5FD_MEM_OHDR). * - * memb_addr: The value HADDR_UNDEF for each element. + * memb_addr: The value HADDR_UNDEF for each element. * * * Example: To set up a multi file access property list which partitions * data into meta and raw files each being 1/2 of the address * space one would say: * - * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; * hid_t memb_fapl[H5FD_MEM_NTYPES]; * const char *memb[H5FD_MEM_NTYPES]; * haddr_t memb_addr[H5FD_MEM_NTYPES]; * - * // The mapping... - * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) { + * // The mapping... + * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) { * memb_map[mt] = H5FD_MEM_SUPER; * } - * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; + * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; * - * // Member information - * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; + * // Member information + * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; * memb_name[H5FD_MEM_SUPER] = "%s.meta"; * memb_addr[H5FD_MEM_SUPER] = 0; * @@ -406,14 +400,14 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c * memb_name[H5FD_MEM_DRAW] = "%s.raw"; * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; * - * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); + * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); * H5Pset_fapl_multi(fapl, memb_map, memb_fapl, * memb_name, memb_addr, TRUE); * * * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -512,7 +506,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f * * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -523,9 +517,9 @@ herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl /*out*/, char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax) { - H5FD_multi_fapl_t *fa; - H5FD_mem_t mt; - static const char *func = "H5FDget_fapl_multi"; /* Function Name for error reporting */ + const H5FD_multi_fapl_t *fa; + H5FD_mem_t mt; + static const char * func = "H5FDget_fapl_multi"; /* Function Name for error reporting */ /*NO TRACE*/ @@ -536,7 +530,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1) if (H5FD_MULTI != H5Pget_driver(fapl_id)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", - -1) if (NULL == (fa = (H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) + -1) if (NULL == (fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1) if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); @@ -568,11 +562,11 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl * Function: H5FD_multi_sb_size * * Purpose: Returns the size of the private information to be stored in - * the superblock. + * the superblock. * * Return: Success: The super block driver data size. * - * Failure: never fails + * Failure: never fails * * Programmer: Robb Matzke * Monday, August 16, 1999 @@ -623,7 +617,7 @@ H5FD_multi_sb_size(H5FD_t *_file) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 16, 1999 @@ -706,7 +700,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 16, 1999 @@ -766,7 +760,8 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) buf += nseen * 2 * 8; if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen * 2, x, NULL, H5P_DEFAULT) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) - ap = (haddr_t *)x; + ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - + 2019/07/05, QAK */ UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; @@ -853,7 +848,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) * Return: Success: Ptr to new file access property list with all * members copied from the file struct. * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Friday, August 13, 1999 @@ -878,7 +873,7 @@ H5FD_multi_fapl_get(H5FD_t *_file) * * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -935,7 +930,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -973,7 +968,7 @@ H5FD_multi_fapl_free(void *_fa) * public fields will be initialized by the * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -983,11 +978,11 @@ H5FD_multi_fapl_free(void *_fa) static H5FD_t * H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_multi_t * file = NULL; - hid_t close_fapl = -1; - H5FD_multi_fapl_t *fa; - H5FD_mem_t m; - static const char *func = "H5FD_multi_open"; /* Function Name for error reporting */ + H5FD_multi_t * file = NULL; + hid_t close_fapl = -1; + const H5FD_multi_fapl_t *fa; + H5FD_mem_t m; + static const char * func = "H5FD_multi_open"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1076,7 +1071,7 @@ error: * * Return: Success: Non-negative * - * Failure: Negative with as many members closed as + * Failure: Negative with as many members closed as * possible. The only subsequent operation * permitted on the file is a close operation. * @@ -1137,8 +1132,7 @@ H5FD_multi_close(H5FD_t *_file) * * Return: Success: like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by th caller). * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1184,7 +1178,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Return: Success: non-negative * - * Failure: negative + * Failure: negative * * Programmer: Quincey Koziol * Tuesday, September 26, 2000 @@ -1213,7 +1207,7 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) * Purpose: Retrieve the memory type mapping for this file * * Return: Success: non-negative - * Failure: negative + * Failure: negative * * Programmer: Quincey Koziol * Tuesday, October 9, 2008 @@ -1240,19 +1234,11 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) * * Return: Success: The end-of-address-marker * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * If the TYPE is H5FD_MEM_DEFAULT, simply find the biggest - * EOA of individual file because the EOA for the whole file - * is meaningless. - * *------------------------------------------------------------------------- */ static haddr_t @@ -1341,22 +1327,11 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 10 January 2007 - * EOA for the whole file is discarded because it's meaningless - * for MULTI file. This function only sets eoa for individual - * file. - * - * Raymond Lu - * 21 June 2011 - * Backward compatibility of EOA. Please the comment in the - * code. *------------------------------------------------------------------------- */ static herr_t @@ -1408,7 +1383,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) * the end of the multi of files or the current * EOA, whichever is larger. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1508,7 +1483,7 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) * * Return: Success: Address of new memory * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Thursday, August 12, 1999 @@ -1555,7 +1530,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Thursday, August 12, 1999 @@ -1590,7 +1565,7 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi * Return: Success: Zero. Result is stored in caller-supplied * buffer BUF. * - * Failure: -1, contents of buffer BUF are undefined. + * Failure: -1, contents of buffer BUF are undefined. * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1639,7 +1614,7 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz * * Return: Success: Zero * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1686,7 +1661,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si * * Return: Success: 0 * - * Failure: -1, as many files flushed as possible. + * Failure: -1, as many files flushed as possible. * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1759,7 +1734,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) * Purpose: Truncates all multi members. * * Return: Success: 0 - * Failure: -1, as many files truncated as possible. + * Failure: -1, as many files truncated as possible. * * Programmer: Quincey Koziol * Thursday, January 31, 2008 @@ -1802,7 +1777,7 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 23, 1999 @@ -1844,7 +1819,7 @@ compute_next(H5FD_multi_t *file) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 23, 1999 diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 6c6e505..a88f109 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the "multi" driver. @@ -20,10 +20,6 @@ #ifndef H5FDmulti_H #define H5FDmulti_H -#include "H5Ipublic.h" -#include "H5Ppublic.h" /* Property lists */ -#include "H5Fpublic.h" - #define H5FD_MULTI (H5FD_multi_init()) #ifdef __cplusplus diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index aef56f9..4d0d5e2 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Thursday, January 3, 2008 * * Purpose: This file contains declarations which are visible only within @@ -52,7 +52,7 @@ H5_DLL haddr_t H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, hsi haddr_t *align_addr, hsize_t *align_size); H5_DLL herr_t H5FD_free_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, hsize_t size); -/* Testing routines */ +/* Testing functions */ #ifdef H5FD_TESTING #endif /* H5FD_TESTING */ diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 18fcfa2..e615ee6 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, July 26, 1999 */ #ifndef _H5FDpublic_H @@ -123,13 +123,13 @@ typedef enum H5F_mem_t H5FD_mem_t; /* Define VFL driver features that can be enabled on a per-driver basis */ /* These are returned with the 'query' function pointer in H5FD_class_t */ /* - * Defining the H5FD_FEAT_AGGREGATE_METADATA for a VFL driver means that + * Defining H5FD_FEAT_AGGREGATE_METADATA for a VFL driver means that * the library will attempt to allocate a larger block for metadata and * then sub-allocate each metadata request from that larger block. */ #define H5FD_FEAT_AGGREGATE_METADATA 0x00000001 /* - * Defining the H5FD_FEAT_ACCUMULATE_METADATA for a VFL driver means that + * Defining H5FD_FEAT_ACCUMULATE_METADATA for a VFL driver means that * the library will attempt to cache metadata as it is written to the file * and build up a larger block of metadata to eventually pass to the VFL * 'write' routine. @@ -145,7 +145,7 @@ typedef enum H5F_mem_t H5FD_mem_t; #define H5FD_FEAT_ACCUMULATE_METADATA \ (H5FD_FEAT_ACCUMULATE_METADATA_WRITE | H5FD_FEAT_ACCUMULATE_METADATA_READ) /* - * Defining the H5FD_FEAT_DATA_SIEVE for a VFL driver means that + * Defining H5FD_FEAT_DATA_SIEVE for a VFL driver means that * the library will attempt to cache raw data as it is read from/written to * a file in a "data seive" buffer. See Rajeev Thakur's papers: * http://www.mcs.anl.gov/~thakur/papers/romio-coll.ps.gz @@ -153,13 +153,13 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_DATA_SIEVE 0x00000008 /* - * Defining the H5FD_FEAT_AGGREGATE_SMALLDATA for a VFL driver means that + * Defining H5FD_FEAT_AGGREGATE_SMALLDATA for a VFL driver means that * the library will attempt to allocate a larger block for "small" raw data * and then sub-allocate "small" raw data requests from that larger block. */ #define H5FD_FEAT_AGGREGATE_SMALLDATA 0x00000010 /* - * Defining the H5FD_FEAT_IGNORE_DRVRINFO for a VFL driver means that + * Defining H5FD_FEAT_IGNORE_DRVRINFO for a VFL driver means that * the library will ignore the driver info that is encoded in the file * for the VFL driver. (This will cause the driver info to be eliminated * from the file when it is flushed/closed, if the file is opened R/W). @@ -173,13 +173,13 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_DIRTY_SBLK_LOAD 0x00000040 /* - * Defining the H5FD_FEAT_POSIX_COMPAT_HANDLE for a VFL driver means that + * Defining H5FD_FEAT_POSIX_COMPAT_HANDLE for a VFL driver means that * the handle for the VFD (returned with the 'get_handle' callback) is * of type 'int' and is compatible with POSIX I/O calls. */ #define H5FD_FEAT_POSIX_COMPAT_HANDLE 0x00000080 /* - * Defining the H5FD_FEAT_HAS_MPI for a VFL driver means that + * Defining H5FD_FEAT_HAS_MPI for a VFL driver means that * the driver makes use of MPI communication and code may retrieve * communicator/rank information from it */ @@ -191,13 +191,13 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_ALLOCATE_EARLY 0x00000200 /* - * Defining the H5FD_FEAT_ALLOW_FILE_IMAGE for a VFL driver means that + * Defining H5FD_FEAT_ALLOW_FILE_IMAGE for a VFL driver means that * the driver is able to use a file image in the fapl as the initial * contents of a file. */ #define H5FD_FEAT_ALLOW_FILE_IMAGE 0x00000400 /* - * Defining the H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS for a VFL driver + * Defining H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS for a VFL driver * means that the driver is able to use callbacks to make a copy of the * image to store in memory. */ diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 002b858..183fd58 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -13,11 +13,13 @@ /* * Read-Only S3 Virtual File Driver (VFD) * - * Programmer: Jacob Smith <jake.smith@hdfgroup.org> + * Programmer: Jacob Smith * 2017-10-13 * - * Purpose: Provide read-only access to files hosted on Amazon's S3 service. - * Relies on "s3comms" utility layer to implement the AWS REST API. + * Purpose: + * + * Provide read-only access to files hosted on Amazon's S3 service. + * Relies on "s3comms" utility layer to implement the AWS REST API. */ /* Interface initialization */ @@ -68,10 +70,11 @@ static hid_t H5FD_ROS3_g = 0; #define ROS3_STATS_START_POWER 10 #define ROS3_STATS_BIN_COUNT 16 /* MUST BE GREATER THAN 0 */ -/* +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Calculate `BASE ^ (START_POWER + (INTERVAL * bin_i))` * Stores result at `(unsigned long long *) out_ptr`. * Used in computing boundaries between stats bins. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define ROS3_STATS_POW(bin_i, out_ptr) \ { \ @@ -85,8 +88,7 @@ static hid_t H5FD_ROS3_g = 0; *(out_ptr) = donotshadowresult; \ } -/* array to hold pre-computed boundaries for stats bins - */ +/* array to hold pre-computed boundaries for stats bins */ static unsigned long long ros3_stats_boundaries[ROS3_STATS_BIN_COUNT]; /*************************************************************************** @@ -220,7 +222,7 @@ static int H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_ros3_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type); static herr_t H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static haddr_t H5FD_ros3_get_eof(const H5FD_t *_file); static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle); static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); @@ -279,6 +281,8 @@ H5FL_DEFINE_STATIC(H5FD_ros3_t); * Return: Success: The driver ID for the ros3 driver. * Failure: Negative * + * Programmer: Jacob Smith 2017 + * *------------------------------------------------------------------------- */ static herr_t @@ -305,13 +309,15 @@ H5FD_ros3_init_interface(void) hid_t H5FD_ros3_init(void) { - hid_t ret_value = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ +#if ROS3_STATS unsigned int bin_i; +#endif - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_init() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) @@ -322,6 +328,7 @@ H5FD_ros3_init(void) */ for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { unsigned long long value = 0; + ROS3_STATS_POW(bin_i, &value) ros3_stats_boundaries[bin_i] = value; } @@ -339,7 +346,7 @@ done: * * Purpose: Shut down the VFD * - * Returns: SUCCEED (Can't fail) + * Returns: <none> * * Programmer: Jacob Smith 2017 * @@ -351,7 +358,7 @@ H5FD_ros3_term(void) FUNC_ENTER_NOAPI_NOINIT_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_term() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* Reset VFL ID */ @@ -387,10 +394,11 @@ H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa) HDassert(fa != NULL); #if ROS3_DEBUG - HDfprintf(stdout, "H5Pset_fapl_ros3() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if (FAIL == H5FD_ros3_validate_config(fa)) @@ -403,12 +411,267 @@ done: } /* end H5Pset_fapl_ros3() */ /*------------------------------------------------------------------------- + * Function: H5FD_ros3_validate_config() + * + * Purpose: Test to see if the supplied instance of H5FD_ros3_fapl_t + * contains internally consistant data. Return SUCCEED if so, + * and FAIL otherwise. + * + * Note the difference between internally consistant and + * correct. As we will have to try to access the target + * object to determine whether the supplied data is correct, + * we will settle for internal consistancy at this point + * + * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally + * consistant data, FAIL otherwise. + * + * Programmer: Jacob Smith + * 9/10/17 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_validate_config(const H5FD_ros3_fapl_t *fa) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(fa != NULL); + + if (fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_ros3_fapl_t version"); + + /* if set to authenticate, region and id cannot be empty strings */ + if (fa->authenticate == TRUE) + if ((fa->aws_region[0] == '\0') || (fa->secret_id[0] == '\0')) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Inconsistent authentication information"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_ros3_validate_config() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_fapl_ros3 + * + * Purpose: Returns information about the ros3 file access property + * list though the function arguments. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: John Mainzer + * 9/10/17 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out) +{ + const H5FD_ros3_fapl_t *fa = NULL; + H5P_genplist_t * plist = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa_out); + +#if ROS3_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if (fa_out == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") + + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + + if (H5FD_ROS3 != H5P_get_driver(plist)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + + fa = (const H5FD_ros3_fapl_t *)H5P_get_driver_info(plist); + if (fa == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + + /* Copy the ros3 fapl data out */ + HDmemcpy(fa_out, fa, sizeof(H5FD_ros3_fapl_t)); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_fapl_ros3() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_fapl_get + * + * Purpose: Gets a file access property list which could be used to + * create an identical file. + * + * Return: Success: Ptr to new file access property list value. + * + * Failure: NULL + * + * Programmer: John Mainzer + * 9/8/17 + * + *------------------------------------------------------------------------- + */ +static void * +H5FD_ros3_fapl_get(H5FD_t *_file) +{ + H5FD_ros3_t * file = (H5FD_ros3_t *)_file; + H5FD_ros3_fapl_t *fa = NULL; + void * ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t)); + if (fa == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + /* Copy the fields of the structure */ + HDmemcpy(fa, &(file->fa), sizeof(H5FD_ros3_fapl_t)); + + /* Set return value */ + ret_value = fa; + +done: + if (ret_value == NULL) + if (fa != NULL) + H5MM_xfree(fa); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_ros3_fapl_get() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_fapl_copy + * + * Purpose: Copies the ros3-specific file access properties. + * + * Return: Success: Ptr to a new property list + * + * Failure: NULL + * + * Programmer: John Mainzer + * 9/8/17 + * + *------------------------------------------------------------------------- + */ +static void * +H5FD_ros3_fapl_copy(const void *_old_fa) +{ + const H5FD_ros3_fapl_t *old_fa = (const H5FD_ros3_fapl_t *)_old_fa; + H5FD_ros3_fapl_t * new_fa = NULL; + void * ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + new_fa = (H5FD_ros3_fapl_t *)H5MM_malloc(sizeof(H5FD_ros3_fapl_t)); + if (new_fa == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + HDmemcpy(new_fa, old_fa, sizeof(H5FD_ros3_fapl_t)); + ret_value = new_fa; + +done: + if (ret_value == NULL) + if (new_fa != NULL) + H5MM_xfree(new_fa); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_ros3_fapl_copy() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_fapl_free + * + * Purpose: Frees the ros3-specific file access properties. + * + * Return: SUCCEED (cannot fail) + * + * Programmer: John Mainzer + * 9/8/17 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_fapl_free(void *_fa) +{ + H5FD_ros3_fapl_t *fa = (H5FD_ros3_fapl_t *)_fa; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(fa != NULL); /* sanity check */ + + H5MM_xfree(fa); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD_ros3_fapl_free() */ + +#if ROS3_STATS +/*---------------------------------------------------------------------------- + * + * Function: ros3_reset_stats() + * + * Purpose: + * + * Reset the stats collection elements in this virtual file structure. + * + * Clears any set data in stats bins; initializes/zeroes values. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - Occurs if the file is invalid somehow + * + * Programmer: Jacob Smith + * 2017-12-08 + * + *---------------------------------------------------------------------------- + */ +static herr_t +ros3_reset_stats(H5FD_ros3_t *file) +{ + unsigned i = 0; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if ROS3_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if (file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null"); + + for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + file->raw[i].bytes = 0; + file->raw[i].count = 0; + file->raw[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; + file->raw[i].max = 0; + + file->meta[i].bytes = 0; + file->meta[i].count = 0; + file->meta[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; + file->meta[i].max = 0; + } + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end ros3_reset_stats() */ +#endif /* ROS3_STATS */ + +/*------------------------------------------------------------------------- + * * Function: H5FD_ros3_open() * - * Purpose: Create and/or opens a file as an HDF5 file. - * Any flag except H5F_ACC_RDONLY will cause an error. + * Purpose: + * + * Create and/or opens a file as an HDF5 file. * - * Name (as received from `H5FD_open()`) must conform to web url: + * Any flag except H5F_ACC_RDONLY will cause an error. + * + * Name (as received from `H5FD_open()`) must conform to web url: * NAME :: HTTP "://" DOMAIN [PORT] ["/" [URI] [QUERY] ] * HTTP :: "http" [ "s" ] * DOMAIN :: e.g., "mybucket.host.org" @@ -416,10 +679,13 @@ done: * URI :: <string> (e.g., "path/to/resource.hd5" ) * QUERY :: "?" <string> (e.g., "arg1=param1&arg2=param2") * - * Return: Success: A pointer to a new file data structure. - * The public fields will be initialized by the caller, which is - * always H5FD_open(). - * Failure: NULL + * Return: + * + * Success: A pointer to a new file data structure. + * The public fields will be initialized by the caller, which is + * always H5FD_open(). + * + * Failure: NULL * * Programmer: Jacob Smith * 2017-11-02 @@ -440,7 +706,7 @@ H5FD_ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) FUNC_ENTER_NOAPI_NOINIT #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_open() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* Sanity check on file offsets */ @@ -475,27 +741,23 @@ H5FD_ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while writing iso8601 timestamp") if (FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)fa.secret_key, - (const char *)fa.aws_region, (const char *)iso8601now)) { + (const char *)fa.aws_region, (const char *)iso8601now)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while computing signing key") - } handle = H5FD_s3comms_s3r_open(url, (const char *)fa.aws_region, (const char *)fa.secret_id, (const unsigned char *)signing_key); } - else { + else handle = H5FD_s3comms_s3r_open(url, NULL, NULL, NULL); - } /* if/else should authenticate */ - if (handle == NULL) { + if (handle == NULL) /* If we want to check CURL's say on the matter in a controlled * fashion, this is the place to do it, but would need to make a * few minor changes to s3comms `s3r_t` and `s3r_read()`. */ HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open"); - } - /* create new file struct - */ + /* create new file struct */ file = H5FL_CALLOC(H5FD_ros3_t); if (file == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") @@ -512,19 +774,297 @@ H5FD_ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) done: if (ret_value == NULL) { - if (handle != NULL) { + if (handle != NULL) if (FAIL == H5FD_s3comms_s3r_close(handle)) HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close s3 file handle") - } - if (file != NULL) { + if (file != NULL) file = H5FL_FREE(H5FD_ros3_t, file); - } curl_global_cleanup(); /* early cleanup because open failed */ } /* end if null return value (error) */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_ros3_open() */ +#if ROS3_STATS +/*---------------------------------------------------------------------------- + * + * Function: ros3_fprint_stats() + * + * Purpose: + * + * Tabulate and pretty-print statistics for this virtual file. + * + * Should be called upon file close. + * + * Shows number of reads and bytes read, broken down by + * "raw" (H5FD_MEM_DRAW) + * or "meta" (any other flag) + * + * Prints filename and listing of total number of reads and bytes read, + * both as a grand total and separate meta- and rawdata reads. + * + * If any reads were done, prints out two tables: + * + * 1. overview of raw- and metadata reads + * - min (smallest size read) + * - average of size read + * - k,M,G suffixes by powers of 1024 (2^10) + * - max (largest size read) + * 2. tabulation of "bins", sepraring reads into exponentially-larger + * ranges of size. + * - columns for number of reads, total bytes, and average size, with + * separate sub-colums for raw- and metadata reads. + * - each row represents one bin, identified by the top of its range + * + * Bin ranges can be modified with pound-defines at the top of this file. + * + * Bins without any reads in their bounds are not printed. + * + * An "overflow" bin is also present, to catch "big" reads. + * + * Output for all bins (and range ceiling and average size report) + * is divied by powers of 1024. By corollary, four digits before the decimal + * is valid. + * + * - 41080 bytes is represented by 40.177k, not 41.080k + * - 1004.831M represents approx. 1052642000 bytes + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - occurs if the file passed in is invalid + * - TODO: if stream is invalid? how can we check this? + * + * Programmer: Jacob Smith + * + *---------------------------------------------------------------------------- + */ +static herr_t +ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) +{ + herr_t ret_value = SUCCEED; + parsed_url_t * purl = NULL; + unsigned i = 0; + unsigned long count_meta = 0; + unsigned long count_raw = 0; + double average_meta = 0.0; + double average_raw = 0.0; + unsigned long long min_meta = (unsigned long long)ROS3_STATS_STARTING_MIN; + unsigned long long min_raw = (unsigned long long)ROS3_STATS_STARTING_MIN; + unsigned long long max_meta = 0; + unsigned long long max_raw = 0; + unsigned long long bytes_raw = 0; + unsigned long long bytes_meta = 0; + double re_dub = 0.0; /* re-usable double variable */ + unsigned suffix_i = 0; + const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'}; + + FUNC_ENTER_NOAPI_NOINIT + + if (stream == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null"); + if (file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null"); + if (file->s3r_handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "s3 request handle cannot be null"); + if (file->s3r_handle->purl == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parsed url structure cannot be null"); + purl = file->s3r_handle->purl; + + /****************** + * PRINT FILENAME * + ******************/ + + HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); + if (purl->port != NULL && purl->port[0] != '\0') + HDfprintf(stream, ":%s", purl->port); + if (purl->query != NULL && purl->query[0] != '\0') { + if (purl->path != NULL && purl->path[0] != '\0') + HDfprintf(stream, "/%s", purl->path); + else + HDfprintf(stream, "/"); + HDfprintf(stream, "?%s", purl->query); + } + else if (purl->path != NULL && purl->path[0] != '\0') { + HDfprintf(stream, "/%s", purl->path); + } + HDfprintf(stream, "\n"); + + /******************* + * AGGREGATE STATS * + *******************/ + + for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + const ros3_statsbin *r = &file->raw[i]; + const ros3_statsbin *m = &file->meta[i]; + + if (m->min < min_meta) + min_meta = m->min; + if (r->min < min_raw) + min_raw = r->min; + if (m->max > max_meta) + max_meta = m->max; + if (r->max > max_raw) + max_raw = r->max; + + count_raw += r->count; + count_meta += m->count; + bytes_raw += r->bytes; + bytes_meta += m->bytes; + } + if (count_raw > 0) + average_raw = (double)bytes_raw / (double)count_raw; + if (count_meta > 0) + average_meta = (double)bytes_meta / (double)count_meta; + + /****************** + * PRINT OVERVIEW * + ******************/ + + HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, + count_raw); + HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, + bytes_raw); + + if (count_raw + count_meta == 0) + goto done; + + /************************* + * PRINT AGGREGATE STATS * + *************************/ + + HDfprintf(stream, "SIZES meta raw\n"); + HDfprintf(stream, " min "); + if (count_meta == 0) + HDfprintf(stream, " 0.000 "); + else { + re_dub = (double)min_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + } + + if (count_raw == 0) + HDfprintf(stream, " 0.000 \n"); + else { + re_dub = (double)min_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + } + + HDfprintf(stream, " avg "); + re_dub = (double)average_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)average_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + HDfprintf(stream, " max "); + re_dub = (double)max_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)max_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + /****************************** + * PRINT INDIVIDUAL BIN STATS * + ******************************/ + + HDfprintf(stream, "BINS # of reads total bytes average size\n"); + HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); + + for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + const ros3_statsbin *m; + const ros3_statsbin *r; + unsigned long long range_end = 0; + char bm_suffix = ' '; /* bytes-meta */ + double bm_val = 0.0; + char br_suffix = ' '; /* bytes-raw */ + double br_val = 0.0; + char am_suffix = ' '; /* average-meta */ + double am_val = 0.0; + char ar_suffix = ' '; /* average-raw */ + double ar_val = 0.0; + + m = &file->meta[i]; + r = &file->raw[i]; + if (r->count == 0 && m->count == 0) + continue; + + range_end = ros3_stats_boundaries[i]; + + if (i == ROS3_STATS_BIN_COUNT) { + range_end = ros3_stats_boundaries[i - 1]; + HDfprintf(stream, ">"); + } + else + HDfprintf(stream, " "); + + bm_val = (double)m->bytes; + for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) + bm_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + bm_suffix = suffixes[suffix_i]; + + br_val = (double)r->bytes; + for (suffix_i = 0; br_val >= 1024.0; suffix_i++) + br_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + br_suffix = suffixes[suffix_i]; + + if (m->count > 0) + am_val = (double)(m->bytes) / (double)(m->count); + for (suffix_i = 0; am_val >= 1024.0; suffix_i++) + am_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + am_suffix = suffixes[suffix_i]; + + if (r->count > 0) + ar_val = (double)(r->bytes) / (double)(r->count); + for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) + ar_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + ar_suffix = suffixes[suffix_i]; + + re_dub = (double)range_end; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + + HDfprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, + suffixes[suffix_i], /* bin ceiling */ + m->count, /* metadata reads */ + r->count, /* rawdata reads */ + bm_val, bm_suffix, /* metadata bytes */ + br_val, br_suffix, /* rawdata bytes */ + am_val, am_suffix, /* metadata average */ + ar_val, ar_suffix); /* rawdata average */ + + HDfflush(stream); + } + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* ros3_fprint_stats */ +#endif /* ROS3_STATS */ + /*------------------------------------------------------------------------- * * Function: H5FD_ros3_close() @@ -551,36 +1091,31 @@ H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) FUNC_ENTER_NOAPI_NOINIT #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_close() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - /* Sanity checks - */ + /* Sanity checks */ HDassert(file != NULL); HDassert(file->s3r_handle != NULL); /* Close the underlying request handle */ - if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) { + if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle") - } #if ROS3_STATS /* TODO: mechanism to re-target stats printout */ - if (ros3_fprint_stats(stdout, file) == FAIL) { + if (ros3_fprint_stats(stdout, file) == FAIL) HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") - } #endif /* ROS3_STATS */ - /* Release the file info - */ + /* Release the file info */ file = H5FL_FREE(H5FD_ros3_t, file); done: curl_global_cleanup(); /* cleanup to answer init on open */ FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_ros3_close() */ /*------------------------------------------------------------------------- @@ -625,7 +1160,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_NOAPI_NOINIT_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_cmp() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif HDassert(f1->s3r_handle != NULL); @@ -641,96 +1176,75 @@ H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) HDassert(purl2->host != NULL); /* URL: SCHEME */ - if (HDstrcmp(purl1->scheme, purl2->scheme)) { - HGOTO_DONE(-1); - } + if (HDstrcmp(purl1->scheme, purl2->scheme)) + HGOTO_DONE(-1) /* URL: HOST */ - if (HDstrcmp(purl1->host, purl2->host)) { - HGOTO_DONE(-1); - } + if (HDstrcmp(purl1->host, purl2->host)) + HGOTO_DONE(-1) /* URL: PORT */ if (purl1->port && purl2->port) { - if (HDstrcmp(purl1->port, purl2->port)) { - HGOTO_DONE(-1); - } - } - else if (purl1->port) { - HGOTO_DONE(-1); - } - else if (purl2->port) { - HGOTO_DONE(-1); + if (HDstrcmp(purl1->port, purl2->port)) + HGOTO_DONE(-1) } + else if (purl1->port) + HGOTO_DONE(-1) + else if (purl2->port) + HGOTO_DONE(-1) /* URL: PATH */ if (purl1->path && purl2->path) { - if (HDstrcmp(purl1->path, purl2->path)) { - HGOTO_DONE(-1); - } - } - else if (purl1->path && !purl2->path) { - HGOTO_DONE(-1); - } - else if (purl2->path && !purl1->path) { - HGOTO_DONE(-1); + if (HDstrcmp(purl1->path, purl2->path)) + HGOTO_DONE(-1) } + else if (purl1->path && !purl2->path) + HGOTO_DONE(-1) + else if (purl2->path && !purl1->path) + HGOTO_DONE(-1) /* URL: QUERY */ if (purl1->query && purl2->query) { - if (HDstrcmp(purl1->query, purl2->query)) { - HGOTO_DONE(-1); - } - } - else if (purl1->query && !purl2->query) { - HGOTO_DONE(-1); - } - else if (purl2->query && !purl1->query) { - HGOTO_DONE(-1); + if (HDstrcmp(purl1->query, purl2->query)) + HGOTO_DONE(-1) } + else if (purl1->query && !purl2->query) + HGOTO_DONE(-1) + else if (purl2->query && !purl1->query) + HGOTO_DONE(-1) /* FAPL: AWS_REGION */ - if (f1->fa.aws_region[0] != '\0' && f1->fa.aws_region[0] != '\0') { - if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) { - HGOTO_DONE(-1); - } - } - else if (f1->fa.aws_region[0] != '\0') { - HGOTO_DONE(-1); - } - else if (f2->fa.aws_region[0] != '\0') { - HGOTO_DONE(-1); + if (f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') { + if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) + HGOTO_DONE(-1) } + else if (f1->fa.aws_region[0] != '\0') + HGOTO_DONE(-1) + else if (f2->fa.aws_region[0] != '\0') + HGOTO_DONE(-1) /* FAPL: SECRET_ID */ - if (f1->fa.secret_id[0] != '\0' && f1->fa.secret_id[0] != '\0') { - if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) { - HGOTO_DONE(-1); - } - } - else if (f1->fa.secret_id[0] != '\0') { - HGOTO_DONE(-1); - } - else if (f2->fa.secret_id[0] != '\0') { - HGOTO_DONE(-1); + if (f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') { + if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) + HGOTO_DONE(-1) } + else if (f1->fa.secret_id[0] != '\0') + HGOTO_DONE(-1) + else if (f2->fa.secret_id[0] != '\0') + HGOTO_DONE(-1) /* FAPL: SECRET_KEY */ - if (f1->fa.secret_key[0] != '\0' && f1->fa.secret_key[0] != '\0') { - if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) { - HGOTO_DONE(-1); - } - } - else if (f1->fa.secret_key[0] != '\0') { - HGOTO_DONE(-1); - } - else if (f2->fa.secret_key[0] != '\0') { - HGOTO_DONE(-1); + if (f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') { + if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) + HGOTO_DONE(-1) } + else if (f1->fa.secret_key[0] != '\0') + HGOTO_DONE(-1) + else if (f2->fa.secret_key[0] != '\0') + HGOTO_DONE(-1) done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_ros3_cmp() */ /*------------------------------------------------------------------------- @@ -758,7 +1272,7 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out FUNC_ENTER_NOAPI_NOINIT_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_query() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* Set the VFL feature flags that this driver supports */ @@ -769,7 +1283,6 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) - } /* H5FD_ros3_query() */ /*------------------------------------------------------------------------- @@ -799,11 +1312,10 @@ H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_NOAPI_NOINIT_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif FUNC_LEAVE_NOAPI(file->eoa) - } /* end H5FD_ros3_get_eoa() */ /*------------------------------------------------------------------------- @@ -831,13 +1343,12 @@ H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_NOAPI_NOINIT_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_set_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) - } /* H5FD_ros3_set_eoa() */ /*------------------------------------------------------------------------- @@ -859,18 +1370,17 @@ H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) *------------------------------------------------------------------------- */ static haddr_t -H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD_ros3_get_eof(const H5FD_t *_file) { const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_eof() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif FUNC_LEAVE_NOAPI(H5FD_s3comms_s3r_get_filesize(file->s3r_handle)) - } /* end H5FD_ros3_get_eof() */ /*------------------------------------------------------------------------- @@ -899,18 +1409,16 @@ H5FD_ros3_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handl FUNC_ENTER_NOAPI_NOINIT #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_handle() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - if (!file_handle) { + if (!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") - } *file_handle = file->s3r_handle; done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_ros3_get_handle() */ /*------------------------------------------------------------------------- @@ -936,10 +1444,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, /* start offset */ - size_t size, /* length of read */ - void * buf) /* out */ +H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, + size_t size, void *buf) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; size_t filesize = 0; @@ -953,7 +1459,7 @@ H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS FUNC_ENTER_NOAPI_NOINIT #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_read() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif HDassert(file != NULL); @@ -962,38 +1468,30 @@ H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS filesize = H5FD_s3comms_s3r_get_filesize(file->s3r_handle); - if ((addr > filesize) || ((addr + size) > filesize)) { + if ((addr > filesize) || ((addr + size) > filesize)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") - } - if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) { + if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") - } #if ROS3_STATS - /* Find which "bin" this read fits in. Can be "overflow" bin. - */ - for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { - if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) { + /* Find which "bin" this read fits in. Can be "overflow" bin. */ + for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) + if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) break; - } - } bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i]; - /* Store collected stats in appropriate bin - */ + /* Store collected stats in appropriate bin */ if (bin->count == 0) { bin->min = size; bin->max = size; } else { - if (size < bin->min) { + if (size < bin->min) bin->min = size; - } - if (size > bin->max) { + if (size > bin->max) bin->max = size; - } } bin->count++; bin->bytes += (unsigned long long)size; @@ -1002,7 +1500,6 @@ H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_ros3_read() */ /*------------------------------------------------------------------------- @@ -1032,14 +1529,13 @@ H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hi FUNC_ENTER_NOAPI_NOINIT #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_write() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file.") done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_ros3_write() */ /*------------------------------------------------------------------------- @@ -1070,14 +1566,13 @@ H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, h FUNC_ENTER_NOAPI_NOINIT #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_truncate() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file.") done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_ros3_truncate() */ /*------------------------------------------------------------------------- @@ -1105,8 +1600,8 @@ static herr_t H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(SUCCEED) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_ros3_lock() */ /*------------------------------------------------------------------------- @@ -1131,575 +1626,8 @@ static herr_t H5FD_ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file) { FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(SUCCEED) - -} /* end H5FD_ros3_unlock() */ - -/*------------------------------------------------------------------------- - * Function: H5FD_ros3_validate_config() - * - * Purpose: Test to see if the supplied instance of H5FD_ros3_fapl_t - * contains internally consistant data. Return SUCCEED if so, - * and FAIL otherwise. - * - * Note the difference between internally consistant and - * correct. As we will have to try to access the target - * object to determine whether the supplied data is correct, - * we will settle for internal consistancy at this point - * - * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally - * consistant data, FAIL otherwise. - * - * Programmer: Jacob Smith - * 9/10/17 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_ros3_validate_config(const H5FD_ros3_fapl_t *fa) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(fa != NULL); - - if (fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_ros3_fapl_t version"); - } - - /* if set to authenticate, region and id cannot be empty strings - */ - if (fa->authenticate == TRUE) { - if ((fa->aws_region[0] == '\0') || (fa->secret_id[0] == '\0')) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Inconsistent authentication information"); - } - } - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_validate_config() */ - -/*------------------------------------------------------------------------- - * Function: H5Pget_fapl_ros3 - * - * Purpose: Returns information about the ros3 file access property - * list though the function arguments. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: John Mainzer - * 9/10/17 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out) -{ - const H5FD_ros3_fapl_t *fa = NULL; - H5P_genplist_t * plist = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", fapl_id, fa_out); - -#if ROS3_DEBUG - HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n"); -#endif - - if (fa_out == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") - } - - plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - } - - if (H5FD_ROS3 != H5P_get_driver(plist)) { - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - } - - fa = (const H5FD_ros3_fapl_t *)H5P_get_driver_info(plist); - if (fa == NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - } - - /* Copy the ros3 fapl data out */ - HDmemcpy(fa_out, fa, sizeof(H5FD_ros3_fapl_t)); - -done: - FUNC_LEAVE_API(ret_value) - -} /* end H5Pget_fapl_ros3() */ - -/*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_get - * - * Purpose: Gets a file access property list which could be used to - * create an identical file. - * - * Return: Success: Ptr to new file access property list value. - * - * Failure: NULL - * - * Programmer: John Mainzer - * 9/8/17 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void * -H5FD_ros3_fapl_get(H5FD_t *_file) -{ - H5FD_ros3_t * file = (H5FD_ros3_t *)_file; - H5FD_ros3_fapl_t *fa = NULL; - void * ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT - - fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t)); - if (fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - } - - /* Copy the fields of the structure */ - HDmemcpy(fa, &(file->fa), sizeof(H5FD_ros3_fapl_t)); - - /* Set return value */ - ret_value = fa; - -done: - if (ret_value == NULL) { - if (fa != NULL) { - H5MM_xfree(fa); - } - } - FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_fapl_get() */ - -/*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_copy - * - * Purpose: Copies the ros3-specific file access properties. - * - * Return: Success: Ptr to a new property list - * - * Failure: NULL - * - * Programmer: John Mainzer - * 9/8/17 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void * -H5FD_ros3_fapl_copy(const void *_old_fa) -{ - const H5FD_ros3_fapl_t *old_fa = (const H5FD_ros3_fapl_t *)_old_fa; - H5FD_ros3_fapl_t * new_fa = NULL; - void * ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT - - new_fa = (H5FD_ros3_fapl_t *)H5MM_malloc(sizeof(H5FD_ros3_fapl_t)); - if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - } - - HDmemcpy(new_fa, old_fa, sizeof(H5FD_ros3_fapl_t)); - ret_value = new_fa; - -done: - if (ret_value == NULL) { - if (new_fa != NULL) { - H5MM_xfree(new_fa); - } - } - FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_fapl_copy() */ - -/*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_free - * - * Purpose: Frees the ros3-specific file access properties. - * - * Return: SUCCEED (cannot fail) - * - * Programmer: John Mainzer - * 9/8/17 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_ros3_fapl_free(void *_fa) -{ - H5FD_ros3_fapl_t *fa = (H5FD_ros3_fapl_t *)_fa; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(fa != NULL); /* sanity check */ - - H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) - -} /* end H5FD_ros3_fapl_free() */ - -#if ROS3_STATS - -/*---------------------------------------------------------------------------- - * - * Function: ros3_reset_stats() - * - * Purpose: - * - * Reset the stats collection elements in this virtual file structure. - * - * Clears any set data in stats bins; initializes/zeroes values. - * - * Return: - * - * - SUCCESS: `SUCCEED` - * - FAILURE: `FAIL` - * - Occurs if the file is invalid somehow - * - * Programmer: Jacob Smith - * 2017-12-08 - * - *---------------------------------------------------------------------------- - */ -static herr_t -ros3_reset_stats(H5FD_ros3_t *file) -{ - unsigned i = 0; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if ROS3_DEBUG - HDprintf("ros3_reset_stats() called\n"); -#endif - - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null"); - } - - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { - file->raw[i].bytes = 0; - file->raw[i].count = 0; - file->raw[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; - file->raw[i].max = 0; - - file->meta[i].bytes = 0; - file->meta[i].count = 0; - file->meta[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; - file->meta[i].max = 0; - } - -done: - FUNC_LEAVE_NOAPI(ret_value); - -} /* end ros3_reset_stats() */ - -#endif /* ROS3_STATS */ -#if ROS3_STATS - -/*---------------------------------------------------------------------------- - * - * Function: ros3_fprint_stats() - * - * Purpose: - * - * Tabulate and pretty-print statistics for this virtual file. - * - * Should be called upon file close. - * - * Shows number of reads and bytes read, broken down by - * "raw" (H5FD_MEM_DRAW) - * or "meta" (any other flag) - * - * Prints filename and listing of total number of reads and bytes read, - * both as a grand total and separate meta- and rawdata reads. - * - * If any reads were done, prints out two tables: - * - * 1. overview of raw- and metadata reads - * - min (smallest size read) - * - average of size read - * - k,M,G suffixes by powers of 1024 (2^10) - * - max (largest size read) - * 2. tabulation of "bins", sepraring reads into exponentially-larger - * ranges of size. - * - columns for number of reads, total bytes, and average size, with - * separate sub-colums for raw- and metadata reads. - * - each row represents one bin, identified by the top of its range - * - * Bin ranges can be modified with pound-defines at the top of this file. - * - * Bins without any reads in their bounds are not printed. - * - * An "overflow" bin is also present, to catch "big" reads. - * - * Output for all bins (and range ceiling and average size report) - * is divied by powers of 1024. By corollary, four digits before the decimal - * is valid. - * - * - 41080 bytes is represented by 40.177k, not 41.080k - * - 1004.831M represents approx. 1052642000 bytes - * - * Return: - * - * - SUCCESS: `SUCCEED` - * - FAILURE: `FAIL` - * - occurs if the file passed in is invalid - * - TODO: if stream is invalid? how can we check this? - * - * Programmer: Jacob Smith - * - *---------------------------------------------------------------------------- - */ -static herr_t -ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) -{ - herr_t ret_value = SUCCEED; - parsed_url_t * purl = NULL; - unsigned i = 0; - unsigned long count_meta = 0; - unsigned long count_raw = 0; - double average_meta = 0.0; - double average_raw = 0.0; - unsigned long long min_meta = (unsigned long long)ROS3_STATS_STARTING_MIN; - unsigned long long min_raw = (unsigned long long)ROS3_STATS_STARTING_MIN; - unsigned long long max_meta = 0; - unsigned long long max_raw = 0; - unsigned long long bytes_raw = 0; - unsigned long long bytes_meta = 0; - double re_dub = 0.0; /* re-usable double variable */ - unsigned suffix_i = 0; - const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'}; - - FUNC_ENTER_NOAPI_NOINIT - - if (stream == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null"); - } - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null"); - } - if (file->s3r_handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "s3 request handle cannot be null"); - } - if (file->s3r_handle->purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parsed url structure cannot be null"); - } - purl = file->s3r_handle->purl; - - /****************** - * PRINT FILENAME * - ******************/ - - HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); - if (purl->port != NULL && purl->port[0] != '\0') - HDfprintf(stream, ":%s", purl->port); - if (purl->query != NULL && purl->query[0] != '\0') { - if (purl->path != NULL && purl->path[0] != '\0') - HDfprintf(stream, "/%s", purl->path); - else - HDfprintf(stream, "/"); - HDfprintf(stream, "?%s", purl->query); - } - else if (purl->path != NULL && purl->path[0] != '\0') { - HDfprintf(stream, "/%s", purl->path); - } - HDfprintf(stream, "\n"); - - /******************* - * AGGREGATE STATS * - *******************/ - - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { - const ros3_statsbin *r = &file->raw[i]; - const ros3_statsbin *m = &file->meta[i]; - - if (m->min < min_meta) - min_meta = m->min; - if (r->min < min_raw) - min_raw = r->min; - if (m->max > max_meta) - max_meta = m->max; - if (r->max > max_raw) - max_raw = r->max; - - count_raw += r->count; - count_meta += m->count; - bytes_raw += r->bytes; - bytes_meta += m->bytes; - } - if (count_raw > 0) - average_raw = (double)bytes_raw / (double)count_raw; - if (count_meta > 0) - average_meta = (double)bytes_meta / (double)count_meta; - - /****************** - * PRINT OVERVIEW * - ******************/ - - HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, - count_raw); - HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, - bytes_raw); - - if (count_raw + count_meta == 0) - goto done; - - /************************* - * PRINT AGGREGATE STATS * - *************************/ - - HDfprintf(stream, "SIZES meta raw\n"); - HDfprintf(stream, " min "); - if (count_meta == 0) { - HDfprintf(stream, " 0.000 "); - } - else { - re_dub = (double)min_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) - re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); - } - - if (count_raw == 0) { - HDfprintf(stream, " 0.000 \n"); - } - else { - re_dub = (double)min_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) - re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - } - - HDfprintf(stream, " avg "); - re_dub = (double)average_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) - re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); - - re_dub = (double)average_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) - re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - - HDfprintf(stream, " max "); - re_dub = (double)max_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) - re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); - - re_dub = (double)max_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) - re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - - /****************************** - * PRINT INDIVIDUAL BIN STATS * - ******************************/ - - HDfprintf(stream, "BINS # of reads total bytes average size\n"); - HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); - - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { - const ros3_statsbin *m; - const ros3_statsbin *r; - unsigned long long range_end = 0; - char bm_suffix = ' '; /* bytes-meta */ - double bm_val = 0.0; - char br_suffix = ' '; /* bytes-raw */ - double br_val = 0.0; - char am_suffix = ' '; /* average-meta */ - double am_val = 0.0; - char ar_suffix = ' '; /* average-raw */ - double ar_val = 0.0; - - m = &file->meta[i]; - r = &file->raw[i]; - if (r->count == 0 && m->count == 0) - continue; - - range_end = ros3_stats_boundaries[i]; - - if (i == ROS3_STATS_BIN_COUNT) { - range_end = ros3_stats_boundaries[i - 1]; - HDfprintf(stream, ">"); - } - else { - HDfprintf(stream, " "); - } - - bm_val = (double)m->bytes; - for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) - bm_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - bm_suffix = suffixes[suffix_i]; - - br_val = (double)r->bytes; - for (suffix_i = 0; br_val >= 1024.0; suffix_i++) - br_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - br_suffix = suffixes[suffix_i]; - - if (m->count > 0) - am_val = (double)(m->bytes) / (double)(m->count); - for (suffix_i = 0; am_val >= 1024.0; suffix_i++) - am_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - am_suffix = suffixes[suffix_i]; - - if (r->count > 0) - ar_val = (double)(r->bytes) / (double)(r->count); - for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) - ar_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - ar_suffix = suffixes[suffix_i]; - - re_dub = (double)range_end; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) - re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - - HDfprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, - suffixes[suffix_i], /* bin ceiling */ - m->count, /* metadata reads */ - r->count, /* rawdata reads */ - bm_val, bm_suffix, /* metadata bytes */ - br_val, br_suffix, /* rawdata bytes */ - am_val, am_suffix, /* metadata average */ - ar_val, ar_suffix); /* rawdata average */ - - fflush(stream); - } - -done: - FUNC_LEAVE_NOAPI(ret_value); - -} /* ros3_fprint_stats */ -#endif /* ROS3_STATS */ +} /* end H5FD_ros3_unlock() */ #endif /* H5_HAVE_ROS3_VFD */ diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 378791c..4f967d59 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -111,20 +111,26 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle); /*************/ /*---------------------------------------------------------------------------- + * * Function: curlwritecallback() * * Purpose: + * * Function called by CURL to write received data. + * * Writes bytes to `userdata`. + * * Internally manages number of bytes processed. * * Return: + * * - Number of bytes processed. * - Should equal number of bytes passed to callback. * - Failure will result in curl error: CURLE_WRITE_ERROR. * * Programmer: Jacob Smith * 2017-08-17 + * *---------------------------------------------------------------------------- */ size_t @@ -147,10 +153,13 @@ curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata) } /* end curlwritecallback() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_hrb_node_set() * * Purpose: + * * Create, insert, modify, and remove elements in a field node list. + * * `name` cannot be null; will return FAIL and list will be unaltered. * * Entries are accessed via the lowercase representation of their name: @@ -162,6 +171,7 @@ curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata) * - NULL, if list is empty * * Types of operations: + * * - CREATE * - If `L` is NULL and `name` and `value` are not NULL, * a new node is created at `L`, starting a list. @@ -182,6 +192,7 @@ curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata) * alphabetically by lowercase name. * * Return: + * * - SUCCESS: `SUCCEED` * - List was successfully modified * - FAILURE: `FAIL` @@ -191,6 +202,7 @@ curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata) * * Programmer: Jacob Smith * 2017-09-22 + * *---------------------------------------------------------------------------- */ herr_t @@ -210,39 +222,37 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set.\n"); + HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set."); HDprintf("NAME: %s\n", name); HDprintf("VALUE: %s\n", value); HDprintf("LIST:\n->"); - for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) { + for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) HDfprintf(stdout, "{%s}\n->", node_ptr->cat); - } HDprintf("(null)\n"); - fflush(stdout); + HDfflush(stdout); node_ptr = NULL; #endif if (name == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to operate on null name.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to operate on null name"); namelen = HDstrlen(name); /*********************** * PREPARE ALL STRINGS * **********************/ - /* copy and lowercase name */ + /* copy and lowercase name + */ lowername = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); if (lowername == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for lowercase name copy.\n"); - + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for lowercase name copy."); for (i = 0; i < namelen; i++) - lowername[i] = (char)tolower((int)name[i]); - + lowername[i] = (char)HDtolower((int)name[i]); lowername[namelen] = 0; /* If value supplied, copy name, value, and concatenated "name: value". - * If NULL, we will be removing a node or doing nothing, so no need for copies + * If NULL, we will be removing a node or doing nothing, so no need for + * copies */ if (value != NULL) { int ret = 0; @@ -252,30 +262,27 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) namecpy = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); if (namecpy == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for name copy.\n"); - + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for name copy."); HDmemcpy(namecpy, name, (namelen + 1)); valuecpy = (char *)H5MM_malloc(sizeof(char) * (valuelen + 1)); if (valuecpy == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for value copy.\n"); - + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for value copy."); HDmemcpy(valuecpy, value, (valuelen + 1)); nvcat = (char *)H5MM_malloc(sizeof(char) * catwrite); if (nvcat == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for concatenated string.\n"); - + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for concatenated string."); ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value); if (ret < 0 || (size_t)ret > catlen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot concatenate `%s: %s", name, value); - HDassert(catlen == HDstrlen(nvcat)); - /* create new_node, should we need it */ + /* create new_node, should we need it + */ new_node = (hrb_node_t *)H5MM_malloc(sizeof(hrb_node_t)); if (new_node == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for new set.\n"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for new set."); new_node->magic = S3COMMS_HRB_NODE_MAGIC; new_node->name = NULL; @@ -290,13 +297,12 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) ***************/ if (*L == NULL) { - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list"); - } + if (value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list") else { #if S3COMMS_DEBUG HDprintf("CREATE NEW\n"); - fflush(stdout); + HDfflush(stdout); #endif /******************* * CREATE NEW LIST * @@ -312,60 +318,64 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) } } - /* sanity-check pointer passed in */ + /* sanity-check pointer passed in + */ HDassert((*L) != NULL); HDassert((*L)->magic == S3COMMS_HRB_NODE_MAGIC); node_ptr = (*L); - /* Check whether to modify/remove first node in list */ - if (strcmp(lowername, node_ptr->lowername) == 0) { + /* Check whether to modify/remove first node in list + */ + if (HDstrcmp(lowername, node_ptr->lowername) == 0) { + is_looking = FALSE; if (value == NULL) { #if S3COMMS_DEBUG HDprintf("REMOVE HEAD\n"); - fflush(stdout); + HDfflush(stdout); #endif /*************** * REMOVE HEAD * ***************/ + *L = node_ptr->next; #if S3COMMS_DEBUG HDprintf("FREEING CAT (node)\n"); - fflush(stdout); + HDfflush(stdout); #endif H5MM_xfree(node_ptr->cat); #if S3COMMS_DEBUG HDprintf("FREEING LOWERNAME (node)\n"); - fflush(stdout); + HDfflush(stdout); #endif H5MM_xfree(node_ptr->lowername); #if S3COMMS_DEBUG HDprintf("FREEING NAME (node)\n"); - fflush(stdout); + HDfflush(stdout); #endif H5MM_xfree(node_ptr->name); #if S3COMMS_DEBUG HDprintf("FREEING VALUE (node)\n"); - fflush(stdout); + HDfflush(stdout); #endif H5MM_xfree(node_ptr->value); #if S3COMMS_DEBUG HDprintf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); - fflush(stdout); + HDfflush(stdout); #endif HDassert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC); node_ptr->magic += 1ul; #if S3COMMS_DEBUG HDprintf("FREEING POINTER\n"); - fflush(stdout); + HDfflush(stdout); #endif H5MM_xfree(node_ptr); #if S3COMMS_DEBUG HDprintf("FREEING WORKING LOWERNAME\n"); - fflush(stdout); + HDfflush(stdout); #endif H5MM_xfree(lowername); lowername = NULL; @@ -373,7 +383,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG HDprintf("MODIFY HEAD\n"); - fflush(stdout); + HDfflush(stdout); #endif /*************** * MODIFY HEAD * @@ -394,20 +404,21 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) new_node = NULL; } } - else if (strcmp(lowername, node_ptr->lowername) < 0) { + else if (HDstrcmp(lowername, node_ptr->lowername) < 0) { + is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head"); - } + if (value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head") else { #if S3COMMS_DEBUG HDprintf("PREPEND NEW HEAD\n"); - fflush(stdout); + HDfflush(stdout); #endif /******************* * INSERT NEW HEAD * *******************/ + new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -420,23 +431,24 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) /*************** * SEARCH LIST * ***************/ + while (is_looking) { if (node_ptr->next == NULL) { is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); - } + if (value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node") else { #if S3COMMS_DEBUG HDprintf("APPEND A NODE\n"); - fflush(stdout); + HDfflush(stdout); #endif /******************* * APPEND NEW NODE * *******************/ - HDassert(strcmp(lowername, node_ptr->lowername) > 0); + + HDassert(HDstrcmp(lowername, node_ptr->lowername) > 0); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -444,21 +456,22 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) node_ptr->next = new_node; } } - else if (strcmp(lowername, node_ptr->next->lowername) < 0) { + else if (HDstrcmp(lowername, node_ptr->next->lowername) < 0) { + is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); - } + if (value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node") else { #if S3COMMS_DEBUG HDprintf("INSERT A NODE\n"); - fflush(stdout); + HDfflush(stdout); #endif /******************* * INSERT NEW NODE * *******************/ - HDassert(strcmp(lowername, node_ptr->lowername) > 0); + + HDassert(HDstrcmp(lowername, node_ptr->lowername) > 0); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -467,19 +480,21 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) node_ptr->next = new_node; } } - else if (strcmp(lowername, node_ptr->next->lowername) == 0) { + else if (HDstrcmp(lowername, node_ptr->next->lowername) == 0) { + is_looking = FALSE; if (value == NULL) { /***************** * REMOVE A NODE * *****************/ + hrb_node_t *tmp = node_ptr->next; node_ptr->next = tmp->next; #if S3COMMS_DEBUG HDprintf("REMOVE A NODE\n"); - fflush(stdout); + HDfflush(stdout); #endif H5MM_xfree(tmp->cat); H5MM_xfree(tmp->lowername); @@ -496,11 +511,12 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG HDprintf("MODIFY A NODE\n"); - fflush(stdout); + HDfflush(stdout); #endif /***************** * MODIFY A NODE * *****************/ + node_ptr = node_ptr->next; H5MM_xfree(node_ptr->name); H5MM_xfree(node_ptr->value); @@ -522,6 +538,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) /**************** * KEEP LOOKING * ****************/ + node_ptr = node_ptr->next; } } /* end while is_looking */ @@ -531,16 +548,12 @@ done: /* clean up */ if (nvcat != NULL) H5MM_xfree(nvcat); - if (namecpy != NULL) H5MM_xfree(namecpy); - if (lowername != NULL) H5MM_xfree(lowername); - if (valuecpy != NULL) H5MM_xfree(valuecpy); - if (new_node != NULL) { HDassert(new_node->magic == S3COMMS_HRB_NODE_MAGIC); new_node->magic += 1ul; @@ -552,9 +565,11 @@ done: } /* end H5FD_s3comms_hrb_node_set() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_hrb_destroy() * * Purpose: + * * Destroy and free resources _directly_ associated with an HTTP Buffer. * * Takes a pointer to pointer to the buffer structure. @@ -563,6 +578,7 @@ done: * If buffer or buffer pointer is NULL, there is no effect. * * Headers list at `first_header` is not touched. + * * - Programmer should re-use or destroy `first_header` pointer * (hrb_node_t *) as suits their purposes. * - Recommend fetching prior to destroy() @@ -572,6 +588,7 @@ done: * - Failure to account for this will result in a memory leak. * * Return: + * * - SUCCESS: `SUCCEED` * - successfully released buffer resources * - if `buf` is NULL or `*buf` is NULL, no effect @@ -580,6 +597,7 @@ done: * * Programmer: Jacob Smith * 2017-07-21 + * *---------------------------------------------------------------------------- */ herr_t @@ -596,9 +614,8 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) if (_buf != NULL && *_buf != NULL) { buf = *_buf; - if (buf->magic != S3COMMS_HRB_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pointer's magic does not match.\n"); - } + if (buf->magic != S3COMMS_HRB_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pointer's magic does not match."); H5MM_xfree(buf->verb); H5MM_xfree(buf->version); @@ -613,9 +630,11 @@ done: } /* end H5FD_s3comms_hrb_destroy() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_hrb_init_request() * * Purpose: + * * Create a new HTTP Request Buffer * * All non-null arguments should be null-terminated strings. @@ -623,17 +642,20 @@ done: * If `verb` is NULL, defaults to "GET". * If `http_version` is NULL, defaults to "HTTP/1.1". * - * `resource` cannot be NULL; should be string beginning with slash character ('/'). + * `resource` cannot be NULL; should be string beginning with slash + * character ('/'). * * All strings are copied into the structure, making them safe from * modification in source strings. * * Return: + * * - SUCCESS: pointer to new `hrb_t` * - FAILURE: `NULL` * * Programmer: Jacob Smith * 2017-07-21 + * *---------------------------------------------------------------------------- */ hrb_t * @@ -655,12 +677,11 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch #endif if (_resource == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "resource string cannot be null.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "resource string cannot be null."); /* populate valid NULLs with defaults */ if (_verb == NULL) _verb = "GET"; - if (_http_version == NULL) _http_version = "HTTP/1.1"; @@ -668,28 +689,24 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch request = (hrb_t *)H5MM_malloc(sizeof(hrb_t)); if (request == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for request structure"); - request->magic = S3COMMS_HRB_MAGIC; request->body = NULL; request->body_len = 0; request->first_header = NULL; - /* malloc and copy strings for the structure - */ + /* malloc and copy strings for the structure */ reslen = HDstrlen(_resource); if (_resource[0] == '/') { res = (char *)H5MM_malloc(sizeof(char) * (reslen + 1)); if (res == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); - HDmemcpy(res, _resource, (reslen + 1)); } else { res = (char *)H5MM_malloc(sizeof(char) * (reslen + 2)); if (res == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); - *res = '/'; HDmemcpy((&res[1]), _resource, (reslen + 1)); HDassert((reslen + 1) == HDstrlen(res)); @@ -699,14 +716,12 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch verb = (char *)H5MM_malloc(sizeof(char) * verblen); if (verb == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for verb string"); - HDstrncpy(verb, _verb, verblen); vrsnlen = HDstrlen(_http_version) + 1; vrsn = (char *)H5MM_malloc(sizeof(char) * vrsnlen); if (vrsn == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for http-version string"); - HDstrncpy(vrsn, _http_version, vrsnlen); /* place new copies into structure */ @@ -737,19 +752,24 @@ done: ****************************************************************************/ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_s3r_close() * * Purpose: + * * Close communications through given S3 Request Handle (`s3r_t`) * and clean up associated resources. * * Return: + * * - SUCCESS: `SUCCEED` * - FAILURE: `FAIL` * - fails if handle is null or has invalid magic number * + * * Programmer: Jacob Smith * 2017-08-31 + * *---------------------------------------------------------------------------- */ herr_t @@ -764,10 +784,9 @@ H5FD_s3comms_s3r_close(s3r_t *handle) #endif if (handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); if (handle->magic != S3COMMS_S3R_MAGIC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); curl_easy_cleanup(handle->curlhandle); @@ -788,18 +807,23 @@ done: } /* H5FD_s3comms_s3r_close */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_s3r_get_filesize() * * Purpose: + * * Retrieve the filesize of an open request handle. * * Wrapper "getter" to hide implementation details. * + * * Return: + * * - SUCCESS: size of file, in bytes, if handle is valid. * - FAILURE: 0, if handle is NULL or undefined. * * Programmer: Jacob Smith 2017-01-14 + * *---------------------------------------------------------------------------- */ size_t @@ -816,9 +840,11 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) } /* H5FD_s3comms_s3r_get_filesize */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_s3r_getsize() * * Purpose: + * * Get the number of bytes of handle's target resource. * * Sets handle and curlhandle with to enact an HTTP HEAD request on file, @@ -836,11 +862,13 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) * not to be trusted. * * Return: + * * - SUCCESS: `SUCCEED` * - FAILURE: `FAIL` * * Programmer: Jacob Smith * 2017-08-23 + * *---------------------------------------------------------------------------- */ herr_t @@ -850,9 +878,9 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) CURL * curlh = NULL; char * end = NULL; char * headerresponse = NULL; + struct s3r_datastruct sds = {S3COMMS_CALLBACK_DATASTRUCT_MAGIC, NULL, 0}; char * start = NULL; herr_t ret_value = SUCCEED; - struct s3r_datastruct sds = {S3COMMS_CALLBACK_DATASTRUCT_MAGIC, NULL, 0}; FUNC_ENTER_NOAPI_NOINIT @@ -861,41 +889,32 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) #endif if (handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); if (handle->magic != S3COMMS_S3R_MAGIC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); if (handle->curlhandle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.\n") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") /******************** * PREPARE FOR HEAD * ********************/ curlh = handle->curlhandle; - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, 1L)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_NOBODY). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY)."); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, &sds)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_HEADERDATA). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA)."); HDassert(handle->httpverb == NULL); handle->httpverb = (char *)H5MM_malloc(sizeof(char) * 16); if (handle->httpverb == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for S3 request HTTP verb"); - HDmemcpy(handle->httpverb, "HEAD", 5); headerresponse = (char *)H5MM_malloc(sizeof(char) * CURL_MAX_HTTP_HEADER); if (headerresponse == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for curl header response"); - sds.data = headerresponse; /******************* @@ -907,44 +926,40 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) * only http metadata will be sent by server and recorded by s3comms */ if (FAIL == H5FD_s3comms_s3r_read(handle, 0, 0, NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem in reading during getsize.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem in reading during getsize."); - if (sds.size > CURL_MAX_HTTP_HEADER) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun\n"); - } - else if (sds.size == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata\n"); + if (sds.size > CURL_MAX_HTTP_HEADER) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun") + else if (sds.size == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata") #if S3COMMS_DEBUG - } - else { + else HDfprintf(stderr, "GETSIZE: OK\n"); #endif - } /****************** * PARSE RESPONSE * ******************/ - start = strstr(headerresponse, "\r\nContent-Length: "); + start = HDstrstr(headerresponse, "\r\nContent-Length: "); if (start == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find \"Content-Length\" in response.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find \"Content-Length\" in response."); - /* move "start" to beginning of value in line; find end of line - */ + /* move "start" to beginning of value in line; find end of line */ start = start + HDstrlen("\r\nContent-Length: "); - end = strstr(start, "\r\n"); + end = HDstrstr(start, "\r\n"); if (end == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find end of content length line"); - /* place null terminator at end of numbers */ + /* place null terminator at end of numbers + */ *end = '\0'; - content_length = strtoumax((const char *)start, NULL, 0); - + content_length = HDstrtoumax((const char *)start, NULL, 0); if (UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n"); + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t"); - if (content_length == 0 || errno == ERANGE) /* errno set by strtoumax*/ + if (content_length == 0 || errno == ERANGE) /* errno set by HDstrtoumax*/ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert found \"Content-Length\" response (\"%s\")", start); /* range is null-terminated, remember */ @@ -955,16 +970,11 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) * UNDO HEAD SETTINGS * **********************/ - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, NULL)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_NOBODY). " - "(placeholder flags)"); - } + if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY)."); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_HEADERDATA). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA)."); done: H5MM_xfree(headerresponse); @@ -974,10 +984,13 @@ done: } /* H5FD_s3comms_s3r_getsize */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_s3r_open() * * Purpose: + * * Logically 'open' a file hosted on S3. + * * - create new Request Handle * - copy supplied url * - copy authentication info if supplied @@ -994,6 +1007,7 @@ done: * Uses `H5FD_s3comms_parse_url()` to validate and parse url input. * * Return: + * * - SUCCESS: Pointer to new request handle. * - FAILURE: NULL * - occurs if: @@ -1005,6 +1019,7 @@ done: * * Programmer: Jacob Smith * 2017-09-01 + * *---------------------------------------------------------------------------- */ s3r_t * @@ -1023,10 +1038,10 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const #endif if (url == NULL || url[0] == '\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "url cannot be null.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "url cannot be null."); - /* probably a malformed url, but could be internal error */ if (FAIL == H5FD_s3comms_parse_url(url, &purl)) + /* probably a malformed url, but could be internal error */ HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, "unable to create parsed url structure"); HDassert(purl != NULL); /* if above passes, this must be true */ @@ -1034,7 +1049,7 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const handle = (s3r_t *)H5MM_malloc(sizeof(s3r_t)); if (handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle."); handle->magic = S3COMMS_S3R_MAGIC; handle->purl = purl; @@ -1049,36 +1064,32 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const *************************************/ if ((region != NULL && *region != '\0') || (id != NULL && *id != '\0') || (signing_key != NULL)) { + /* if one exists, all three must exist */ if (region == NULL || region[0] == '\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "region cannot be null.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "region cannot be null."); if (id == NULL || id[0] == '\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "secret id cannot be null.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "secret id cannot be null."); if (signing_key == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "signing key cannot be null.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "signing key cannot be null."); /* copy strings */ tmplen = HDstrlen(region) + 1; handle->region = (char *)H5MM_malloc(sizeof(char) * tmplen); if (handle->region == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle region copy.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle region copy."); HDmemcpy(handle->region, region, tmplen); tmplen = HDstrlen(id) + 1; handle->secret_id = (char *)H5MM_malloc(sizeof(char) * tmplen); if (handle->secret_id == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle ID copy.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle ID copy."); HDmemcpy(handle->secret_id, id, tmplen); tmplen = SHA256_DIGEST_LENGTH; handle->signing_key = (unsigned char *)H5MM_malloc(sizeof(unsigned char) * tmplen); if (handle->signing_key == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy."); HDmemcpy(handle->signing_key, signing_key, tmplen); } /* if authentication information provided */ @@ -1087,34 +1098,23 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const ************************/ curlh = curl_easy_init(); - if (curlh == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem creating curl easy handle!\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem creating curl easy handle!"); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPGET, 1L)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_HTTPGET). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_HTTPGET)."); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_HTTP_VERSION). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_HTTP_VERSION)."); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_FAILONERROR, 1L)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_FAILONERROR). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_FAILONERROR)."); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_WRITEFUNCTION, curlwritecallback)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_WRITEFUNCTION). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_WRITEFUNCTION)."); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_URL, url)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_URL). " - "(placeholder flags)"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_URL)."); #if S3COMMS_CURL_VERBOSITY > 1 /* CURL will print (to stdout) information for each operation @@ -1131,7 +1131,7 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const *******************/ if (FAIL == H5FD_s3comms_s3r_getsize(handle)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem in H5FD_s3comms_s3r_getsize.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem in H5FD_s3comms_s3r_getsize."); /********************* * FINAL PREPARATION * @@ -1146,17 +1146,14 @@ done: if (ret_value == NULL) { if (curlh != NULL) curl_easy_cleanup(curlh); - if (FAIL == H5FD_s3comms_free_purl(purl)) HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to free parsed url structure") - if (handle != NULL) { H5MM_xfree(handle->region); H5MM_xfree(handle->secret_id); H5MM_xfree(handle->signing_key); if (handle->httpverb != NULL) H5MM_xfree(handle->httpverb); - H5MM_xfree(handle); } } @@ -1165,9 +1162,11 @@ done: } /* H5FD_s3comms_s3r_open */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_s3r_read() * * Purpose: + * * Read file pointed to by request handle, writing specified * `offset` .. `offset + len` bytes to buffer `dest`. * @@ -1194,11 +1193,13 @@ done: * from server. * * Return: + * * - SUCCESS: `SUCCEED` * - FAILURE: `FAIL` * * Programmer: Jacob Smith * 2017-08-22 + * *---------------------------------------------------------------------------- */ herr_t @@ -1213,7 +1214,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) char * rangebytesstr = NULL; hrb_t * request = NULL; int ret = 0; /* working variable to check */ - /* return value of HDsnprintf */ + /* return value of HDsnprintf */ struct s3r_datastruct *sds = NULL; herr_t ret_value = SUCCEED; @@ -1228,17 +1229,13 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) **************************************/ if (handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); if (handle->magic != S3COMMS_S3R_MAGIC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); if (handle->curlhandle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") if (handle->purl == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) url.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) url.") HDassert(handle->purl->magic == S3COMMS_PARSED_URL_MAGIC); if (offset > handle->filesize || (len + offset) > handle->filesize) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to read past EoF") @@ -1252,15 +1249,14 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (dest != NULL) { sds = (struct s3r_datastruct *)H5MM_malloc(sizeof(struct s3r_datastruct)); if (sds == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc destination datastructure.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc destination datastructure."); sds->magic = S3COMMS_CALLBACK_DATASTRUCT_MAGIC; sds->data = (char *)dest; sds->size = 0; if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_WRITEDATA, sds)) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, - "error while setting CURL option (CURLOPT_WRITEDATA). " - "(placeholder flags)"); + "error while setting CURL option (CURLOPT_WRITEDATA)."); } /********************* @@ -1270,8 +1266,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (len > 0) { rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1)); if (rangebytesstr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=" H5_PRINTF_HADDR_FMT "-" H5_PRINTF_HADDR_FMT, offset, offset + len - 1); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) @@ -1280,8 +1275,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) else if (offset > 0) { rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1)); if (rangebytesstr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=" H5_PRINTF_HADDR_FMT "-", offset); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) @@ -1293,12 +1287,12 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) *******************/ if (handle->signing_key == NULL) { - /* Do not authenticate. */ + /* Do not authenticate. */ if (rangebytesstr != NULL) { /* Pass in range directly */ char *bytesrange_ptr = NULL; /* pointer past "bytes=" portion */ - bytesrange_ptr = strchr(rangebytesstr, '='); + bytesrange_ptr = HDstrchr(rangebytesstr, '='); HDassert(bytesrange_ptr != NULL); bytesrange_ptr++; /* move to first char past '=' */ HDassert(*bytesrange_ptr != '\0'); @@ -1309,7 +1303,8 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) } } else { - /* authenticate request */ + /* authenticate request + */ char authorization[512 + 1]; /* 512 := approximate max length... * 67 <len("AWS4-HMAC-SHA256 Credential=///s3/aws4_request," @@ -1337,93 +1332,70 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) signed_headers[0] = 0; /**** VERIFY INFORMATION EXISTS ****/ - if (handle->region == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null region.\n"); if (handle->secret_id == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null secret_id.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null secret_id."); if (handle->signing_key == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null signing_key.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null signing_key."); if (handle->httpverb == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null httpverb.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null httpverb."); if (handle->purl->host == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null host.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null host."); if (handle->purl->path == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null resource.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null resource."); /**** CREATE HTTP REQUEST STRUCTURE (hrb_t) ****/ request = H5FD_s3comms_hrb_init_request((const char *)handle->httpverb, (const char *)handle->purl->path, "HTTP/1.1"); if (request == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not allocate hrb_t request.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not allocate hrb_t request."); HDassert(request->magic == S3COMMS_HRB_MAGIC); now = gmnow(); if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not format ISO8601 time.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not format ISO8601 time."); if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-date", (const char *)iso8601now)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-date header") - if (headers == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-content-sha256", (const char *)EMPTY_SHA256)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-content-sha256 header") - if (headers == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); if (rangebytesstr != NULL) { - if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Range", (const char *)rangebytesstr)) + if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Range", rangebytesstr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header") - if (headers == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); } - if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Host", (const char *)handle->purl->host)) + if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Host", handle->purl->host)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set host header") - if (headers == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); request->first_header = headers; /**** COMPUTE AUTHORIZATION ****/ - if (FAIL == H5FD_s3comms_aws_canonical_request(buffer1, 512, signed_headers, 48, request)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "(placeholder flags)\n"); + /* buffer1 -> canonical request */ + if (FAIL == H5FD_s3comms_aws_canonical_request(buffer1, 512, signed_headers, 48, request)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad canonical request"); /* buffer2->string-to-sign */ if (FAIL == H5FD_s3comms_tostringtosign(buffer2, buffer1, iso8601now, handle->region)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "(placeholder flags)\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad string-to-sign"); /* buffer1 -> signature */ if (FAIL == H5FD_s3comms_HMAC_SHA256(handle->signing_key, SHA256_DIGEST_LENGTH, buffer2, HDstrlen(buffer2), buffer1)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "(placeholder flags)\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad signature"); iso8601now[8] = 0; /* trim to yyyyMMDD */ ret = S3COMMS_FORMAT_CREDENTIAL(buffer2, handle->secret_id, iso8601now, handle->region, "s3"); @@ -1435,18 +1407,13 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (ret <= 0 || ret >= 512) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 authorization string"); - /* append authorization header to http request buffer - */ + /* append authorization header to http request buffer */ if (H5FD_s3comms_hrb_node_set(&headers, "Authorization", (const char *)authorization) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set Authorization header") - if (headers == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); - /* update hrb's "first header" pointer - */ + /* update hrb's "first header" pointer */ request->first_header = headers; /**** SET CURLHANDLE HTTP HEADERS FROM GENERATED DATA ****/ @@ -1456,25 +1423,19 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC); curlheaders = curl_slist_append(curlheaders, (const char *)node->cat); if (curlheaders == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not append header to curl slist. " - "(placeholder flags)\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not append header to curl slist."); node = node->next; } /* sanity-check */ - /* above loop was probably never run */ if (curlheaders == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "curlheaders was never populated.\n"); + /* above loop was probably never run */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "curlheaders was never populated."); - /* finally, set http headers in curl handle - */ + /* finally, set http headers in curl handle */ if (curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, curlheaders) != CURLE_OK) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option " - "(CURLOPT_HTTPHEADER). (placeholder flags)"); - + "error while setting CURL option (CURLOPT_HTTPHEADER)."); } /* end if should authenticate (info provided) */ /******************* @@ -1498,10 +1459,9 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (p_status != CURLE_OK) { if (CURLE_OK != curl_easy_getinfo(curlh, CURLINFO_RESPONSE_CODE, &httpcode)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem getting response code") - HDfprintf(stderr, "CURL ERROR CODE: %d\nHTTP CODE: %d\n", p_status, httpcode); HDfprintf(stderr, "%s\n", curl_easy_strerror(p_status)); - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "problem while performing request.\n"); + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "problem while performing request."); } if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem unsetting error buffer") @@ -1510,16 +1470,15 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) p_status = curl_easy_perform(curlh); if (p_status != CURLE_OK) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request\n") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request") #endif #if S3COMMS_DEBUG if (dest != NULL) { HDfprintf(stderr, "len: %d\n", (int)len); HDfprintf(stderr, "CHECKING FOR BUFFER OVERFLOW\n"); - if (sds == NULL) { + if (sds == NULL) HDfprintf(stderr, "sds is NULL!\n"); - } else { HDfprintf(stderr, "sds: 0x%lx\n", (long long)sds); HDfprintf(stderr, "sds->size: %d\n", (int)sds->size); @@ -1527,13 +1486,13 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HDfprintf(stderr, "buffer overwrite\n"); } } - else { + else HDfprintf(stderr, "performed on entire file\n"); - } #endif done: - /* clean any malloc'd resources */ + /* clean any malloc'd resources + */ if (curlheaders != NULL) { curl_slist_free_all(curlheaders); curlheaders = NULL; @@ -1550,7 +1509,6 @@ done: while (headers != NULL) if (FAIL == H5FD_s3comms_hrb_node_set(&headers, headers->name, NULL)) HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header node") - HDassert(NULL == headers); if (FAIL == H5FD_s3comms_hrb_destroy(&request)) HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header request structure") @@ -1575,17 +1533,21 @@ done: ****************************************************************************/ /*---------------------------------------------------------------------------- + * * Function: gmnow() * * Purpose: + * * Get the output of `time.h`'s `gmtime()` call while minimizing setup * clutter where important. * * Return: + * * Pointer to resulting `struct tm`,as created by gmtime(time_t * T). * * Programmer: Jacob Smith * 2017-07-12 + * *---------------------------------------------------------------------------- */ struct tm * @@ -1596,8 +1558,8 @@ gmnow(void) struct tm *ret_value = NULL; /* Doctor assert, checks against error in time() */ - if ((time_t)(-1) != time(now_ptr)) - ret_value = gmtime(now_ptr); + if ((time_t)(-1) != HDtime(now_ptr)) + ret_value = HDgmtime(now_ptr); HDassert(ret_value != NULL); @@ -1605,9 +1567,11 @@ gmnow(void) } /* end gmnow() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_aws_canonical_request() * * Purpose: + * * Compose AWS "Canonical Request" (and signed headers string) * as defined in the REST API documentation. * @@ -1616,6 +1580,7 @@ gmnow(void) * Destination string arguments must be provided with adequate space. * * Canonical Request format: + * * <HTTP VERB>"\n" * <resource path>"\n" * <query string>"\n" @@ -1628,6 +1593,7 @@ gmnow(void) * <hex-string of sha256sum of body> ("e3b0c4429...", e.g.) * * Return: + * * - SUCCESS: `SUCCEED` * - writes canonical request to respective `...dest` strings * - FAILURE: `FAIL` @@ -1636,6 +1602,7 @@ gmnow(void) * * Programmer: Jacob Smith * 2017-10-04 + * *---------------------------------------------------------------------------- */ herr_t @@ -1651,7 +1618,6 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c size_t cr_len = 0; /* working length of canonical request str */ size_t sh_len = 0; /* working length of signed headers str */ char tmpstr[256 + 1]; - tmpstr[256] = 0; /* terminating NULL */ /* "query params" refers to the optional element in the URL, e.g. @@ -1671,80 +1637,75 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c #endif if (http_request == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hrb object cannot be null.\n"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hrb object cannot be null."); HDassert(http_request->magic == S3COMMS_HRB_MAGIC); if (canonical_request_dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request destination cannot be null.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request destination cannot be null."); if (signed_headers_dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "signed headers destination cannot be null.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "signed headers destination cannot be null."); - /* HTTP verb, resource path, and query string lines - */ + /* HTTP verb, resource path, and query string lines */ cr_len = (HDstrlen(http_request->verb) + HDstrlen(http_request->resource) + HDstrlen(query_params) + (size_t)3); /* three newline chars */ if (cr_len >= cr_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); - - ret = HDsnprintf(/* TODO: compiler warning */ - canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", http_request->verb, + /* TODO: compiler warning */ + ret = HDsnprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", http_request->verb, http_request->resource, query_params); if (ret < 0 || (size_t)ret >= cr_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to compose canonical request first line"); - /* write in canonical headers, building signed headers concurrently - */ + /* write in canonical headers, building signed headers concurrently */ node = http_request->first_header; /* assumed sorted */ while (node != NULL) { + HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC); ret = HDsnprintf(tmpstr, 256, "%s:%s\n", node->lowername, node->value); if (ret < 0 || ret >= 256) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s", node->lowername, node->value); - cr_len += HDstrlen(tmpstr); if (cr_len + 1 > cr_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); - - strcat(canonical_request_dest, tmpstr); + HDstrcat(canonical_request_dest, tmpstr); ret = HDsnprintf(tmpstr, 256, "%s;", node->lowername); if (ret < 0 || ret >= 256) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to append semicolon to lowername %s", node->lowername); - sh_len += HDstrlen(tmpstr); if (sh_len + 1 > sh_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in signed headers"); - - strcat(signed_headers_dest, tmpstr); + HDstrcat(signed_headers_dest, tmpstr); node = node->next; } /* end while node is not NULL */ - /* remove tailing ';' from signed headers sequence */ + /* remove trailing ';' from signed headers sequence */ signed_headers_dest[HDstrlen(signed_headers_dest) - 1] = '\0'; /* append signed headers and payload hash * NOTE: at present, no HTTP body is handled, per the nature of * requests/range-gets */ - strcat(canonical_request_dest, "\n"); - strcat(canonical_request_dest, signed_headers_dest); - strcat(canonical_request_dest, "\n"); - strcat(canonical_request_dest, EMPTY_SHA256); + HDstrcat(canonical_request_dest, "\n"); + HDstrcat(canonical_request_dest, signed_headers_dest); + HDstrcat(canonical_request_dest, "\n"); + HDstrcat(canonical_request_dest, EMPTY_SHA256); done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_aws_canonical_request() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_bytes_to_hex() * * Purpose: + * * Produce human-readable hex string [0-9A-F] from sequence of bytes. * * For each byte (char), writes two-character hexadecimal representation. @@ -1758,6 +1719,7 @@ done: * `msg_len` message length of 0 has no effect. * * Return: + * * - SUCCESS: `SUCCEED` * - hex string written to `dest` (not null-terminated) * - FAILURE: `FAIL` @@ -1765,7 +1727,8 @@ done: * - `msg == NULL` * * Programmer: Jacob Smith - * 2017-07-12 * + * 2017-07-12 + * *---------------------------------------------------------------------------- */ herr_t @@ -1781,17 +1744,15 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len, #endif if (dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hex destination cannot be null.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hex destination cannot be null.") if (msg == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null.\n") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null.") for (i = 0; i < msg_len; i++) { int chars_written = HDsnprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */ (lowercase == TRUE) ? "%02x" : "%02X", msg[i]); - if (chars_written != 2) { + if (chars_written != 2) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem while writing hex chars for %c", msg[i]); - } } done: @@ -1799,18 +1760,22 @@ done: } /* end H5FD_s3comms_bytes_to_hex() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_free_purl() * * Purpose: + * * Release resources from a parsed_url_t pointer. * * If pointer is null, nothing happens. * * Return: + * * `SUCCEED` (never fails) * * Programmer: Jacob Smith * 2017-11-01 + * *---------------------------------------------------------------------------- */ herr_t @@ -1826,19 +1791,14 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) HDassert(purl->magic == S3COMMS_PARSED_URL_MAGIC); if (purl->scheme != NULL) H5MM_xfree(purl->scheme); - if (purl->host != NULL) H5MM_xfree(purl->host); - if (purl->port != NULL) H5MM_xfree(purl->port); - if (purl->path != NULL) H5MM_xfree(purl->path); - if (purl->query != NULL) H5MM_xfree(purl->query); - purl->magic += 1ul; H5MM_xfree(purl); } @@ -1847,9 +1807,11 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) } /* end H5FD_s3comms_free_purl() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_HMAC_SHA256() * * Purpose: + * * Generate Hash-based Message Authentication Checksum using the SHA-256 * hashing algorithm. * @@ -1862,6 +1824,7 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) * `dest` will _not_ be null-terminated by this function. * * Return: + * * - SUCCESS: `SUCCEED` * - hex string written to `dest` (not null-terminated) * - FAILURE: `FAIL` @@ -1870,6 +1833,7 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) * * Programmer: Jacob Smith * 2017-07-?? + * *---------------------------------------------------------------------------- */ herr_t @@ -1899,9 +1863,11 @@ done: } /* H5FD_s3comms_HMAC_SHA256 */ /*----------------------------------------------------------------------------- + * * Function: H5FD__s3comms_load_aws_creds_from_file() * * Purpose: + * * Extract AWS configuration information from a target file. * * Given a file and a profile name, e.g. "ros3_vfd_test", attempt to locate @@ -1931,6 +1897,7 @@ done: * when reading from multiple files. * * Return: + * * + SUCCESS: `SUCCEED` * + no error. settings may or may not have been loaded. * + FAILURE: `FAIL` @@ -1941,6 +1908,7 @@ done: * * Programmer: Jacob Smith * 2018-02-27 + * *----------------------------------------------------------------------------- */ static herr_t @@ -1974,34 +1942,29 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha /* format target line for start of profile */ if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label") /* look for start of profile */ do { /* clear buffer */ - for (buffer_i = 0; buffer_i < 128; buffer_i++) { + for (buffer_i = 0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - } line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) { /* reached end of file */ + if (line_buffer == NULL) /* reached end of file */ goto done; - } - } while (strncmp(line_buffer, profile_line, HDstrlen(profile_line))); + } while (HDstrncmp(line_buffer, profile_line, HDstrlen(profile_line))); /* extract credentials from lines */ do { /* clear buffer */ - for (buffer_i = 0; buffer_i < 128; buffer_i++) { + for (buffer_i = 0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - } /* collect a line from file */ line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) { - goto done; - /* end of file */ - } + if (line_buffer == NULL) + goto done; /* end of file */ /* loop over names to see if line looks like assignment */ for (setting_i = 0; setting_i < setting_count; setting_i++) { @@ -2012,7 +1975,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha setting_name = setting_names[setting_i]; setting_name_len = HDstrlen(setting_name); if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix") /* found a matching name? */ if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { @@ -2028,20 +1991,16 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha } while (*line_buffer != 0 && *line_buffer != '='); if (*line_buffer == 0 || *(line_buffer + 1) == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incomplete assignment in file"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incomplete assignment in file") line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ - if (HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, - HDstrlen(line_buffer)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to copy line into pointer"); + HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, HDstrlen(line_buffer)); /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; - while (!isspace(setting_pointers[setting_i][buffer_i])) { + while (!HDisspace(setting_pointers[setting_i][buffer_i])) buffer_i++; - } setting_pointers[setting_i][buffer_i] = '\0'; break; /* have read setting; don't compare with others */ @@ -2054,9 +2013,11 @@ done: } /* end H5FD__s3comms_load_aws_creds_from_file() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_load_aws_profile() * * Purpose : + * * Read aws profile elements from standard location on system and store * settings in memory. * @@ -2070,6 +2031,7 @@ done: * Settings are stored in the supplied buffers as null-terminated strings. * * Return: + * * + SUCCESS: `SUCCEED` (0) * + no error occurred and all settings were populated * + FAILURE: `FAIL` (-1) @@ -2079,6 +2041,7 @@ done: * * Programmer: Jacob Smith * 2018-02-27 + * *---------------------------------------------------------------------------- */ herr_t @@ -2104,38 +2067,32 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * #endif if (ret < 0 || (size_t)ret >= 117) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") - ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials"); if (ret < 0 || (size_t)ret >= 128) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path") - credfile = fopen(filepath, "r"); + credfile = HDfopen(filepath, "r"); if (credfile != NULL) { if (H5FD__s3comms_load_aws_creds_from_file(credfile, profile_name, key_id_out, secret_access_key_out, - aws_region_out) == FAIL) { + aws_region_out) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials") - } - if (fclose(credfile) == EOF) + if (HDfclose(credfile) == EOF) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file") - credfile = NULL; } /* end if credential file opened */ ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config"); if (ret < 0 || (size_t)ret >= 128) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path") - - credfile = fopen(filepath, "r"); + credfile = HDfopen(filepath, "r"); if (credfile != NULL) { if (H5FD__s3comms_load_aws_creds_from_file( credfile, profile_name, (*key_id_out == 0) ? key_id_out : NULL, (*secret_access_key_out == 0) ? secret_access_key_out : NULL, - (*aws_region_out == 0) ? aws_region_out : NULL) == FAIL) { + (*aws_region_out == 0) ? aws_region_out : NULL) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config") - } - if (fclose(credfile) == EOF) + if (HDfclose(credfile) == EOF) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file") - credfile = NULL; } /* end if credential file opened */ @@ -2144,18 +2101,19 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * ret_value = FAIL; done: - if (credfile != NULL) { - if (fclose(credfile) == EOF) { + if (credfile != NULL) + if (HDfclose(credfile) == EOF) HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file") - } - } + FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_load_aws_profile() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_nlowercase() * * Purpose: + * * From string starting at `s`, write `len` characters to `dest`, * converting all to lowercase. * @@ -2165,6 +2123,7 @@ done: * Provided as convenience. * * Return: + * * - SUCCESS: `SUCCEED` * - upon completion, `dest` is populated * - FAILURE: `FAIL` @@ -2172,6 +2131,7 @@ done: * * Programmer: Jacob Smith * 2017-09-18 + * *---------------------------------------------------------------------------- */ herr_t @@ -2186,13 +2146,13 @@ H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len) #endif if (dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.\n"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null."); if (len > 0) { HDmemcpy(dest, s, len); do { len--; - dest[len] = (char)tolower((int)dest[len]); + dest[len] = (char)HDtolower((int)dest[len]); } while (len > 0); } @@ -2201,9 +2161,11 @@ done: } /* end H5FD_s3comms_nlowercase() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_parse_url() * * Purpose: + * * Parse URL-like string and stuff URL components into * `parsed_url` structure, if possible. * @@ -2217,6 +2179,7 @@ done: * Empty or absent elements are NULL in new purl structure. * * Return: + * * - SUCCESS: `SUCCEED` * - `purl` pointer is populated * - FAILURE: `FAIL` @@ -2225,6 +2188,7 @@ done: * * Programmer: Jacob Smith * 2017-10-30 + * *---------------------------------------------------------------------------- */ herr_t @@ -2238,7 +2202,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) unsigned int i = 0; herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT; #if S3COMMS_DEBUG HDprintf("called H5FD_s3comms_parse_url.\n"); @@ -2252,7 +2216,6 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) purl = (parsed_url_t *)H5MM_malloc(sizeof(parsed_url_t)); if (purl == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for parsed_url_t"); - purl->magic = S3COMMS_PARSED_URL_MAGIC; purl->scheme = NULL; purl->host = NULL; @@ -2267,26 +2230,24 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) tmpstr = HDstrchr(curstr, ':'); if (tmpstr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL"); - len = tmpstr - curstr; HDassert((0 <= len) && (len < urllen)); /* check for restrictions */ for (i = 0; i < len; i++) { /* scheme = [a-zA-Z+-.]+ (terminated by ":") */ - if (!isalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && '.' != curstr[i]) + if (!HDisalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && '.' != curstr[i]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction"); } + /* copy lowercased scheme to structure */ purl->scheme = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->scheme == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for SCHEME"); - - (void)HDstrncpy(purl->scheme, curstr, (size_t)len); + HDstrncpy(purl->scheme, curstr, (size_t)len); purl->scheme[len] = '\0'; - for (i = 0; i < len; i++) { - purl->scheme[i] = (char)tolower(purl->scheme[i]); - } + for (i = 0; i < len; i++) + purl->scheme[i] = (char)HDtolower(purl->scheme[i]); /* Skip "://" */ tmpstr += 3; @@ -2299,9 +2260,9 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) if (*curstr == '[') { /* IPv6 */ while (']' != *tmpstr) { - if (tmpstr == 0) /* end of string reached! */ + /* end of string reached! */ + if (tmpstr == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reached end of URL: incomplete IPv6 HOST"); - tmpstr++; } tmpstr++; @@ -2310,24 +2271,20 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) while (0 != *tmpstr) { if (':' == *tmpstr || '/' == *tmpstr || '?' == *tmpstr) break; - tmpstr++; } } /* end else (IPv4) */ len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HOST substring cannot be empty"); - } - else if (len > urllen) { + if (len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HOST substring cannot be empty") + else if (len > urllen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of HOST substring"); - } /* copy host */ purl->host = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->host == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for HOST"); - - (void)HDstrncpy(purl->host, curstr, (size_t)len); + HDstrncpy(purl->host, curstr, (size_t)len); purl->host[len] = 0; /************* @@ -2337,29 +2294,22 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) if (':' == *tmpstr) { tmpstr += 1; /* advance past ':' */ curstr = tmpstr; - while ((0 != *tmpstr) && ('/' != *tmpstr) && ('?' != *tmpstr)) { + while ((0 != *tmpstr) && ('/' != *tmpstr) && ('?' != *tmpstr)) tmpstr++; - } len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT element cannot be empty"); - } - else if (len > urllen) { + if (len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT element cannot be empty") + else if (len > urllen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PORT substring"); - } - - for (i = 0; i < len; i++) { - if (!isdigit(curstr[i])) + for (i = 0; i < len; i++) + if (!HDisdigit(curstr[i])) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT is not a decimal string"); - } - /* copy port - */ + /* copy port */ purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->port == NULL) /* cannot malloc */ + if (purl->port == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PORT"); - - (void)HDstrncpy(purl->port, curstr, (size_t)len); + HDstrncpy(purl->port, curstr, (size_t)len); purl->port[len] = 0; } /* end if PORT element */ @@ -2372,21 +2322,17 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) tmpstr += 1; curstr = tmpstr; - /* seek end of PATH - */ - while ((0 != *tmpstr) && ('?' != *tmpstr)) { + /* seek end of PATH */ + while ((0 != *tmpstr) && ('?' != *tmpstr)) tmpstr++; - } len = tmpstr - curstr; if (len > urllen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PATH substring"); - if (len > 0) { purl->path = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->path == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PATH"); - /* cannot malloc path pointer */ - (void)HDstrncpy(purl->path, curstr, (size_t)len); + HDstrncpy(purl->path, curstr, (size_t)len); purl->path[len] = 0; } } /* end if PATH element */ @@ -2398,21 +2344,17 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) if ('?' == *tmpstr) { tmpstr += 1; curstr = tmpstr; - while (0 != *tmpstr) { + while (0 != *tmpstr) tmpstr++; - } len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "QUERY cannot be empty"); - } - else if (len > urllen) { + if (len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "QUERY cannot be empty") + else if (len > urllen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of QUERY substring"); - } purl->query = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->query == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for QUERY"); - /* cannot malloc path pointer */ - (void)HDstrncpy(purl->query, curstr, (size_t)len); + HDstrncpy(purl->query, curstr, (size_t)len); purl->query[len] = 0; } /* end if QUERY exists */ @@ -2427,9 +2369,11 @@ done: } /* end H5FD_s3comms_parse_url() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_percent_encode_char() * * Purpose: + * * "Percent-encode" utf-8 character `c`, e.g., * '$' -> "%24" * '¢' -> "%C2%A2" @@ -2452,6 +2396,7 @@ done: * `repr_len`. * * Return : SUCCEED/FAIL + * * - SUCCESS: `SUCCEED` * - percent-encoded representation written to `repr` * - 'repr' is null-terminated @@ -2459,6 +2404,7 @@ done: * - `c` or `repr` was NULL * * Programmer: Jacob Smith + * *---------------------------------------------------------------------------- */ herr_t @@ -2479,7 +2425,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr #endif if (repr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.\n") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.") #if S3COMMS_DEBUG H5FD_s3comms_bytes_to_hex((char *)hex, s, 1, FALSE); @@ -2498,10 +2444,10 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr chars_written = HDsnprintf(repr, 4, "%%%02X", c); if (chars_written < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); - } /* end if single-byte unicode char */ else { - /* multi-byte, multi-percent representation */ + /* multi-byte, multi-percent representation + */ unsigned int acc = 0; /* byte accumulator */ unsigned int k = 0; /* uint character representation */ unsigned int stack_size = 0; @@ -2513,7 +2459,8 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr k = (unsigned int)c; *repr_len = 0; do { - /* push number onto stack in six-bit slices */ + /* push number onto stack in six-bit slices + */ acc = k; acc >>= 6; /* cull least */ acc <<= 6; /* six bits */ @@ -2548,7 +2495,6 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr chars_written = HDsnprintf(repr, 4, "%%%02X", (unsigned char)(acc + stack[stack_size])); if (chars_written < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); - *repr_len += 3; /************************ @@ -2561,7 +2507,6 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr HDsnprintf(&repr[i * 3 + 3], 4, "%%%02X", (unsigned char)(0x80 + stack[stack_size - 1 - i])); if (chars_written < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); - *repr_len += 3; } /* end for each continuation byte */ } /* end else (multi-byte) */ @@ -2573,9 +2518,11 @@ done: } /* H5FD_s3comms_percent_encode_char */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_signing_key() * * Purpose: + * * Create AWS4 "Signing Key" from secret key, AWS region, and timestamp. * * Sequentially runs HMAC_SHA256 on strings in specified order, @@ -2597,6 +2544,7 @@ done: * Programmer must ensure that `md` is appropriately allocated. * * Return: + * * - SUCCESS: `SUCCEED` * - raw byte data of signing key written to `md` * - FAILURE: `FAIL` @@ -2604,6 +2552,7 @@ done: * * Programmer: Jacob Smith * 2017-07-13 + * *---------------------------------------------------------------------------- */ herr_t @@ -2624,21 +2573,18 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi #endif if (md == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Destination `md` cannot be NULL.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Destination `md` cannot be NULL.") if (secret == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`secret` cannot be NULL.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`secret` cannot be NULL.") if (region == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`region` cannot be NULL.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`region` cannot be NULL.") if (iso8601now == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL.\n") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL.") AWS4_secret_len = 4 + HDstrlen(secret) + 1; AWS4_secret = (char *)H5MM_malloc(sizeof(char *) * AWS4_secret_len); if (AWS4_secret == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space.\n") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space.") /* prepend "AWS4" to start of the secret key */ ret = HDsnprintf(AWS4_secret, AWS4_secret_len, "%s%s", "AWS4", secret); @@ -2665,9 +2611,11 @@ done: } /* end H5FD_s3comms_signing_key() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_tostringtosign() * * Purpose: + * * Get AWS "String to Sign" from Canonical Request, timestamp, * and AWS "region". * @@ -2686,6 +2634,7 @@ done: * It is left to programmer to ensure `dest` has adequate space. * * Return: + * * - SUCCESS: `SUCCEED` * - "string to sign" written to `dest` and null-terminated * - FAILURE: `FAIL` @@ -2694,6 +2643,7 @@ done: * * Programmer: Jacob Smith * 2017-07-?? + * *---------------------------------------------------------------------------- */ herr_t @@ -2715,20 +2665,16 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const #endif if (dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer cannot be null.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer cannot be null.") if (req == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request cannot be null.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request cannot be null.") if (now == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Timestring cannot be NULL.\n") - + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Timestring cannot be NULL.") if (region == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Region cannot be NULL.\n") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Region cannot be NULL.") - for (i = 0; i < 128; i++) { + for (i = 0; i < 128; i++) tmp[i] = '\0'; - } for (i = 0; i < SHA256_DIGEST_LENGTH * 2 + 1; i++) { checksum[i] = '\0'; hexsum[i] = '\0'; @@ -2756,9 +2702,8 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not create hex string"); - for (i = 0; i < SHA256_DIGEST_LENGTH * 2; i++) { + for (i = 0; i < SHA256_DIGEST_LENGTH * 2; i++) dest[d++] = hexsum[i]; - } dest[d] = '\0'; @@ -2767,6 +2712,7 @@ done: } /* end H5ros3_tostringtosign() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_trim() * * Purpose: @@ -2784,12 +2730,14 @@ done: * is set to 0. * * Return: + * * - SUCCESS: `SUCCEED` * - FAILURE: `FAIL` * - `dest == NULL` * * Programmer: Jacob Smith * 2017-09-18 + * *---------------------------------------------------------------------------- */ herr_t @@ -2805,7 +2753,6 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) if (dest == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.") - if (s == NULL) s_len = 0; @@ -2813,7 +2760,7 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) /* Find first non-whitespace character from start; * reduce total length per character. */ - while ((s_len > 0) && isspace((unsigned char)s[0]) && s_len > 0) { + while ((s_len > 0) && HDisspace((unsigned char)s[0]) && s_len > 0) { s++; s_len--; } @@ -2825,11 +2772,10 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) if (s_len > 0) { do { s_len--; - } while (isspace((unsigned char)s[s_len])); + } while (HDisspace((unsigned char)s[s_len])); s_len++; - /* write output into dest - */ + /* write output into dest */ HDmemcpy(dest, s, s_len); } } @@ -2841,9 +2787,11 @@ done: } /* end H5FD_s3comms_trim() */ /*---------------------------------------------------------------------------- + * * Function: H5FD_s3comms_uriencode() * * Purpose: + * * URIencode (percent-encode) every byte except "[a-zA-Z0-9]-._~". * * For each character in source string `_s` from `s[0]` to `s[s_len-1]`, @@ -2865,6 +2813,7 @@ done: * `s_len == 0` will have no effect. * * Return: + * * - SUCCESS: `SUCCEED` * - FAILURE: `FAIL` * - source strings `s` or destination `dest` are NULL @@ -2872,6 +2821,7 @@ done: * * Programmer: Jacob Smith * 2017-07-?? + * *---------------------------------------------------------------------------- */ herr_t @@ -2893,7 +2843,6 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s if (s == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source string cannot be NULL"); - if (dest == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be NULL"); @@ -2903,10 +2852,9 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s */ for (s_off = 0; s_off < s_len; s_off++) { c = s[s_off]; - if (isalnum(c) || c == '.' || c == '-' || c == '_' || c == '~' || - (c == '/' && encode_slash == FALSE)) { + if (HDisalnum(c) || c == '.' || c == '-' || c == '_' || c == '~' || + (c == '/' && encode_slash == FALSE)) dest[dest_off++] = c; - } else { hex_off = 0; if (H5FD_s3comms_percent_encode_char(hex_buffer, (const unsigned char)c, &hex_len) == FAIL) { @@ -2918,9 +2866,8 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s hex_buffer, (int)s_off, s); } - for (hex_off = 0; hex_off < hex_len; hex_off++) { + for (hex_off = 0; hex_off < hex_len; hex_off++) dest[dest_off++] = hex_buffer[hex_off]; - } } /* end else (not a regular character) */ } /* end for each character */ diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 6bd3232..5d939f8 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -52,9 +52,6 @@ * *****************************************************************************/ -#ifndef H5FDs3comms_H -#define H5FDs3comms_H - #include "H5private.h" /* Generic Functions */ #ifdef H5_HAVE_ROS3_VFD @@ -563,5 +560,3 @@ H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hb #endif #endif /* H5_HAVE_ROS3_VFD */ - -#endif /* ifndef H5FDs3comms_H */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index aedabe7..54d7cbb 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Purpose: The POSIX unbuffered file driver using only the HDF5 public @@ -194,8 +194,8 @@ H5FD_sec2_init_interface(void) * Purpose: Initialize this driver by registering the driver with the * library. * - * Return: Success: The driver ID for the sec2 driver. - * Failure: Negative + * Return: Success: The driver ID for the sec2 driver + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, July 29, 1999 @@ -205,9 +205,9 @@ H5FD_sec2_init_interface(void) hid_t H5FD_sec2_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) if (H5I_VFL != H5I_get_type(H5FD_SEC2_g)) H5FD_SEC2_g = H5FD_register(&H5FD_sec2_g, sizeof(H5FD_class_t), FALSE); @@ -299,7 +299,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif h5_stat_t sb; - H5FD_t * ret_value; /* Return value */ + H5FD_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -681,7 +681,6 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS * and the end of the file. */ while (size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ @@ -782,7 +781,6 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU * results */ while (size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h index 8a9b10a..4d6ee35 100644 --- a/src/H5FDsec2.h +++ b/src/H5FDsec2.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the sec2 driver. @@ -20,8 +20,6 @@ #ifndef H5FDsec2_H #define H5FDsec2_H -#include "H5Ipublic.h" - #define H5FD_SEC2 (H5FD_sec2_init()) #ifdef __cplusplus diff --git a/src/H5FDspace.c b/src/H5FDspace.c index f0be674..051209b 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -15,9 +15,9 @@ * * Created: H5FDspace.c * Jan 3 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * - * Purpose: Space allocation routines for the file. + * Purpose: Space allocation routines for the file driver code. * *------------------------------------------------------------------------- */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 73218f0..f78c823 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Wednesday, October 22, 1997 * * Purpose: The C STDIO virtual file driver which only uses calls from stdio.h. @@ -436,7 +436,7 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr file->inode = sb.st_ino; #endif /* H5_HAVE_WIN32_API */ - return (H5FD_t *)file; + return ((H5FD_t *)file); } /* end H5FD_stdio_open() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h index 0a4e560..6239a6e 100644 --- a/src/H5FDstdio.h +++ b/src/H5FDstdio.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the sec2 driver. diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h index 249ee5c..7e759b7 100644 --- a/src/H5FDwindows.h +++ b/src/H5FDwindows.h @@ -12,8 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Scott Wegner <swegner@hdfgroup.org> - * Based on code by Robb Matzke + * Programmer: Scott Wegner + * Based on code by Robb Matzke * Thursday, May 24 2007 * * Purpose: The public header file for the windows driver. @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, March 23, 2000 * * Purpose: Manage priority queues of free-lists (of blocks of bytes). @@ -180,14 +180,12 @@ H5FL_init_interface(void) * Programmer: Quincey Koziol * Tuesday, August 1, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * H5FL_malloc(size_t mem_size) { - void *ret_value; /* return value*/ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -218,8 +216,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -262,14 +258,11 @@ done: * * Purpose: Release an object & put on free list * - * Return: Success: Non-negative - * Failure: Negative + * Return: Always returns NULL * * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -354,14 +347,12 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to object to return */ FUNC_ENTER_NOAPI(NULL) @@ -430,14 +421,12 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to object to return */ FUNC_ENTER_NOAPI(NULL) @@ -467,8 +456,6 @@ done: * Programmer: Quincey Koziol * Tuesday, July 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -517,10 +504,6 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * Broke into two parts, one for looping over all the free lists and - * another for freeing each list - QAK 7/25/00 - * *------------------------------------------------------------------------- */ static herr_t @@ -636,14 +619,12 @@ H5FL_reg_term(void) * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) { - H5FL_blk_node_t *temp; /* Temp. pointer to node in the native list */ + H5FL_blk_node_t *temp = NULL; /* Temp. pointer to node in the native list */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -696,15 +677,13 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size) { - H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ - H5FL_blk_node_t *ret_value; + H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ + H5FL_blk_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -746,8 +725,6 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -788,15 +765,13 @@ done: * Programmer: Quincey Koziol * Monday, December 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) { - H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ - htri_t ret_value; /* Return value */ + H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -827,16 +802,14 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) { - H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ - H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */ - void * ret_value; /* Pointer to the block to return to the user */ + H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ + H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */ + void * ret_value = NULL; /* Pointer to the block to return to the user */ FUNC_ENTER_NOAPI(NULL) @@ -862,7 +835,6 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) /* Decrement the amount of global "block" free list memory in use */ H5FL_blk_gc_head.mem_freed -= size; - } /* end if */ /* No free list available, or there are no nodes on the list, allocate a new node to give to the user */ else { @@ -918,14 +890,12 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to the block to return to the user */ + void *ret_value = NULL; /* Pointer to the block to return to the user */ FUNC_ENTER_NOAPI(NULL) @@ -958,8 +928,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1015,7 +983,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) HDmemset(temp, 255, free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE); #endif /* H5FL_DEBUG */ - /* check if there is a free list for native blocks of this size */ + /* Check if there is a free list for native blocks of this size */ if ((free_list = H5FL_blk_find_list(&(head->head), free_size)) == NULL) { /* No free list available, create a new list node and insert it to the queue */ free_list = H5FL_blk_create_list(&(head->head), free_size); @@ -1063,8 +1031,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1137,8 +1103,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1200,8 +1164,6 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1263,8 +1225,8 @@ H5FL_blk_term(void) tmp = H5FL_blk_gc_head.first->next; #ifdef H5FL_DEBUG - printf("H5FL_blk_term: head->name=%s, head->allocated=%d\n", H5FL_blk_gc_head.first->pq->name, - (int)H5FL_blk_gc_head.first->pq->allocated); + HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, + (int)H5FL_blk_gc_head.first->pq->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ @@ -1303,8 +1265,6 @@ H5FL_blk_term(void) * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1354,8 +1314,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1434,16 +1392,14 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) { - H5FL_arr_list_t *new_obj; /* Pointer to the new free list node allocated */ - void * ret_value; /* Pointer to object to return */ - size_t mem_size; /* Size of memory block being recycled */ + H5FL_arr_list_t *new_obj; /* Pointer to the new free list node allocated */ + size_t mem_size; /* Size of memory block being recycled */ + void * ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1508,14 +1464,12 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1545,14 +1499,12 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1607,8 +1559,6 @@ done: * Programmer: Quincey Koziol * Tuesday, July 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1668,8 +1618,6 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1732,8 +1680,8 @@ H5FL_arr_term(void) /* Check if the list has allocations outstanding */ #ifdef H5FL_DEBUG - printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.first->list->name, - (int)H5FL_arr_gc_head.first->list->allocated); + HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, + (int)H5FL_arr_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ if (H5FL_arr_gc_head.first->list->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ @@ -1772,8 +1720,6 @@ H5FL_arr_term(void) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1807,14 +1753,12 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1840,14 +1784,12 @@ done: * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1873,14 +1815,12 @@ done: * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1906,19 +1846,14 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ H5FL_fac_head_t * H5FL_fac_init(size_t size) { - H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */ - H5FL_fac_head_t * factory = NULL; /* Pointer to new block factory */ - H5FL_fac_head_t * ret_value; /* Return value */ + H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */ + H5FL_fac_head_t * factory = NULL; /* Pointer to new block factory */ + H5FL_fac_head_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1982,11 +1917,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2070,11 +2000,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2146,17 +2071,12 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ /* NOINIT OK here because this must be called after H5FL_fac_init -NAF */ FUNC_ENTER_NOAPI_NOINIT @@ -2187,8 +2107,6 @@ done: * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -2237,8 +2155,6 @@ H5FL_fac_gc_list(H5FL_fac_head_t *head) * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -2278,11 +2194,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ herr_t @@ -2344,8 +2255,6 @@ done: * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -2390,8 +2299,6 @@ H5FL_fac_term_all(void) * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2446,10 +2353,6 @@ done: * Programmer: Quincey Koziol * Wednesday, August 2, 2000 * - * Modifications: Neil Fortner - * Wednesday, April 8, 2009 - * Added support for factory free lists - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index b609d7b..2655c29 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -15,12 +15,10 @@ * * Created: H5FLprivate.h * Mar 23 2000 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Private non-prototype header. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5FLprivate_H @@ -189,10 +187,10 @@ typedef struct H5FL_blk_head_t { /* Declare a static free list to manage objects of type 't' */ #define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t) -/* Allocate an block of type 't' */ +/* Allocate a block of type 't' */ #define H5FL_BLK_MALLOC(t, size) (uint8_t *)H5FL_blk_malloc(&(H5FL_BLK_NAME(t)), size H5FL_TRACK_INFO) -/* Allocate an block of type 't' and clear it to zeros */ +/* Allocate a block of type 't' and clear it to zeros */ #define H5FL_BLK_CALLOC(t, size) (uint8_t *)H5FL_blk_calloc(&(H5FL_BLK_NAME(t)), size H5FL_TRACK_INFO) /* Free a block of type 't' */ @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * - * Note: (Used to be in the H5HFflist.c file, prior to the date above) + * Note: (Used to be in the H5HFflist.c file, prior to the date above) * */ @@ -30,11 +30,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5MFprivate.h" /* File memory management */ /****************/ /* Local Macros */ @@ -75,29 +75,24 @@ H5FL_DEFINE(H5FS_t); /*******************/ /*------------------------------------------------------------------------- - * Function: H5FS_create - * - * Purpose: Allocate & initialize file free space info + * Function: H5FS_create * - * Return: Success: Pointer to free space structure + * Purpose: Allocate & initialize file free space info * - * Failure: NULL + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr, const H5FS_create_t *fs_create, size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { - H5FS_t *fspace = NULL; /* New free space structure */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *fspace = NULL; /* New free space structure */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG @@ -162,31 +157,25 @@ done: } /* H5FS_create() */ /*------------------------------------------------------------------------- - * Function: H5FS_open - * - * Purpose: Open an existing file free space info structure on disk + * Function: H5FS_open * - * Return: Success: Pointer to free space structure + * Purpose: Open an existing file free space info structure on disk * - * Failure: NULL + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * - * Modfications: - * - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { - H5FS_t * fspace = NULL; /* New free space structure */ - H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - H5FS_t * ret_value; /* Return value */ + H5FS_t * fspace = NULL; /* New free space structure */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + H5FS_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG @@ -238,15 +227,13 @@ done: } /* H5FS_open() */ /*------------------------------------------------------------------------- - * Function: H5FS_delete - * - * Purpose: Delete a free space manager on disk + * Function: H5FS_delete * - * Return: Success: non-negative + * Purpose: Delete a free space manager on disk * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -334,16 +321,14 @@ done: } /* H5FS_delete() */ /*------------------------------------------------------------------------- - * Function: H5FS_close + * Function: H5FS_close * - * Purpose: Destroy & deallocate free list structure, serializing sections + * Purpose: Destroy & deallocate free list structure, serializing sections * in the bins * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -512,14 +497,14 @@ done: } /* H5FS_close() */ /*------------------------------------------------------------------------- - * Function: H5FS_new + * Function: H5FS__new * - * Purpose: Create new free space manager structure + * Purpose: Create new free space manager structure * - * Return: Success: non-NULL, pointer to new free space manager struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new free space manager struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -527,9 +512,9 @@ done: H5FS_t * H5FS_new(const H5F_t *f, size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata) { - H5FS_t *fspace = NULL; /* Free space manager */ - size_t u; /* Local index variable */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *fspace = NULL; /* Free space manager */ + size_t u; /* Local index variable */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -596,8 +581,7 @@ done: * * Purpose: Collect meta storage info used by the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi * June 19, 2007 @@ -612,7 +596,6 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) /* * Check arguments. */ - HDassert(f); HDassert(fspace); HDassert(meta_size); @@ -627,8 +610,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) * * Purpose: Increment reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -667,8 +649,7 @@ done: * * Purpose: Decrement reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -710,15 +691,14 @@ done: } /* end H5FS_decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS_dirty * - * Purpose: Mark free space header as dirty + * Purpose: Mark free space header as dirty * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 14 2008 + * Programmer: Quincey Koziol + * Feb 14 2008 * *------------------------------------------------------------------------- */ @@ -728,9 +708,6 @@ H5FS_dirty(H5FS_t *fspace) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT -#ifdef QAK - HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(fspace); @@ -746,15 +723,14 @@ done: } /* end H5FS_dirty() */ /*------------------------------------------------------------------------- - * Function: H5FS_hdr_dest + * Function: H5FS_hdr_dest * - * Purpose: Destroys a free space header in memory. + * Purpose: Destroys a free space header in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -791,14 +767,13 @@ done: } /* end H5FS_hdr_dest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS_sinfo_free_sect_cb * - * Purpose: Free a size-tracking node for a bin + * Purpose: Free a size-tracking node for a bin * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -821,15 +796,13 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) } /* H5FS_sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb - * - * Purpose: Free a size-tracking node for a bin + * Function: H5FS_sinfo_free_node_cb * - * Return: Success: non-negative + * Purpose: Free a size-tracking node for a bin * - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -854,15 +827,14 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) } /* H5FS_sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS_sinfo_dest * - * Purpose: Destroys a free space section info in memory. + * Purpose: Destroys a free space section info in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -915,15 +887,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_assert + * Function: H5FS_assert * - * Purpose: Verify that the free space manager is mostly sane + * Purpose: Verify that the free space manager is mostly sane * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ @@ -931,9 +902,6 @@ herr_t H5FS_assert(const H5FS_t *fspace) { FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifndef QAK - HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS_assert", fspace->tot_sect_count); -#endif /* QAK */ /* Checks for section info, if it's available */ if (fspace->sinfo) { @@ -949,9 +917,6 @@ H5FS_assert(const H5FS_t *fspace) HDassert(fspace->tot_sect_count >= fspace->serial_sect_count); HDassert(fspace->tot_sect_count >= fspace->ghost_sect_count); HDassert(fspace->tot_sect_count == (fspace->serial_sect_count + fspace->ghost_sect_count)); -#ifdef QAK - HDassert(fspace->serial_sect_count > 0 || fspace->ghost_sect_count == 0); -#endif /* QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FS_assert() */ diff --git a/src/H5FScache.c b/src/H5FScache.c index dcb19e3..0cedb56 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FScache.c - * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FScache.c + * May 2 2006 + * Quincey Koziol * - * Purpose: Implement file free space metadata cache methods. + * Purpose: Implement file free space metadata cache methods. * *------------------------------------------------------------------------- */ diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index f7e02e4..e50dfb1 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSdbg.c - * May 9 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FSdbg.c + * May 9 2006 + * Quincey Koziol * - * Purpose: Dump debugging information about a free space manager + * Purpose: Dump debugging information about a free space manager * *------------------------------------------------------------------------- */ @@ -33,11 +33,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5HFprivate.h" /* Fractal heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5HFprivate.h" /* Fractal heaps */ +#include "H5MFprivate.h" /* File memory management */ /****************/ /* Local Macros */ @@ -68,19 +68,14 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5FS_debug + * Function: H5FS_debug * - * Purpose: Prints debugging info about a free space manager. + * Purpose: Prints debugging info about a free space manager. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 - * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add H5FS_CLIENT_FILE_ID for File Memory Management + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ @@ -153,15 +148,14 @@ done: } /* end H5FS_debug() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_debug + * Function: H5FS_sect_debug * - * Purpose: Prints debugging info about a free space section. + * Purpose: Prints debugging info about a free space section. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 30 2006 + * Programmer: Quincey Koziol + * May 30 2006 * *------------------------------------------------------------------------- */ @@ -191,15 +185,14 @@ done: } /* end H5FS_sect_debug() */ /*------------------------------------------------------------------------- - * Function: H5FS_sects_debug + * Function: H5FS_sects_debug * - * Purpose: Prints debugging info about the free space sections. + * Purpose: Prints debugging info about the free space sections. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 096a7ce..25e80cb 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * Tuesday, May 2, 2006 + * Programmer: Quincey Koziol + * Tuesday, May 2, 2006 * - * Purpose: This file contains declarations which are visible only within - * the H5FS package. Source files outside the H5FS package should - * include H5FSprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5FS package. Source files outside the H5FS package should + * include H5FSprivate.h instead. */ #ifndef H5FS_PACKAGE #error "Do not include this file outside the H5FS package!" @@ -39,8 +39,8 @@ #include "H5FSprivate.h" /* File free space */ /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5SLprivate.h" /* Skip lists */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ @@ -62,19 +62,19 @@ H5FS_METADATA_PREFIX_SIZE \ \ /* Free space header specific fields */ \ - + 1 /* Client ID */ \ - + H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \ - + H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \ - + H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \ - + H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \ - + 2 /* Number of section classes */ \ - + 2 /* Shrink percent */ \ - + 2 /* Expand percent */ \ - + 2 /* Size of address space for sections (log2 of value) */ \ - + H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \ - + H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \ - + H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \ - + H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \ + + 1 /* Client ID */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \ + + 2 /* Number of section classes */ \ + + 2 /* Shrink percent */ \ + + 2 /* Expand percent */ \ + + 2 /* Size of address space for sections (log2 of value) */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \ + + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \ ) /* Size of the free space serialized sections on disk */ @@ -83,7 +83,7 @@ H5FS_METADATA_PREFIX_SIZE \ \ /* Free space serialized sections specific fields */ \ - + H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \ + + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \ ) /****************************/ diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index e7e058f..8977667 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSprivate.h - * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5FSprivate.h + * May 2 2006 + * Quincey Koziol * - * Purpose: Private header for library accessible file free space routines. + * Purpose: Private header for library accessible file free space routines. * *------------------------------------------------------------------------- */ diff --git a/src/H5FSpublic.h b/src/H5FSpublic.h index e2b744a..33349b5 100644 --- a/src/H5FSpublic.h +++ b/src/H5FSpublic.h @@ -15,7 +15,7 @@ * * Created: H5FSpublic.h * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Public declarations for the file free space package. * diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 59be78c..7cfe9a2 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Monday, July 31, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * */ @@ -96,14 +96,14 @@ H5FL_DEFINE(H5FS_sinfo_t); /*******************/ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS_sinfo_new * - * Purpose: Create new section info structure + * Purpose: Create new section info structure * - * Return: Success: non-NULL, pointer to new section info struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new section info struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -111,8 +111,8 @@ H5FL_DEFINE(H5FS_sinfo_t); H5FS_sinfo_t * H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace) { - H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ - H5FS_sinfo_t *ret_value; /* Return value */ + H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ + H5FS_sinfo_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -172,19 +172,18 @@ done: } /* H5FS_sinfo_new() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS_sinfo_lock * - * Purpose: Make certain the section info for the free space manager is + * Purpose: Make certain the section info for the free space manager is * in memory. * * Either uses existing section info owned by the free space * header, loads section info from disk, or creates new section * info * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -290,15 +289,14 @@ done: } /* H5FS_sinfo_lock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS_sinfo_unlock * - * Purpose: Release the section info, either giving ownership back to + * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -368,6 +366,7 @@ H5FS_sinfo_unlock(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, hbool_t modified) /* Check if the section info size in the file has changed */ if (fspace->sect_size != fspace->alloc_sect_size) cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; + } /* end if */ /* Sanity check */ @@ -461,14 +460,13 @@ done: } /* H5FS_sinfo_unlock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS_sect_serialize_size * - * Purpose: Determine serialized size of all sections in free space manager + * Purpose: Determine serialized size of all sections in free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -480,16 +478,6 @@ H5FS_sect_serialize_size(H5FS_t *fspace) /* 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); -#endif /* QAK */ /* Compute the size of the buffer required to serialize all the sections */ if (fspace->serial_sect_count > 0) { @@ -499,12 +487,6 @@ H5FS_sect_serialize_size(H5FS_t *fspace) sect_buf_size = fspace->sinfo->sect_prefix_size; /* 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); -#endif /* QAK */ sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -531,15 +513,14 @@ H5FS_sect_serialize_size(H5FS_t *fspace) } /* H5FS_sect_serialize_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS_sect_increase * - * Purpose: Increase the size of the serialized free space section info + * Purpose: Increase the size of the serialized free space section info * on disk * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -572,10 +553,6 @@ H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned fla fspace->serial_sect_count++; /* Increment amount of space required to serialize all sections */ -#ifdef QAK - HDfprintf(stderr, "%s: sinfo->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); - HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); -#endif /* QAK */ fspace->sinfo->serial_size += cls->serial_size; /* Update the free space sections' serialized size */ @@ -591,16 +568,14 @@ done: } /* H5FS_sect_increase() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS_sect_decrease * - * Purpose: Decrease the size of the serialized free space section info + * Purpose: Decrease the size of the serialized free space section info * on disk * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -633,10 +608,6 @@ H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) fspace->serial_sect_count--; /* Decrement amount of space required to serialize all sections */ -#ifdef QAK - HDfprintf(stderr, "%s: fspace->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); - HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); -#endif /* QAK */ fspace->sinfo->serial_size -= cls->serial_size; /* Update the free space sections' serialized size */ @@ -649,14 +620,13 @@ done: } /* H5FS_sect_decrease() */ /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS_size_node_decr * - * Purpose: Decrement the number of sections of a particular size + * Purpose: Decrement the number of sections of a particular size * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -679,9 +649,6 @@ H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, * the bin's skiplist is also a skiplist...) */ sinfo->bins[bin].tot_sect_count--; -#ifdef QAK - HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ /* Check for 'ghost' or 'serializable' section */ if (cls->flags & H5FS_CLS_GHOST_OBJ) { @@ -737,15 +704,14 @@ done: } /* 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 + * Purpose: Remove a section node from size tracking data structures for * a free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -790,17 +756,15 @@ done: } /* 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 + * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed * from the size tracking data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -822,10 +786,6 @@ H5FS_sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sect if (!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { H5FS_section_info_t *tmp_sect_node; /* Temporary section node */ -#ifdef QAK - HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, - (unsigned)sect->type); -#endif /* QAK */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if (tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") @@ -835,10 +795,7 @@ H5FS_sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sect 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 */ -#ifdef QAK - HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ + /* Decrement amount of free space managed */ fspace->tot_space -= sect->size; done: @@ -846,14 +803,13 @@ done: } /* H5FS_sect_unlink_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS_sect_remove_real * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -888,14 +844,13 @@ done: } /* H5FS_sect_remove_real() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove + * Function: H5FS_sect_remove * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -931,14 +886,13 @@ done: } /* H5FS_sect_remove() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS_sect_link_size * - * Purpose: Add a section of free space to the free list bins + * Purpose: Add a section of free space to the free list bins * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * *------------------------------------------------------------------------- @@ -952,9 +906,6 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_s herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT -#ifdef QAK - HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr); -#endif /* QAK */ /* Check arguments. */ HDassert(sinfo); @@ -969,10 +920,9 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_s if (NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes") } /* end if */ - else { + else /* Check for node list of the correct size already */ fspace_node = (H5FS_node_t *)H5SL_search(sinfo->bins[bin].bin_list, §->size); - } /* end else */ /* Check if we need to create a new skip list for nodes of this size */ if (fspace_node == NULL) { @@ -1000,9 +950,6 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_s /* (Different from the # of items in the bin's skiplist, since each node on * the bin's skiplist is also a skiplist...) */ -#ifdef QAK - HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ sinfo->bins[bin].tot_sect_count++; if (cls->flags & H5FS_CLS_GHOST_OBJ) { sinfo->bins[bin].ghost_sect_count++; @@ -1038,16 +985,14 @@ done: } /* 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 + * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1067,10 +1012,6 @@ H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sectio /* Add section to the address-ordered list of sections, if allowed */ if (!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { -#ifdef QAK - HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, - (unsigned)sect->type); -#endif /* QAK */ if (fspace->sinfo->merge_list == NULL) if (NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, @@ -1092,15 +1033,13 @@ done: } /* H5FS_sect_link_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link - * - * Purpose: Link a section into the internal data structures + * Function: H5FS_sect_link * - * Return: Success: non-negative + * Purpose: Link a section into the internal data structures * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1122,46 +1061,29 @@ H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) cls = &fspace->sect_cls[sect->type]; /* Add section to size tracked data structures */ -#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) 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) 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); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_link() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS_sect_merge * - * Purpose: Attempt to merge a returned free space section with existing + * Purpose: Attempt to merge a returned free space section with existing * free space. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * - * Modifications: Vailin Choi; Sept 25th 2008 - * Changes to the "shrinking" part-- - * 1. Get last section node in merge-list instead of "less-than" - * node for further iteration - * 2. Remove "can-be-shrunk" section from free-space instead of - * "less-than" section - * *------------------------------------------------------------------------- */ static herr_t @@ -1284,10 +1206,6 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) } while (modified); } /* end if */ HDassert(*sect); -#ifdef QAK - HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->addr, (*sect)->size, - (*sect)->type, ((*sect)->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Loop until no more shrinking */ do { @@ -1300,10 +1218,6 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) if ((status = (*sect_cls->can_shrink)(*sect, op_data)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") if (status > 0) { -#ifdef QAK - HDfprintf(stderr, "%s: Can shrink!\n", FUNC); -#endif /* QAK */ - /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ if (remove_sect) { @@ -1347,33 +1261,18 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) if (remove_sect && (*sect != NULL)) *sect = NULL; -#ifdef QAK - HDfprintf(stderr, "%s: Done shrinking\n", FUNC); - if (*sect) - HDfprintf(stderr, "%s: (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->addr, (*sect)->size, - (*sect)->type, - ((*sect)->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); - else - HDfprintf(stderr, "%s: *sect = %p\n", FUNC, *sect); -#endif /* QAK */ - done: -#ifdef QAK - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_merge() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_add - * - * Purpose: Add a section of free space to the free list + * Function: H5FS_sect_add * - * Return: Success: non-negative + * Purpose: Add a section of free space to the free list * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -1407,10 +1306,9 @@ H5FS_sect_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t *sect /* Call "add" section class callback, if there is one */ cls = &fspace->sect_cls[sect->type]; - if (cls->add) { + if (cls->add) if ((*cls->add)(sect, &flags, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "'add' section class callback failed") - } /* end if */ /* Check for merging returned space with existing section node */ if (flags & H5FS_ADD_RETURNED_SPACE) { @@ -1455,14 +1353,13 @@ done: } /* H5FS_sect_add() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_extend + * Function: H5FS_sect_try_extend * - * Purpose: Try to extend a block using space from a section on the free list + * Purpose: Try to extend a block using space from a section on the free list * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * *------------------------------------------------------------------------- @@ -1587,23 +1484,16 @@ done: } /* H5FS_sect_try_extend() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS_sect_find_node * - * Purpose: Locate a section of free space (in existing free space list + * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Modified to handle alignment by going through each bin to find - * a section that is big enough to fulfill "request+fragment for alignment" - * *------------------------------------------------------------------------- */ static htri_t @@ -1629,10 +1519,6 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) /* Determine correct bin which holds items of at least the section's size */ bin = H5VM_log2_gen(request); HDassert(bin < fspace->sinfo->nbins); -#ifdef QAK - HDfprintf(stderr, "%s: fspace->sinfo->nbins = %u\n", FUNC, fspace->sinfo->nbins); - HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); -#endif /* QAK */ alignment = fspace->alignment; if (!((alignment > 1) && (request >= fspace->threshold))) alignment = 0; /* no alignment */ @@ -1728,10 +1614,10 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) /* sanity check */ HDassert(split_sect->addr < (*node)->addr); HDassert(request <= (*node)->size); - } + } /* end if */ /* Indicate that we found a node for the request */ HGOTO_DONE(TRUE) - } + } /* end if */ /* Get the next section node in the list */ curr_sect_node = H5SL_next(curr_sect_node); @@ -1742,7 +1628,7 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) } /* end while of curr_size_node */ } /* else of alignment */ } /* if bin_list */ - /* Advance to next larger bin */ + /* Advance to next larger bin */ bin++; } while (bin < fspace->sinfo->nbins); @@ -1751,22 +1637,16 @@ done: } /* H5FS_sect_find_node() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_find + * Function: H5FS_sect_find * - * Purpose: Locate a section of free space (in existing free space list) that + * Purpose: Locate a section of free space (in existing free space list) that * is large enough to fulfill request. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th 2008 - * Move H5FS_sect_unlink_rest() to H5FS_sect_find_node() - * *------------------------------------------------------------------------- */ htri_t @@ -1778,10 +1658,6 @@ H5FS_sect_find(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, hsize_t request, H5FS_se FUNC_ENTER_NOAPI(FAIL) -#ifdef QAK - HDfprintf(stderr, "%s: request = %Hu\n", FUNC, request); -#endif /* QAK */ - /* Check arguments. */ HDassert(fspace); HDassert(fspace->nclasses); @@ -1789,11 +1665,6 @@ H5FS_sect_find(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, hsize_t request, H5FS_se HDassert(node); /* Check for any sections on free space list */ -#ifdef QAK - HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); - HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count); - HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count); -#endif /* QAK */ if (fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ if (H5FS_sinfo_lock(f, dxpl_id, fspace, H5AC_WRITE) < 0) @@ -1808,12 +1679,8 @@ H5FS_sect_find(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, hsize_t request, H5FS_se if (ret_value > 0) { /* Note that we've modified the section info */ sinfo_modified = TRUE; -#ifdef QAK - HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = %u\n", FUNC, - (*node)->size, (*node)->addr, (*node)->type); -#endif /* QAK */ - } - } /* end if */ + } /* end if */ + } /* end if */ done: /* Release the section info */ @@ -1827,16 +1694,14 @@ done: } /* H5FS_sect_find() */ /*------------------------------------------------------------------------- - * Function: H5FS_iterate_sect_cb + * Function: H5FS_iterate_sect_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * of a particular size * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1864,16 +1729,14 @@ done: } /* H5FS_iterate_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_iterate_node_cb + * Function: H5FS_iterate_node_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * in a bin * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1902,15 +1765,13 @@ done: } /* H5FS_iterate_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_iterate + * Function: H5FS_sect_iterate * - * Purpose: Iterate over all the sections managed + * Purpose: Iterate over all the sections managed * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1928,10 +1789,6 @@ H5FS_sect_iterate(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_operator_t op, v HDassert(fspace); HDassert(op); -#ifdef QAK - HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); -#endif /* QAK */ - /* Set up user data for iterator */ udata.fspace = fspace; udata.op = op; @@ -1947,9 +1804,6 @@ H5FS_sect_iterate(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_operator_t op, v sinfo_valid = TRUE; /* Iterate over all the bins */ -#ifdef QAK - HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC); -#endif /* QAK */ for (bin = 0; bin < fspace->sinfo->nbins; bin++) { /* Check if there are any sections in this bin */ if (fspace->sinfo->bins[bin].bin_list) { @@ -1969,14 +1823,13 @@ done: } /* H5FS_sect_iterate() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_stats + * Function: H5FS_sect_stats * - * Purpose: Retrieve info about the sections managed + * Purpose: Retrieve info about the sections managed * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -1999,16 +1852,14 @@ H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects) } /* H5FS_sect_stats() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_change_class + * Function: H5FS_sect_change_class * - * Purpose: Make appropriate adjustments to internal data structures when + * Purpose: Make appropriate adjustments to internal data structures when * a section changes class * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 10, 2006 * *------------------------------------------------------------------------- @@ -2039,10 +1890,6 @@ H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_inf old_class = sect->type; old_cls = &fspace->sect_cls[sect->type]; new_cls = &fspace->sect_cls[new_class]; -#ifdef QAK - HDfprintf(stderr, "%s: old_cls->flags = %x\n", FUNC, old_cls->flags); - HDfprintf(stderr, "%s: new_cls->flags = %x\n", FUNC, new_cls->flags); -#endif /* QAK */ /* Check if the section's class change will affect the # of serializable or ghost sections */ if ((old_cls->flags & H5FS_CLS_GHOST_OBJ) != (new_cls->flags & H5FS_CLS_GHOST_OBJ)) { @@ -2055,9 +1902,6 @@ H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_inf to_ghost = FALSE; else to_ghost = TRUE; -#ifdef QAK - HDfprintf(stderr, "%s: to_ghost = %u\n", FUNC, to_ghost); -#endif /* QAK */ /* Sanity check */ HDassert(fspace->sinfo->bins); @@ -2121,16 +1965,9 @@ H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_inf to_mergable = TRUE; else to_mergable = FALSE; -#ifdef QAK - HDfprintf(stderr, "%s: to_mergable = %u\n", FUNC, to_mergable); -#endif /* QAK */ /* Add or remove section from merge list, as appropriate */ if (to_mergable) { -#ifdef QAK - HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, - (unsigned)sect->type); -#endif /* QAK */ if (fspace->sinfo->merge_list == NULL) if (NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, @@ -2142,10 +1979,6 @@ H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_inf else { H5FS_section_info_t *tmp_sect_node; /* Temporary section node */ -#ifdef QAK - HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, - (unsigned)sect->type); -#endif /* QAK */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if (tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") @@ -2174,15 +2007,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_sect_assert + * Function: H5FS_sect_assert * - * Purpose: Verify that the sections managed are mostly sane + * Purpose: Verify that the sections managed are mostly sane * - * Return: Non-negative on success, negative on failure + * Return: void * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ @@ -2192,9 +2024,6 @@ H5FS_sect_assert(const H5FS_t *fspace) hsize_t separate_obj; /* The number of separate objects managed */ FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef QAK - HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS_sect_assert", fspace->tot_sect_count); -#endif /* QAK */ /* Initialize state */ separate_obj = 0; @@ -2251,10 +2080,6 @@ H5FS_sect_assert(const H5FS_t *fspace) /* Get section node & it's class */ sect = H5SL_item(curr_sect_node); cls = &fspace->sect_cls[sect->type]; -#ifdef QAK - HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", - "H5FS_assert", sect->size, sect->addr, sect->type); -#endif /* QAK */ /* Sanity check section */ HDassert(H5F_addr_defined(sect->addr)); @@ -2325,15 +2150,14 @@ H5FS_sect_assert(const H5FS_t *fspace) #endif /* H5FS_DEBUG_ASSERT */ /*------------------------------------------------------------------------- - * 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 + * Programmer: Vailin Choi * *------------------------------------------------------------------------- */ @@ -2395,14 +2219,14 @@ done: } /* H5FS_sect_try_shrink_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_query_last_sect + * Function: H5FS_sect_query_last_sect * - * Purpose: Retrieve info about the last section on the merge list + * Purpose: Retrieve info about the last section on the merge list * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * *------------------------------------------------------------------------- */ diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 9bf735f..fa7e7e0 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -25,9 +25,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ /* Local Macros */ @@ -62,12 +62,10 @@ * * Purpose: Retrieve metadata statistics for the free-space manager * - * Return: Success: non-negative - * - * Failure: does not fail + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi - * August 25th, 2008 + * August 25th, 2008 * *------------------------------------------------------------------------- */ diff --git a/src/H5FStest.c b/src/H5FStest.c index a165e18..1b1a090 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -26,9 +26,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ /* Local Macros */ @@ -63,12 +63,10 @@ * * Purpose: Retrieve the parameters used to create the free-space manager * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: similar to H5HF_get_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ @@ -95,18 +93,17 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) * * Purpose: Compare the parameters used to create the fractal heap * - * Return: Success: non-negative - * Failure: negative + * Return: A value like strcmp() * - * Programmer: similar to H5HF_cmp_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ int 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 diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 6fd4392..1dd8924 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -15,7 +15,7 @@ * * Created: H5Faccum.c * Jan 10 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: File metadata "accumulator" routines. (Used to * cache small metadata I/Os and group them into a @@ -94,7 +94,6 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -267,7 +266,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 11 2009 * *------------------------------------------------------------------------- @@ -412,7 +410,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -849,7 +846,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -1016,7 +1012,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -1058,7 +1053,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c index 7241430..0478a10 100644 --- a/src/H5Fcwfs.c +++ b/src/H5Fcwfs.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Tuesday, July 19, 2011 * * Purpose: Each file has a small cache of global heap collections called diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index b437352..a24e679 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: File object debugging functions. @@ -37,7 +37,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Fefc.c b/src/H5Fefc.c index b000317..52183bd 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -15,7 +15,7 @@ * * Created: H5Defc.c * December 13, 2010 - * Neil Fortner <nfortne2@hdfgroup.org> + * Neil Fortner * * Purpose: External file caching routines - implements a * cache of external files to minimize the number of @@ -87,8 +87,8 @@ H5FL_DEFINE_STATIC(H5F_efc_t); H5F_efc_t * H5F_efc_create(unsigned max_nfiles) { - H5F_efc_t *efc = NULL; /* EFC object */ - H5F_efc_t *ret_value; /* Return value */ + H5F_efc_t *efc = NULL; /* EFC object */ + H5F_efc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 7077c57..4bdc431 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -56,7 +56,6 @@ H5F_init_fake_interface(void) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 2, 2006 * *------------------------------------------------------------------------- @@ -64,8 +63,8 @@ H5F_init_fake_interface(void) H5F_t * H5F_fake_alloc(uint8_t sizeof_size) { - H5F_t *f = NULL; /* Pointer to fake file struct */ - H5F_t *ret_value; /* Return value */ + H5F_t *f = NULL; /* Pointer to fake file struct */ + H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -100,7 +99,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 2, 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Fint.c b/src/H5Fint.c index 761c387..37766bf 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -23,33 +23,33 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#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 "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#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 "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tprivate.h" /* Datatypes */ /* Predefined file drivers */ -#include "H5FDcore.h" /*temporary in-memory files */ -#include "H5FDfamily.h" /*family of files */ -#include "H5FDlog.h" /* sec2 driver with logging, for debugging */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /*multiple files partitioned by mem usage */ -#include "H5FDsec2.h" /*Posix unbuffered I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDcore.h" /* temporary in-memory files */ +#include "H5FDfamily.h" /* family of files */ +#include "H5FDlog.h" /* sec2 driver with logging, for debugging */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5FDmulti.h" /* multiple files partitioned by mem usage */ +#include "H5FDsec2.h" /* Posix unbuffered I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Windows buffered I/O */ #endif -#include "H5FDdirect.h" /*Linux direct I/O */ +#include "H5FDdirect.h" /* Linux direct I/O */ /****************/ /* Local Macros */ @@ -107,14 +107,14 @@ H5FL_DEFINE(H5F_t); H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- - * Function: H5F_init_interface + * Function: H5F_init_interface * - * Purpose: Initialize interface-specific information. + * Purpose: Initialize interface-specific information. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, November 20, 1998 * *------------------------------------------------------------------------- @@ -130,26 +130,19 @@ H5F_init_interface(void) } /* end H5F_init_interface() */ /*------------------------------------------------------------------------- - * 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 - * - * Programmer: Quincey Koziol - * Wednesday, May 25, 2005 - * - * Modifications: - * + * Return: Success: Object ID for a copy of the file access + * property list. + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t @@ -159,75 +152,76 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5P_genplist_t *old_plist; /* Old property list */ void * driver_info = NULL; unsigned efc_size = 0; - hid_t ret_value = SUCCEED; + 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_INTERNAL, 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_LATEST_FORMAT_NAME, &(f->shared->latest_format)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'latest format' flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'latest format' flag") 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") /* * Since we're resetting the driver ID and info, close them if they * exist in this new property list. */ if (H5P_facc_close(ret_value, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, H5I_INVALID_HID, "can't free the old driver information") /* Increment the reference count on the driver ID and insert it into the property list */ if (H5I_inc_ref(f->shared->lf->driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver") if (H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID") /* Set the driver "info" in the property list */ driver_info = H5FD_fapl_get(f->shared->lf); if (driver_info != NULL && H5P_set(new_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver 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: @@ -235,16 +229,12 @@ done: } /* end H5F_get_access_plist() */ /*------------------------------------------------------------------------- - * Function: H5F_get_obj_count + * Function: H5F_get_obj_count * - * Purpose: Private function return the number of opened object IDs - * (files, datasets, groups, datatypes) in the same file. + * Purpose: Private function return the number of opened object IDs + * (files, datasets, groups, datatypes) in the same file. * * Return: SUCCEED on success, FAIL on failure. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -271,10 +261,6 @@ done: * Purpose: Private function to return a list of opened object IDs. * * Return: Non-negative on success; can't fail. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -297,16 +283,13 @@ done: } /* end H5F_get_obj_ids() */ /*--------------------------------------------------------------------------- - * 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). - * Return: Non-negative on success; Can't fail. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 + * 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: SUCCEED/FAIL *--------------------------------------------------------------------------- */ herr_t @@ -367,7 +350,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ olist.obj_type = H5I_GROUP; if (H5I_iterate(H5I_GROUP, H5F_get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)") - } /* end if */ + } } /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), @@ -402,26 +385,22 @@ done: } /* end H5F_get_objects() */ /*------------------------------------------------------------------------- - * Function: H5F_get_objects_cb + * Function: H5F_get_objects_cb * - * Purpose: H5F_get_objects' callback function. It verifies if an - * object is in the file, and either count it or put its ID - * on the list. + * Purpose: H5F_get_objects' callback function. It verifies if an + * object is in the file, and either count it or put its ID + * on the list. * * Return: H5_ITER_STOP if the array of object IDs is filled up. * H5_ITER_CONT otherwise. - * - * Programmer: Raymond Lu - * Wednesday, Dec 5, 2001 - * *------------------------------------------------------------------------- */ static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) { H5F_olist_t *olist = (H5F_olist_t *)key; /* Alias for search info */ - int ret_value = H5_ITER_CONT; /* Return value */ hbool_t add_obj = FALSE; + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -437,9 +416,9 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) (!olist->file_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) { @@ -505,7 +484,8 @@ 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 */ } @@ -515,31 +495,23 @@ done: } /* end H5F_get_objects_cb() */ /*------------------------------------------------------------------------- - * Function: H5F_is_hdf5 - * - * 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. + * Function: H5F_is_hdf5 * - * Return: Success: TRUE/FALSE + * Purpose: Check the file signature to detect an HDF5 file. * - * Failure: Negative + * 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. * - * Programmer: Unknown - * - * Modifications: - * Robb Matzke, 1999-08-02 - * Rewritten to use the virtual file layer. + * 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; /* Return value */ + H5FD_t *file = NULL; /* Low-level file struct */ + haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -562,42 +534,37 @@ done: } /* end H5F_is_hdf5() */ /*------------------------------------------------------------------------- - * Function: H5F_new - * - * Purpose: Creates a new file object and initializes it. The - * H5Fopen and H5Fcreate functions then fill in various - * fields. If SHARED is a non-null pointer then the shared info - * to which it points has the reference count incremented. - * Otherwise a new, empty shared info struct is created and - * initialized with the specified file access property list. - * - * Errors: + * Function: H5F_new * - * Return: Success: Ptr to a new file struct. + * Purpose: Creates a new file object and initializes it. The + * H5Fopen and H5Fcreate functions then fill in various fields. + * If SHARED is a non-null pointer then the shared info + * to which it points has the reference count incremented. + * Otherwise a new, empty shared info struct is created and + * initialized with the specified file access property list. * - * Failure: NULL + * Return: Success: Pointer to a new file struct * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 18 1997 + * Failure: NULL * *------------------------------------------------------------------------- */ H5F_t * H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { - H5F_t *f = NULL, *ret_value; + H5F_t *f = NULL; + H5F_t *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT if (NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - f->file_id = -1; + f->file_id = H5I_INVALID_HID; if (shared) { HDassert(lf == NULL); f->shared = shared; - } /* end if */ + } else { H5P_genplist_t *plist; /* Property list */ unsigned efc_size; /* External file cache size */ @@ -726,27 +693,22 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list") f->shared = H5FL_FREE(H5F_file_t, f->shared); - } /* end if */ + } f = H5FL_FREE(H5F_t, f); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_new() */ /*------------------------------------------------------------------------- - * 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. - * - * Return: Non-negative on success/Negative on failure + * Function: H5F_dest * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 18 1997 + * 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: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -888,49 +850,45 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) } /* end H5F_dest() */ /*------------------------------------------------------------------------- - * Function: H5F_open - * - * Purpose: Opens (or creates) a file. This function understands the - * following flags which are similar in nature to the Posix - * open(2) flags. - * - * H5F_ACC_RDWR: Open with read/write access. If the file is - * currently open for read-only access then it - * will be reopened. Absence of this flag - * implies read-only access. + * Function: H5F_open * - * H5F_ACC_CREAT: Create a new file if it doesn't exist yet. - * The permissions are 0666 bit-wise AND with - * the current umask. H5F_ACC_WRITE must also - * be specified. + * Purpose: Opens (or creates) a file. This function understands the + * following flags which are similar in nature to the Posix + * open(2) flags. * - * H5F_ACC_EXCL: This flag causes H5F_open() to fail if the - * file already exists. + * H5F_ACC_RDWR: Open with read/write access. If the file is + * currently open for read-only access then it + * will be reopened. Absence of this flag + * implies read-only access. * - * H5F_ACC_TRUNC: The file is truncated and a new HDF5 superblock - * is written. This operation will fail if the - * file is already open. + * H5F_ACC_CREAT: Create a new file if it doesn't exist yet. + * The permissions are 0666 bit-wise AND with + * the current umask. H5F_ACC_WRITE must also + * be specified. * - * Unlinking the file name from the group directed graph while - * the file is opened causes the file to continue to exist but - * one will not be able to upgrade the file from read-only - * access to read-write access by reopening it. Disk resources - * for the file are released when all handles to the file are - * closed. NOTE: This paragraph probably only applies to Unix; - * deleting the file name in other OS's has undefined results. + * H5F_ACC_EXCL: This flag causes H5F_open() to fail if the + * file already exists. * - * The CREATE_PARMS argument is optional. A null pointer will - * cause the default file creation parameters to be used. + * H5F_ACC_TRUNC: The file is truncated and a new HDF5 superblock + * is written. This operation will fail if the + * file is already open. * - * The ACCESS_PARMS argument is optional. A null pointer will - * cause the default file access parameters to be used. + * Unlinking the file name from the group directed graph while + * the file is opened causes the file to continue to exist but + * one will not be able to upgrade the file from read-only + * access to read-write access by reopening it. Disk resources + * for the file are released when all handles to the file are + * closed. NOTE: This paragraph probably only applies to Unix; + * deleting the file name in other OS's has undefined results. * - * Return: Success: A new file pointer. - * Failure: NULL + * The CREATE_PARMS argument is optional. A null pointer will + * cause the default file creation parameters to be used. * - * Programmer: Robb Matzke - * Tuesday, September 23, 1997 + * The ACCESS_PARMS argument is optional. A null pointer will + * cause the default file access parameters to be used. * + * Return: Success: A new file pointer. + * Failure: NULL *------------------------------------------------------------------------- */ H5F_t * @@ -1134,15 +1092,11 @@ done: } /* end H5F_open() */ /*------------------------------------------------------------------------- - * Function: H5F_flush + * Function: H5F_flush * - * Purpose: Flushes cached data. + * Purpose: Flushes cached data. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 29 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1206,26 +1160,11 @@ done: } /* end H5F_flush() */ /*------------------------------------------------------------------------- - * Function: H5F_close - * - * Purpose: Closes a file or causes the close operation to be pended. - * This function is called two ways: from the API it gets called - * by H5Fclose->H5I_dec_ref->H5F_close 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() 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). + * Function: H5F_close * - * This function is also called directly from H5O_close() when - * the last object header is closed for the file and the file - * has a pending close. + * Purpose: Internal routine to close a file. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, September 23, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1242,7 +1181,8 @@ H5F_close(H5F_t *f) 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 */ + * 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 */ @@ -1254,10 +1194,11 @@ H5F_close(H5F_t *f) /* 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 */ + * 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; @@ -1271,17 +1212,14 @@ done: } /* end H5F_close() */ /*------------------------------------------------------------------------- - * 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 - * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1309,12 +1247,12 @@ H5F_try_close(H5F_t *f) /* * Close file according to close degree: * - * H5F_CLOSE_WEAK: if there are still objects open, wait until - * they are all closed. - * H5F_CLOSE_SEMI: if there are still objects open, return fail; - * otherwise, close file. - * H5F_CLOSE_STRONG: if there are still objects open, close them - * first, then close file. + * H5F_CLOSE_WEAK: if there are still objects open, wait until + * they are all closed. + * H5F_CLOSE_SEMI: if there are still objects open, return fail; + * otherwise, close file. + * H5F_CLOSE_STRONG: if there are still objects open, close them + * first, then close file. */ switch (f->shared->fc_degree) { case H5F_CLOSE_WEAK: @@ -1334,7 +1272,8 @@ H5F_try_close(H5F_t *f) 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 & @@ -1379,7 +1318,7 @@ H5F_try_close(H5F_t *f) 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)") @@ -1397,7 +1336,7 @@ H5F_try_close(H5F_t *f) 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 */ @@ -1416,14 +1355,16 @@ H5F_try_close(H5F_t *f) /* 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 @@ -1438,36 +1379,35 @@ done: } /* end H5F_try_close() */ /*------------------------------------------------------------------------- - * Function: H5F_get_id + * Function: H5F_get_id * - * Purpose: Get the file ID, incrementing it, or "resurrecting" it as + * Purpose: Get the file ID, incrementing it, or "resurrecting" it as * appropriate. * - * Return: Non-negative on success/Negative on failure + * Return: Success: An ID for a file * - * Programmer: Raymond Lu - * Oct 29, 2003 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5F_get_id(H5F_t *file, hbool_t app_ref) { - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT HDassert(file); - if (file->file_id == -1) { + if (file->file_id == H5I_INVALID_HID) { /* 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") + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ ret_value = file->file_id; @@ -1477,18 +1417,12 @@ done: } /* end H5F_get_id() */ /*------------------------------------------------------------------------- - * Function: H5F_incr_nopen_objs - * - * Purpose: Increment the number of open objects for a file. - * - * Return: Success: The number of open objects, after the increment + * Function: H5F_incr_nopen_objs * - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 6 2007 + * Purpose: Increment the number of open objects for a file. * + * Return: Success: The number of open objects, after the increment + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -1503,18 +1437,12 @@ H5F_incr_nopen_objs(H5F_t *f) } /* end H5F_incr_nopen_objs() */ /*------------------------------------------------------------------------- - * Function: H5F_decr_nopen_objs - * - * Purpose: Decrement the number of open objects for a file. - * - * Return: Success: The number of open objects, after the decrement + * Function: H5F_decr_nopen_objs * - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 6 2007 + * Purpose: Decrement the number of open objects for a file. * + * Return: Success: The number of open objects, after the decrement + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -1529,26 +1457,21 @@ H5F_decr_nopen_objs(H5F_t *f) } /* end H5F_decr_nopen_objs() */ /*------------------------------------------------------------------------- - * Function: H5F_build_actual_name - * - * Purpose: Retrieve the name of a file, after following symlinks, etc. + * Function: H5F_build_actual_name * - * Note: Currently only working for "POSIX I/O compatible" VFDs + * Purpose: Retrieve the name of a file, after following symlinks, etc. * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Quincey Koziol - * November 25, 2009 + * Note: Currently only working for "POSIX I/O compatible" VFDs * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t 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 */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t new_fapl_id = H5I_INVALID_HID; /* ID for duplicated FAPL */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1644,17 +1567,13 @@ done: } /* H5F_build_actual_name() */ /*------------------------------------------------------------------------- - * 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. + * Function: H5F_addr_encode_len * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * 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 *------------------------------------------------------------------------- */ void @@ -1684,17 +1603,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp /*in,out*/, haddr_t addr) } /* end H5F_addr_encode_len() */ /*------------------------------------------------------------------------- - * 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. + * Function: H5F_addr_encode * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * 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 *------------------------------------------------------------------------- */ void @@ -1711,20 +1626,16 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp /*in,out*/, haddr_t addr) } /* end H5F_addr_encode() */ /*------------------------------------------------------------------------- - * 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. - * - * If the value read is all 1's then the address is returned - * with an undefined value. + * Function: H5F_addr_decode_len * - * Return: void + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * If the value read is all 1's then the address is returned + * with an undefined value. * + * Return: void *------------------------------------------------------------------------- */ void @@ -1777,20 +1688,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp /*in,out*/, haddr_t *add } /* end H5F_addr_decode_len() */ /*------------------------------------------------------------------------- - * 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. - * - * If the value read is all 1's then the address is returned - * with an undefined value. + * Function: H5F_addr_decode * - * Return: void + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * If the value read is all 1's then the address is returned + * with an undefined value. * + * Return: void *------------------------------------------------------------------------- */ void @@ -1811,12 +1718,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp /*in,out*/, haddr_t *addr_p / * * Purpose: Set the grp_btree_shared field with a valid ref-count pointer. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * 7/19/11 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1840,12 +1742,7 @@ H5F_set_grp_btree_shared(H5F_t *f, H5RC_t *rc) * * Purpose: Set the sohm_addr field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * 7/20/11 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1868,12 +1765,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 - * - * Programmer: Quincey Koziol - * 7/20/11 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1896,12 +1788,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 - * - * Programmer: Quincey Koziol - * 7/20/11 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1924,12 +1811,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 - * - * Programmer: Quincey Koziol - * 7/20/11 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1953,28 +1835,24 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) * Purpose: Private version of H5Fget_file_image * * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value - * - * Programmer: John Mainzer - * 11/15/11 - * + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) { - H5FD_t *fd_ptr; /* file driver */ - haddr_t eoa; /* End of file address */ - ssize_t ret_value; /* Return value */ + H5FD_t *fd_ptr; /* file driver */ + haddr_t eoa; /* End of file address */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* 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 @@ -1995,7 +1873,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 @@ -2017,11 +1895,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; @@ -2032,14 +1910,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, H5AC_ind_dxpl_g, 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") } /* end if */ done: diff --git a/src/H5Fio.c b/src/H5Fio.c index 8e5c0e9..ffa83c3 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -15,7 +15,7 @@ * * Created: H5Fio.c * Jan 10 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: File I/O routines. * @@ -75,7 +75,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -88,6 +87,7 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t FUNC_ENTER_NOAPI(FAIL) + /* Sanity checks */ HDassert(f); HDassert(f->shared); HDassert(buf); @@ -120,7 +120,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -132,10 +131,8 @@ H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) -#ifdef QAK - HDfprintf(stderr, "%s: write to addr = %a, size = %Zu\n", FUNC, addr, size); -#endif /* QAK */ + /* Sanity checks */ HDassert(f); HDassert(f->shared); HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 28ae3f6..0a598a0 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -17,14 +17,14 @@ #define H5_INTERFACE_INIT_FUNC H5F_init_mount_interface /* Packages needed by this file... */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* PRIVATE PROTOTYPES */ static herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id, hid_t dxpl_id); @@ -76,7 +76,8 @@ H5F_close_mounts(H5F_t *f) /* Unmount all child files. Loop backwards to avoid having to adjust u when * a file is unmounted. Note that we rely on unsigned u "wrapping around" - * to terminate the loop. */ + * to terminate the loop. + */ for (u = f->shared->mtab.nmounts - 1; u < f->shared->mtab.nmounts; u--) { /* Only unmount children mounted to this top level file structure */ if (f->shared->mtab.child[u].file->parent == f) { @@ -97,7 +98,7 @@ H5F_close_mounts(H5F_t *f) f->shared->mtab.nmounts--; f->nmounts--; } - } /* end if */ + } HDassert(f->nmounts == 0); @@ -131,7 +132,7 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED p H5G_name_t mp_path; /* Mount point group hier. path */ H5O_loc_t mp_oloc; /* Mount point object location */ H5G_loc_t root_loc; /* Group location of root of file to mount */ - herr_t ret_value = SUCCEED; /*return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -183,7 +184,7 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED p for (ancestor = parent; ancestor; ancestor = ancestor->parent) { if (ancestor->shared == child->shared) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount would introduce a cycle") - } /* end for */ + } /* Make certain that the parent & child files have the same "file close degree" */ if (parent->shared->fc_degree != child->shared->fc_degree) @@ -207,7 +208,7 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED p rt = md; else if (cmp > 0) lt = md + 1; - } /* end while */ + } if (cmp > 0) md++; if (!cmp) @@ -223,7 +224,7 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED p HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for mount table") parent->shared->mtab.child = x; parent->shared->mtab.nalloc = n; - } /* end if */ + } /* Insert into table */ HDmemmove(parent->shared->mtab.child + md + 1, parent->shared->mtab.child + md, @@ -255,12 +256,12 @@ done: if (mount_point) { if (H5G_close(mount_point) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close mounted group") - } /* end if */ + } else { if (H5G_loc_free(&mp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free mount location") - } /* end else */ - } /* end if */ + } + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mount() */ @@ -333,21 +334,21 @@ H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id) /* Found the correct index */ child_idx = (int)u; break; - } /* end if */ - } /* end for */ + } + } } else { unsigned lt, rt, md = 0; /*binary search indices */ int cmp; /*binary search comparison value*/ - /* - * We've been given the mount point in the parent. We use a binary + /* We've been given the mount point in the parent. We use a binary * search in the parent to locate the mounted file, if any. */ parent = child; /*we guessed wrong*/ lt = 0; rt = parent->shared->mtab.nmounts; cmp = -1; + while (lt < rt && cmp) { md = (lt + rt) / 2; mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group); @@ -356,7 +357,8 @@ H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id) rt = md; else lt = md + 1; - } /* end while */ + } + if (cmp) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "not a mount point") @@ -431,7 +433,7 @@ done: hbool_t H5F_is_mount(const H5F_t *file) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -446,15 +448,12 @@ H5F_is_mount(const H5F_t *file) } /* end H5F_is_mount() */ /*------------------------------------------------------------------------- - * Function: H5Fmount + * Function: H5Fmount * - * Purpose: Mount file CHILD_ID onto the group specified by LOC_ID and - * NAME using mount properties PLIST_ID. + * Purpose: Mount file CHILD_ID onto the group specified by LOC_ID and + * NAME using mount properties PLIST_ID. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -489,21 +488,18 @@ done: } /* end H5Fmount() */ /*------------------------------------------------------------------------- - * Function: H5Funmount - * - * Purpose: Given a mount point, dissassociate the mount point's file - * from the file mounted there. Do not close either file. + * Function: H5Funmount * - * The mount point can either be the group in the parent or the - * root group of the mounted file (both groups have the same - * name). If the mount point was opened before the mount then - * it's the group in the parent, but if it was opened after the - * mount then it's the root group of the child. + * Purpose: Given a mount point, dissassociate the mount point's file + * from the file mounted there. Do not close either file. * - * Return: Non-negative on success/Negative on failure + * The mount point can either be the group in the parent or the + * root group of the mounted file (both groups have the same + * name). If the mount point was opened before the mount then + * it's the group in the parent, but if it was opened after the + * mount then it's the root group of the child. * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -516,13 +512,13 @@ H5Funmount(hid_t loc_id, const char *name) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); - /* Check args */ + /* 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") - /* Unmount */ + /* Perform the unmount operation */ if (H5F_unmount(&loc, name, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") @@ -531,12 +527,12 @@ done: } /* end H5Funmount() */ /*------------------------------------------------------------------------- - * Function: H5F_mount_count_ids_recurse + * Function: H5F_mount_count_ids_recurse * - * Purpose: Helper routine for counting number of open IDs in mount + * Purpose: Helper routine for counting number of open IDs in mount * hierarchy. * - * Return: <none> + * Return: void * * Programmer: Quincey Koziol * Tuesday, July 19, 2005 @@ -575,17 +571,17 @@ H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_obj H5F_mount_count_ids_recurse(f->shared->mtab.child[u].file, nopen_files, nopen_objs); } - } /* end for */ + } FUNC_LEAVE_NOAPI_VOID } /* end H5F_mount_count_ids_recurse() */ /*------------------------------------------------------------------------- - * Function: H5F_mount_count_ids + * Function: H5F_mount_count_ids * - * Purpose: Count the number of open file & object IDs in a mount hierarchy + * Purpose: Count the number of open file & object IDs in a mount hierarchy * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tues, July 19, 2005 @@ -654,11 +650,11 @@ done: } /* end H5F_flush_mounts_recurse() */ /*------------------------------------------------------------------------- - * Function: H5F_flush_mounts + * Function: H5F_flush_mounts * - * Purpose: Flush a mount hierarchy + * Purpose: Flush a mount hierarchy * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Fri, August 21, 2009 @@ -735,7 +731,7 @@ H5F_traverse_mount(H5O_loc_t *oloc /*in,out*/) rt = md; else lt = md + 1; - } /* end while */ + } /* Copy root info over to ENT */ if (0 == cmp) { diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 9c7c33e..8cc2971 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -15,7 +15,7 @@ * * Created: H5Fmpi.c * Jan 10 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: MPI-related routines. * @@ -68,58 +68,54 @@ #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- - * Function: H5F_mpi_get_rank + * Function: H5F_mpi_get_rank * - * Purpose: Retrieves the rank of an MPI process. + * Purpose: Retrieves the rank of an MPI process. * - * Return: Success: The rank (non-negative) + * Return: Success: The rank (non-negative) * - * Failure: Negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5F_mpi_get_rank(const H5F_t *f) { - int ret_value; + int ret_value = -1; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(f && f->shared); /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_rank(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_rank request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mpi_get_rank() */ /*------------------------------------------------------------------------- - * Function: H5F_mpi_get_comm + * Function: H5F_mpi_get_comm * - * Purpose: Retrieves the file's communicator + * Purpose: Retrieves the file's communicator * - * Return: Success: The communicator (non-negative) + * Return: Success: The communicator (non-negative) * - * Failure: Negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ MPI_Comm H5F_mpi_get_comm(const H5F_t *f) { - MPI_Comm ret_value; + MPI_Comm ret_value = MPI_COMM_NULL; FUNC_ENTER_NOAPI(MPI_COMM_NULL) @@ -145,38 +141,31 @@ done: * Programmer: John Mainzer * Friday, May 6, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5F_mpi_get_size(const H5F_t *f) { - int ret_value; + int ret_value = -1; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(f && f->shared); /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mpi_get_size() */ /*------------------------------------------------------------------------- - * Function: H5Fset_mpi_atomicity - * - * Purpose: Sets the atomicity mode + * Function: H5Fset_mpi_atomicity * - * Return: Success: Non-negative + * Purpose: Private call to set the atomicity mode * - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -197,25 +186,24 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode") - /* set atomicity value */ + /* Set atomicity value */ if (H5FD_set_mpio_atomicity(file->shared->lf, flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set atomicity flag") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Fset_mpi_atomicity() */ /*------------------------------------------------------------------------- - * Function: H5Fget_mpi_atomicity - * - * Purpose: Returns the atomicity mode + * Function: H5Fget_mpi_atomicity * - * Return: Success: Non-negative + * Purpose: Returns the atomicity mode * - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ @@ -236,7 +224,7 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode") - /* get atomicity value */ + /* Get atomicity value */ if (H5FD_get_mpio_atomicity(file->shared->lf, flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get atomicity flag") diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 1a6a502..f74a342 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: This file contains declarations which are visible only within @@ -33,14 +33,14 @@ #include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */ /* Other private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5FSprivate.h" /* File free space */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object header messages */ -#include "H5RCprivate.h" /* Reference counted object functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5FSprivate.h" /* File free space */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object header messages */ +#include "H5RCprivate.h" /* Reference counted object functions */ /* * Feature: Define this constant on the compiler command-line if you want to diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index fe510bb..ec31f8c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -22,7 +22,7 @@ #include "H5Fpublic.h" /* Public headers needed by this file */ -#include "H5FDpublic.h" /* File drivers */ +#include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 011ee28..3270872 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -77,8 +77,8 @@ /* The difference between a single file and a set of mounted files */ typedef enum H5F_scope_t { - H5F_SCOPE_LOCAL = 0, /*specified file handle only */ - H5F_SCOPE_GLOBAL = 1 /*entire virtual file */ + H5F_SCOPE_LOCAL = 0, /*specified file handle only */ + H5F_SCOPE_GLOBAL = 1 /*entire virtual file */ } H5F_scope_t; /* Unlimited file size for H5Pset_external() */ @@ -88,9 +88,9 @@ typedef enum H5F_scope_t { * H5F_CLOSE_DEFAULT - Use the degree pre-defined by underlining VFL * H5F_CLOSE_WEAK - file closes only after all opened objects are closed * H5F_CLOSE_SEMI - if no opened objects, file is close; otherwise, file - close fails + close fails * H5F_CLOSE_STRONG - if there are opened objects, close them first, then - close file + close file */ typedef enum H5F_close_degree_t { H5F_CLOSE_DEFAULT = 0, diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 64e95b7..9a1f7d2 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -31,10 +31,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ /****************/ /* Local Macros */ @@ -65,17 +65,13 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5F_get_intent + * Function: H5F_get_intent * - * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: 'intent' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * September 29, 2000 + * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'intent' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -90,16 +86,12 @@ H5F_get_intent(const H5F_t *f) } /* end H5F_get_intent() */ /*------------------------------------------------------------------------- - * Function: H5F_get_open_name - * - * Purpose: Retrieve the name used to open a file. + * Function: H5F_get_open_name * - * Return: Success: The name of the file. - * Failure: ? (should not happen) - * - * Programmer: Neil Fortner - * December 15 2008 + * Purpose: Retrieve the name used to open a file. * + * Return: Success: The name of the file. + * Failure: ? (should not happen) *------------------------------------------------------------------------- */ char * @@ -115,16 +107,12 @@ H5F_get_open_name(const H5F_t *f) } /* end H5F_get_open_name() */ /*------------------------------------------------------------------------- - * Function: H5F_get_actual_name - * - * Purpose: Retrieve the actual name of a file, after resolving symlinks, etc. + * Function: H5F_get_actual_name * - * Return: Success: The name of the file. - * Failure: ? (should not happen) - * - * Programmer: Quincey Koziol - * November 25 2009 + * Purpose: Retrieve the actual name of a file, after resolving symlinks, etc. * + * Return: Success: The name of the file. + * Failure: ? (should not happen) *------------------------------------------------------------------------- */ char * @@ -140,17 +128,13 @@ H5F_get_actual_name(const H5F_t *f) } /* end H5F_get_actual_name() */ /*------------------------------------------------------------------------- - * Function: H5F_get_extpath - * - * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and - * H5D_build_extfile_prefix() to retrieve the main file's location - * when searching the target file. + * Function: H5F_get_extpath * - * Return: 'extpath' on success/abort on failure (shouldn't fail) - * - * Programmer: Vailin Choi, April 2, 2008 + * Purpose: Retrieve the file's 'extpath' flags + * This is used by H5L_extern_traverse() and H5D_build_file_prefix() + * to retrieve the main file's location when searching the target file. * + * Return: 'extpath' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ char * @@ -166,14 +150,11 @@ H5F_get_extpath(const H5F_t *f) } /* end H5F_get_extpath() */ /*------------------------------------------------------------------------- - * Function: H5F_get_shared - * - * Purpose: Retrieve the file's 'shared' pointer + * Function: H5F_get_shared * - * Return: 'shared' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'shared' pointer * + * Return: 'shared' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ H5F_file_t * @@ -188,14 +169,11 @@ H5F_get_shared(const H5F_t *f) } /* end H5F_get_shared() */ /*------------------------------------------------------------------------- - * Function: H5F_same_shared - * - * Purpose: Determine if two files have the same shared file pointer - * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) + * Function: H5F_same_shared * - * Programmer: Quincey Koziol, July 19, 2011 + * Purpose: Determine if two files have the same shared file pointer * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t @@ -213,14 +191,11 @@ H5F_same_shared(const H5F_t *f1, const H5F_t *f2) } /* end H5F_same_shared() */ /*------------------------------------------------------------------------- - * Function: H5F_get_nopen_objs - * - * Purpose: Retrieve the file's 'nopen_objs' value - * - * Return: 'nopen_objs' on success/abort on failure (shouldn't fail) + * Function: H5F_get_nopen_objs * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'nopen_objs' value * + * Return: 'nopen_objs' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -235,14 +210,11 @@ H5F_get_nopen_objs(const H5F_t *f) } /* end H5F_get_nopen_objs() */ /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F_get_file_id * - * Purpose: Retrieve the file's 'file_id' value - * - * Return: 'file_id' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'file_id' value * + * Return: 'file_id' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hid_t @@ -257,14 +229,11 @@ H5F_get_file_id(const H5F_t *f) } /* end H5F_get_file_id() */ /*------------------------------------------------------------------------- - * Function: H5F_get_parent - * - * Purpose: Retrieve the file's 'parent' pointer - * - * Return: 'parent' on success/abort on failure (shouldn't fail) + * Function: H5F_get_parent * - * Programmer: Quincey Koziol, July 19, 2011 + * Purpose: Retrieve the file's 'parent' pointer * + * Return: 'parent' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ H5F_t * @@ -279,14 +248,11 @@ H5F_get_parent(const H5F_t *f) } /* end H5F_get_parent() */ /*------------------------------------------------------------------------- - * Function: H5F_get_nmounts + * Function: H5F_get_nmounts * - * Purpose: Retrieve the file's 'nmounts' value - * - * Return: 'nmounts' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'nmounts' value * + * Return: 'nmounts' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -301,17 +267,12 @@ H5F_get_nmounts(const H5F_t *f) } /* end H5F_get_nmounts() */ /*------------------------------------------------------------------------- - * Function: H5F_get_fcpl - * - * Purpose: Retrieve the value of a file's FCPL. + * Function: H5F_get_fcpl * - * Return: Success: The FCPL for the file. - * Failure: ? (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 25 2005 + * Purpose: Retrieve the value of a file's FCPL. * + * Return: Success: The FCPL for the file. + * Failure: ? (should not happen) *------------------------------------------------------------------------- */ hid_t @@ -327,17 +288,13 @@ H5F_get_fcpl(const H5F_t *f) } /* end H5F_get_fcpl() */ /*------------------------------------------------------------------------- - * Function: H5F_sizeof_addr - * - * Purpose: Quick and dirty routine to retrieve the size of the file's size_t - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) + * Function: H5F_sizeof_addr * - * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * September 29, 2000 + * Purpose: Quick and dirty routine to retrieve the size of the file's size_t + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ uint8_t @@ -353,17 +310,13 @@ H5F_sizeof_addr(const H5F_t *f) } /* end H5F_sizeof_addr() */ /*------------------------------------------------------------------------- - * Function: H5F_sizeof_size - * - * Purpose: Quick and dirty routine to retrieve the size of the file's off_t - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) + * Function: H5F_sizeof_size * - * Return: 'sizeof_size' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * September 29, 2000 + * Purpose: Quick and dirty routine to retrieve the size of the file's off_t + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'sizeof_size' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ uint8_t @@ -379,14 +332,11 @@ H5F_sizeof_size(const H5F_t *f) } /* H5F_sizeof_size() */ /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_addr - * - * Purpose: Retrieve the file's 'sohm_addr' value + * Function: H5F_get_sohm_addr * - * Return: 'sohm_addr' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'sohm_addr' value * + * Return: 'sohm_addr' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ haddr_t @@ -402,14 +352,11 @@ H5F_get_sohm_addr(const H5F_t *f) } /* end H5F_get_sohm_addr() */ /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_vers - * - * Purpose: Retrieve the file's 'sohm_vers' value - * - * Return: 'sohm_vers' on success/abort on failure (shouldn't fail) + * Function: H5F_get_sohm_vers * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'sohm_vers' value * + * Return: 'sohm_vers' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -425,14 +372,11 @@ H5F_get_sohm_vers(const H5F_t *f) } /* end H5F_get_sohm_vers() */ /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_nindexes - * - * Purpose: Retrieve the file's 'sohm_nindexes' value - * - * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail) + * Function: H5F_get_sohm_nindexes * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'sohm_nindexes' value * + * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -448,19 +392,15 @@ H5F_get_sohm_nindexes(const H5F_t *f) } /* end H5F_get_sohm_nindexes() */ /*------------------------------------------------------------------------- - * Function: H5F_sym_leaf_k + * Function: H5F_sym_leaf_k * - * Purpose: Replaced a macro to retrieve the symbol table leaf size, - * now that the generic properties are being used to store - * the values. - * - * Return: Success: Non-negative, and the symbol table leaf size is returned. - * Failure: Negative (should not happen) - * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Oct 14 2001 + * Purpose: Replaced a macro to retrieve the symbol table leaf size, + * now that the generic properties are being used to store + * the values. * + * Return: Success: Non-negative, and the symbol table leaf size is + * returned. + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ unsigned @@ -477,19 +417,15 @@ H5F_sym_leaf_k(const H5F_t *f) } /* end H5F_sym_leaf_k() */ /*------------------------------------------------------------------------- - * Function: H5F_Kvalue - * - * Purpose: Replaced a macro to retrieve a B-tree key value for a certain - * type, now that the generic properties are being used to store - * the B-tree values. - * - * Return: Success: Non-negative, and the B-tree key value is returned. - * Failure: Negative (should not happen) + * Function: H5F_Kvalue * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Oct 14 2001 + * Purpose: Replaced a macro to retrieve a B-tree key value for a certain + * type, now that the generic properties are being used to store + * the B-tree values. * + * Return: Success: Non-negative, and the B-tree key value is + * returned. + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ unsigned @@ -507,14 +443,11 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type) } /* end H5F_Kvalue() */ /*------------------------------------------------------------------------- - * Function: H5F_get_nrefs + * Function: H5F_get_nrefs * - * Purpose: Retrieve the file's 'nrefs' value - * - * Return: 'nrefs' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol, July 20, 2011 + * Purpose: Retrieve the file's 'nrefs' value * + * Return: 'nrefs' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned @@ -530,20 +463,15 @@ H5F_get_nrefs(const H5F_t *f) } /* end H5F_get_nrefs() */ /*------------------------------------------------------------------------- - * Function: H5F_rdcc_nslots + * Function: H5F_rdcc_nslots * - * Purpose: Replaced a macro to retrieve the raw data cache number of slots, - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the raw data cache number of slots, + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-negative, and the raw data cache number of + * Return: Success: Non-negative, and the raw data cache number of * of slots is returned. - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jun 1 2004 - * + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ size_t @@ -559,20 +487,15 @@ H5F_rdcc_nslots(const H5F_t *f) } /* end H5F_rdcc_nelmts() */ /*------------------------------------------------------------------------- - * Function: H5F_rdcc_nbytes + * Function: H5F_rdcc_nbytes * - * Purpose: Replaced a macro to retrieve the raw data cache number of bytes, - * now that the generic properties are being used to store - * the values. + * Purpose: Replaced a macro to retrieve the raw data cache number of bytes, + * now that the generic properties are being used to store + * the values. * - * Return: Success: Non-negative, and the raw data cache number of + * Return: Success: Non-negative, and the raw data cache number of * of bytes is returned. - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jun 1 2004 - * + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ size_t @@ -588,19 +511,15 @@ H5F_rdcc_nbytes(const H5F_t *f) } /* end H5F_rdcc_nbytes() */ /*------------------------------------------------------------------------- - * Function: H5F_rdcc_w0 - * - * Purpose: Replaced a macro to retrieve the raw data cache 'w0' value - * now that the generic properties are being used to store - * the values. + * Function: H5F_rdcc_w0 * - * Return: Success: Non-negative, and the raw data cache 'w0' value is returned. - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jun 2 2004 + * Purpose: Replaced a macro to retrieve the raw data cache 'w0' value + * now that the generic properties are being used to store + * the values. * + * Return: Success: Non-negative, and the raw data cache 'w0' value + * is returned. + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ double @@ -616,17 +535,13 @@ H5F_rdcc_w0(const H5F_t *f) } /* end H5F_rdcc_w0() */ /*------------------------------------------------------------------------- - * Function: H5F_get_base_addr - * - * Purpose: Quick and dirty routine to retrieve the file's 'base_addr' value - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) + * Function: H5F_get_base_addr * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> - * December 20, 2002 + * Purpose: Quick and dirty routine to retrieve the file's 'base_addr' value + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ haddr_t @@ -643,19 +558,15 @@ H5F_get_base_addr(const H5F_t *f) } /* end H5F_get_base_addr() */ /*------------------------------------------------------------------------- - * Function: H5F_grp_btree_shared - * - * Purpose: Replaced a macro to retrieve the shared B-tree node info - * now that the generic properties are being used to store - * the values. - * - * Return: Success: Non-void, and the shared B-tree node info is returned. - * Failure: void (should not happen) + * Function: H5F_grp_btree_shared * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jul 5 2004 + * Purpose: Replaced a macro to retrieve the shared B-tree node info + * now that the generic properties are being used to store + * the values. * + * Return: Success: Non-void, and the shared B-tree node info + * is returned. + * Failure: void (should not happen) *------------------------------------------------------------------------- */ H5RC_t * @@ -671,19 +582,15 @@ H5F_grp_btree_shared(const H5F_t *f) } /* end H5F_grp_btree_shared() */ /*------------------------------------------------------------------------- - * Function: H5F_sieve_buf_size - * - * Purpose: Replaced a macro to retrieve the dataset sieve buffer size - * now that the generic properties are being used to store - * the values. - * - * Return: Success: Non-void, and the dataset sieve buffer size is returned. - * Failure: void (should not happen) + * Function: H5F_sieve_buf_size * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jul 8 2005 + * Purpose: Replaced a macro to retrieve the dataset sieve buffer size + * now that the generic properties are being used to store + * the values. * + * Return: Success: Non-void, and the dataset sieve buffer size + * is returned. + * Failure: void (should not happen) *------------------------------------------------------------------------- */ size_t @@ -699,18 +606,17 @@ H5F_sieve_buf_size(const H5F_t *f) } /* end H5F_sieve_buf_size() */ /*------------------------------------------------------------------------- - * Function: H5F_gc_ref + * Function: H5F_gc_ref * - * Purpose: Replaced a macro to retrieve the "garbage collect - * references flag" now that the generic properties are being used - * to store the values. + * Purpose: Replaced a macro to retrieve the "garbage collect + * references flag" now that the generic properties are being used + * to store the values. * - * Return: Success: The "garbage collect references flag" is returned. - * Failure: (should not happen) + * Return: Success: The "garbage collect references flag" is returned. + * Failure: (should not happen) * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jul 8 2005 + * Programmer: Quincey Koziol + * Jul 8 2005 * *------------------------------------------------------------------------- */ @@ -734,11 +640,6 @@ H5F_gc_ref(const H5F_t *f) * * Return: Success: Non-negative, the 'use the latest format' flag * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 2 2006 - * *------------------------------------------------------------------------- */ hbool_t @@ -754,17 +655,12 @@ H5F_use_latest_format(const H5F_t *f) } /* end H5F_use_latest_format() */ /*------------------------------------------------------------------------- - * Function: H5F_get_fc_degree - * - * Purpose: Retrieve the 'file close degree' for the file. - * - * Return: Success: Non-negative, the 'file close degree' - * Failure: (can't happen) + * Function: H5F_get_fc_degree * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 5 2007 + * Purpose: Retrieve the 'file close degree' for the file. * + * Return: Success: Non-negative, the 'file close degree' + * Failure: (can't happen) *------------------------------------------------------------------------- */ H5F_close_degree_t @@ -780,17 +676,12 @@ H5F_get_fc_degree(const H5F_t *f) } /* end H5F_get_fc_degree() */ /*------------------------------------------------------------------------- - * Function: H5F_store_msg_crt_idx - * - * Purpose: Retrieve the 'store message creation index' flag for the file. + * Function: H5F_store_msg_crt_idx * - * Return: Success: Non-negative, the 'store message creation index' flag - * Failure: (can't happen) - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 6 2007 + * Purpose: Retrieve the 'store message creation index' flag for the file. * + * Return: Success: Non-negative, the 'store message creation index' flag + * Failure: (can't happen) *------------------------------------------------------------------------- */ hbool_t @@ -806,17 +697,12 @@ H5F_store_msg_crt_idx(const H5F_t *f) } /* end H5F_store_msg_crt_idx() */ /*------------------------------------------------------------------------- - * Function: H5F_has_feature - * - * Purpose: Check if a file has a particular feature enabled + * Function: H5F_has_feature * - * Return: Success: Non-negative - TRUE or FALSE - * Failure: Negative (should not happen) - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 31 2004 + * Purpose: Check if a file has a particular feature enabled * + * Return: Success: Non-negative - TRUE or FALSE + * Failure: Negative (should not happen) *------------------------------------------------------------------------- */ hbool_t @@ -832,17 +718,13 @@ H5F_has_feature(const H5F_t *f, unsigned feature) } /* end H5F_has_feature() */ /*------------------------------------------------------------------------- - * Function: H5F_get_driver_id - * - * Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) + * Function: H5F_get_driver_id * - * Return: 'driver_id' on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * October 10, 2000 + * Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: 'driver_id' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hid_t @@ -859,17 +741,13 @@ H5F_get_driver_id(const H5F_t *f) } /* end H5F_get_driver_id() */ /*------------------------------------------------------------------------- - * Function: H5F_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 - * H5F_t data structure) + * Function: H5F_get_fileno * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * March 27, 2002 + * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -893,21 +771,17 @@ done: } /* end H5F_get_fileno() */ /*------------------------------------------------------------------------- - * Function: H5F_get_eoa - * - * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value - * - * Return: Non-negative on success/Negative on failure + * Function: H5F_get_eoa * - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * June 1, 2004 + * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) { - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -923,17 +797,13 @@ done: } /* end H5F_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5F_get_vfd_handle - * - * Purpose: Returns a pointer to the file handle of the low-level file - * driver. This is the private function for H5Fget_vfd_handle. - * - * Return: Success: Non-negative. - * Failure: negative. + * Function: H5F_get_vfd_handle * - * Programmer: Raymond Lu - * Sep. 16, 2002 + * Purpose: Returns a pointer to the file handle of the low-level file + * driver. This is the private function for H5Fget_vfd_handle. * + * Return: Success: Non-negative. + * Failure: negative. *------------------------------------------------------------------------- */ herr_t @@ -956,18 +826,14 @@ done: } /* end H5F_get_vfd_handle() */ /*------------------------------------------------------------------------- - * Function: H5F_is_tmp_addr + * Function: H5F_is_tmp_addr * - * Purpose: Quick and dirty routine to determine if an address is in - * the 'temporary' file space. - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) - * - * Programmer: Quincey Koziol <koziol@hdfgroup.org> - * June 11, 2009 + * Purpose: Quick and dirty routine to determine if an address is in + * the 'temporary' file space. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t @@ -983,18 +849,14 @@ H5F_is_tmp_addr(const H5F_t *f, haddr_t addr) } /* end H5F_is_tmp_addr() */ /*------------------------------------------------------------------------- - * Function: H5F_use_tmp_space - * - * Purpose: Quick and dirty routine to determine if using temporary - * file space is allowed for this file. - * (Mainly added to stop non-file routines from poking about in the - * H5F_t data structure) - * - * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) + * Function: H5F_use_tmp_space * - * Programmer: Quincey Koziol <koziol@hdfgroup.org> - * July 1, 2009 + * Purpose: Quick and dirty routine to determine if using temporary + * file space is allowed for this file. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hbool_t diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index 6eec44a..738f301 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -39,11 +39,11 @@ H5FL_DEFINE_STATIC(H5F_sfile_node_t); 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 @@ -82,17 +82,15 @@ H5F_sfile_assert_num(unsigned n) } /* H5F_sfile_assert_num() */ /*------------------------------------------------------------------------- - * 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 @@ -122,18 +120,16 @@ done: } /* 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 * @@ -163,17 +159,15 @@ done: } /* 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 diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index cb331d0..b9b1ead 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -29,7 +29,7 @@ #include "H5Fpkg.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ #include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ @@ -233,7 +233,6 @@ done: * Failure: FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept 12, 2003 * *------------------------------------------------------------------------- @@ -308,7 +307,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 15, 2003 * *------------------------------------------------------------------------- @@ -494,7 +492,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) /* Initialize the shared message code & write the SOHM message to the extension */ if (H5SM_init(f, plist, &ext_loc, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table") - } /* end if */ + } /* Check for non-default v1 B-tree 'K' values to store */ if (sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF || diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 73f4925..7a78a8f 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -11,6 +11,17 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Fsuper_cache.c + * Aug 15 2009 + * Quincey Koziol + * + * Purpose: Implement file superblock & driver info metadata cache methods. + * + *------------------------------------------------------------------------- + */ + /****************/ /* Module Setup */ /****************/ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 957d089..9c5b0810 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -15,7 +15,7 @@ * * Created: H5Ftest.c * Jan 3 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: File testing routines. * @@ -36,12 +36,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#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 "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMpkg.h" /* Shared object header messages */ /****************/ /* Local Macros */ @@ -72,15 +72,14 @@ /*******************/ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -105,15 +104,14 @@ done: } /* 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 @@ -141,12 +139,11 @@ done: } /* 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 @@ -14,14 +14,12 @@ /*------------------------------------------------------------------------- * * Created: H5G.c - * Jul 18 1997 - * Robb Matzke <matzke@llnl.gov> * * 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 | @@ -85,12 +83,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -194,7 +192,6 @@ done: * * Return: Success: Positive if anything is done that might * affect other interfaces; zero otherwise. - * * Failure: Negative. * * Programmer: Robb Matzke @@ -231,9 +228,9 @@ H5G_term_interface(void) } /* end H5G_term_interface() */ /*------------------------------------------------------------------------- - * 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. @@ -245,14 +242,11 @@ H5G_term_interface(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. - * - * Failure: FAIL + * Return: Success: The object ID of a new, empty group open for + * writing. Call H5Gclose() when finished with + * the group. * - * Programmer: Quincey Koziol - * April 5, 2007 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -263,51 +257,51 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g H5G_t * grp = NULL; /* New group created */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + 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, 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") /* Get correct property list */ if (H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not 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, FAIL, "not group create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list") /* Check the group access property list */ if (H5P_DEFAULT == gapl_id) gapl_id = H5P_GROUP_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group access property list") /* Create the new group & get its ID */ if (NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, H5AC_dxpl_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create 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 (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 H5Gcreate2() */ /*------------------------------------------------------------------------- - * 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. * @@ -323,19 +317,16 @@ 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: FAIL + * 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 * *------------------------------------------------------------------------- */ @@ -347,24 +338,24 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) H5G_obj_create_t gcrt_info; /* Information for group creation */ hid_t ret_value; - FUNC_ENTER_API(FAIL) + 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, FAIL, "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) gcpl_id = H5P_GROUP_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list") /* Check the group access property list */ if (H5P_DEFAULT == gapl_id) gapl_id = H5P_GROUP_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group access property list") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -373,9 +364,9 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) /* Create the new group & get its ID */ if (NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create 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: /* Release the group's object header, if it was created */ @@ -384,35 +375,34 @@ done: /* Get the new group's object location */ if (NULL == (oloc = H5G_oloc(grp))) - HDONE_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object location of group") + HDONE_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to get object location of group") /* Decrement refcount on group's object header in memory */ if (H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, + "unable to decrement refcount on newly created object") } /* end if */ /* Cleanup on failure */ if (ret_value < 0) 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 H5Gcreate_anon() */ /*------------------------------------------------------------------------- - * 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: FAIL + * Return: Success: Object ID of the group * - * Programmer: James Laird - * Thursday, July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -423,51 +413,47 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) H5G_loc_t loc; /* Location of parent for group */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_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 (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Check the group access property list */ if (H5P_DEFAULT == gapl_id) gapl_id = H5P_GROUP_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group access property list") /* Open the group */ if ((grp = H5G__open_name(&loc, name, gapl_id, H5AC_ind_dxpl_id)) == NULL) - 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 ID 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 (ret_value < 0) if (grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") - } /* end if */ + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen2() */ /*------------------------------------------------------------------------- - * Function: H5Gget_create_plist + * Function: H5Gget_create_plist * - * Purpose: Returns a copy of the group creation property list. + * Purpose: Returns a copy of the group creation property list. * - * Return: Success: ID for a copy of the group creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the group creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Tuesday, October 25, 2005 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -475,35 +461,33 @@ hid_t H5Gget_create_plist(hid_t group_id) { H5G_t *group = NULL; - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", group_id); /* Check args */ if (NULL == (group = (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, H5I_INVALID_HID, "not a group") + /* Retrieve the GCPL */ if ((ret_value = H5G_get_create_plist(group)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_create_plist() */ /*------------------------------------------------------------------------- - * Function: H5G_get_create_plist - * - * Purpose: Private function for H5Gget_create_plist + * Function: H5G_get_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: Private function for H5Gget_create_plist * - * Failure: FAIL + * 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 * *------------------------------------------------------------------------- */ @@ -516,60 +500,60 @@ H5G_get_create_plist(H5G_t *grp) htri_t pline_exists; H5P_genplist_t *gcpl_plist; H5P_genplist_t *new_plist; - hid_t new_gcpl_id = FAIL; - hid_t ret_value = FAIL; + hid_t new_gcpl_id = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Copy the default group creation property list */ if (NULL == (gcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_GROUP_CREATE_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default group creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default group creation property list") if ((new_gcpl_id = H5P_copy_plist(gcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_gcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list") /* Retrieve any object creation properties */ if (H5O_get_create_plist(&grp->oloc, H5AC_ind_dxpl_id, new_plist) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") /* Check for the group having a group info message */ if ((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") if (ginfo_exists) { H5O_ginfo_t ginfo; /* Group info message */ /* Read the group info */ if (NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_dxpl_id)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, H5I_INVALID_HID, "can't get group info") /* Set the group info for the property list */ if (H5P_set(new_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info") } /* end if */ /* Check for the group having a link info message */ if ((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") if (linfo_exists) { /* Set the link info for the property list */ if (H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set link info") } /* end if */ /* Check for the group having a pipeline message */ if ((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to read object header") if (pline_exists) { H5O_pline_t pline; /* Pipeline message */ /* Read the pipeline */ if (NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_dxpl_id)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, H5I_INVALID_HID, "can't get link pipeline") /* Set the pipeline for the property list */ if (H5P_set(new_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set link pipeline") } /* end if */ /* Set the return value */ @@ -579,22 +563,18 @@ done: if (ret_value < 0) { if (new_gcpl_id > 0) if (H5I_dec_app_ref(new_gcpl_id) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free") + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't free") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_get_create_plist() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -628,15 +608,12 @@ done: } /* end H5Gget_info() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -687,16 +664,12 @@ done: } /* end H5Gget_info_by_name() */ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -754,15 +727,12 @@ done: } /* end H5Gget_info_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5Gclose + * Function: H5Gclose * - * Purpose: Closes the specified group. The group ID will no longer be - * valid for accessing the group. + * Purpose: Closes the specified group. The group ID will no longer be + * valid for accessing the group. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Wednesday, December 31, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -778,8 +748,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) diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 333bca0..b8650f6 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -15,7 +15,7 @@ * * Created: H5Gbtree2.c * Sep 9 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing fields on links * @@ -142,7 +142,6 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -403,18 +402,6 @@ H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, in HDassert(bt2_udata); HDassert(bt2_rec); -#ifdef QAK - { - unsigned u; - - HDfprintf(stderr, "%s: bt2_udata->corder = %Hd\n", "H5G_dense_btree2_corder_compare", - (hsize_t)bt2_udata->corder); - HDfprintf(stderr, "%s: bt2_rec = {%Hu, ", "H5G_dense_btree2_corder_compare", - (hsize_t)bt2_rec->corder); - for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); - } -#endif /* QAK */ /* Check creation order value */ if (bt2_udata->corder < bt2_rec->corder) *result = -1; diff --git a/src/H5Gcache.c b/src/H5Gcache.c index d03f6c9..0366bfe 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -15,7 +15,7 @@ * * Created: H5Gcache.c * Feb 5 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Implement group metadata cache methods. * @@ -101,7 +101,6 @@ H5FL_SEQ_EXTERN(H5G_entry_t); * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -192,7 +191,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -282,7 +280,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- @@ -294,9 +291,7 @@ H5G_node_dest(H5F_t *f, H5G_node_t *sym) FUNC_ENTER_NOAPI_NOINIT - /* - * Check arguments. - */ + /* Sanity checks */ HDassert(f); HDassert(sym); @@ -330,7 +325,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 20 2003 * *------------------------------------------------------------------------- @@ -342,9 +336,7 @@ H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* - * Check arguments. - */ + /* Sanity checks */ HDassert(sym); /* Reset the node's dirty flag */ diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 8dc0663..a5d2d5b 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -15,7 +15,7 @@ * * Created: H5Gcompact.c * Sep 5 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Functions for handling compact storage. * @@ -64,15 +64,14 @@ static herr_t H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, cons H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable); /*------------------------------------------------------------------------- - * 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 * Sep 5 2005 * *------------------------------------------------------------------------- @@ -173,7 +172,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -214,8 +212,8 @@ ssize_t H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, char *name, size_t size) { - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - ssize_t ret_value; /* Return value */ + H5G_link_table_t ltable = {0, NULL}; /* Link table */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE @@ -257,7 +255,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 5 2005 * *------------------------------------------------------------------------- @@ -396,8 +393,8 @@ H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *li H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; /* Return value */ + H5G_link_table_t ltable = {0, NULL}; /* Link table */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -423,15 +420,14 @@ done: } /* end H5G__compact_iterate() */ /*------------------------------------------------------------------------- - * 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 * Sep 20 2005 * *------------------------------------------------------------------------- @@ -476,7 +472,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -484,9 +479,9 @@ done: htri_t H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { - H5G_iter_lkp_t udata; /* User data for iteration callback */ - H5O_mesg_operator_t op; /* Message operator */ - htri_t ret_value; /* Return value */ + H5G_iter_lkp_t udata; /* User data for iteration callback */ + H5O_mesg_operator_t op; /* Message operator */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -521,7 +516,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- @@ -578,8 +572,8 @@ done: H5G_obj_t H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, hsize_t idx) { - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - H5G_obj_t ret_value; /* Return value */ + H5G_link_table_t ltable = {0, NULL}; /* Link table */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 41b3185..31f86a1 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -15,7 +15,7 @@ * * Created: H5Gdense.c * Sep 9 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Routines for operating on "dense" link storage for a * group in a file. @@ -250,7 +250,6 @@ typedef struct { * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2006 * *------------------------------------------------------------------------- @@ -294,17 +293,11 @@ H5G__dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, const H5O_pline_t /* Retrieve the heap's address in the file */ if (H5HF_get_heap_addr(fheap, &(linfo->fheap_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get fractal heap address") -#ifdef QAK - HDfprintf(stderr, "%s: linfo->fheap_addr = %a\n", FUNC, linfo->fheap_addr); -#endif /* QAK */ /* Retrieve the heap's ID length in the file */ if (H5HF_get_id_len(fheap, &fheap_id_len) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") HDassert(fheap_id_len == H5G_DENSE_FHEAP_ID_LEN); -#ifdef QAK - HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); -#endif /* QAK */ /* Create the name index v2 B-tree */ HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); @@ -320,9 +313,6 @@ H5G__dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, const H5O_pline_t /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_name, &(linfo->name_bt2_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index") -#ifdef QAK - HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr); -#endif /* QAK */ /* Check if we should create a creation order index v2 B-tree */ if (linfo->index_corder) { @@ -340,10 +330,7 @@ H5G__dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, const H5O_pline_t /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_corder, &(linfo->corder_bt2_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index") -#ifdef QAK - HDfprintf(stderr, "%s: linfo->corder_bt2_addr = %a\n", FUNC, linfo->corder_bt2_addr); -#endif /* QAK */ - } /* end if */ + } /* end if */ done: /* Close the open objects */ @@ -365,7 +352,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -391,18 +377,10 @@ H5G__dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, const H5O_l HDassert(f); HDassert(linfo); HDassert(lnk); -#ifdef QAK - HDfprintf(stderr, "%s: linfo->fheap_addr = %a\n", FUNC, linfo->fheap_addr); - HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr); -#endif /* QAK */ /* Find out the size of buffer needed for serialized link */ if ((link_size = H5O_msg_raw_size(f, H5O_LINK_ID, FALSE, lnk)) == 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size") -#ifdef QAK - HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDstrlen(lnk->name), - link_size); -#endif /* QAK */ /* Wrap the local buffer for serialized link */ if (NULL == (wb = H5WB_wrap(link_buf, sizeof(link_buf)))) @@ -477,7 +455,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -513,7 +490,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -521,10 +497,10 @@ done: htri_t H5G__dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, const char *name, H5O_link_t *lnk) { - H5G_bt2_ud_common_t udata; /* User data for v2 B-tree link lookup */ - H5HF_t * fheap = NULL; /* Fractal heap handle */ - H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */ - htri_t ret_value; /* Return value */ + H5G_bt2_ud_common_t udata; /* User data for v2 B-tree link lookup */ + H5HF_t * fheap = NULL; /* Fractal heap handle */ + H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -576,7 +552,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -615,7 +590,6 @@ done: * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -654,7 +628,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -764,7 +737,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 25 2006 * *------------------------------------------------------------------------- @@ -863,7 +835,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -899,7 +870,6 @@ done: * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -955,7 +925,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -969,7 +938,7 @@ H5G__dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t H5G_link_table_t ltable = {0, NULL}; /* Table of links */ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1072,7 +1041,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- @@ -1116,7 +1084,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- @@ -1159,7 +1126,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- @@ -1172,7 +1138,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, H5_index H5G_link_table_t ltable = {0, NULL}; /* Table of links */ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE @@ -1276,7 +1242,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1342,7 +1307,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1386,7 +1350,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1452,7 +1415,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 15 2006 * *------------------------------------------------------------------------- @@ -1484,7 +1446,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 15 2006 * *------------------------------------------------------------------------- @@ -1595,7 +1556,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -1704,7 +1664,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1799,7 +1758,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- @@ -1807,8 +1765,8 @@ done: H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hsize_t idx) { - H5G_link_table_t ltable = {0, NULL}; /* Table of links */ - H5G_obj_t ret_value; /* Return value */ + H5G_link_table_t ltable = {0, NULL}; /* Table of links */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index e770bc1..807851c 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Gdeprec.c * June 21 2006 - * James Laird <jlaird@ncsa.uiuc.edu> + * James Laird * * Purpose: Deprecated functions from the H5G interface. These * functions are here for compatibility purposes and may be @@ -151,7 +151,7 @@ H5G__term_deprec_interface(void) H5G_obj_t H5G_map_obj_type(H5O_type_t obj_type) { - H5G_obj_t ret_value; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -311,10 +311,9 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") done: - if (ret_value < 0) { + if (ret_value < 0) if (grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -709,39 +708,36 @@ done: } /* end H5Gget_comment() */ /*------------------------------------------------------------------------- - * Function: H5Giterate - * - * Purpose: Iterates over the entries of a group. The LOC_ID and NAME - * identify the group over which to iterate and IDX indicates - * where to start iterating (zero means at the beginning). The - * OPERATOR is called for each member and the iteration - * continues until the operator returns non-zero or all members - * are processed. The operator is passed a group ID for the - * group being iterated, a member name, and OP_DATA for each - * member. + * Function: H5Giterate * - * Note: Deprecated in favor of H5Literate + * Purpose: Iterates over the entries of a group. The LOC_ID and NAME + * identify the group over which to iterate and IDX indicates + * where to start iterating (zero means at the beginning). The + * OPERATOR is called for each member and the iteration + * continues until the operator returns non-zero or all members + * are processed. The operator is passed a group ID for the + * group being iterated, a member name, and OP_DATA for each + * member. * - * 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. + * NOTE: Deprecated in favor of H5Literate * - * 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: Robb Matzke - * Monday, March 23, 1998 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - 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 */ - herr_t ret_value; + 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 */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); @@ -843,7 +839,7 @@ done: herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf /*out*/) { - H5G_loc_t loc; + H5G_loc_t loc; /* Group's location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -966,6 +962,7 @@ H5G_get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G FUNC_ENTER_NOAPI_NOINIT + /* Sanity checks */ HDassert(loc); HDassert(name && *name); diff --git a/src/H5Gent.c b/src/H5Gent.c index 641e9ef..66489ca 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Friday, September 19, 1997 */ @@ -75,7 +75,6 @@ H5FL_BLK_EXTERN(str_buf); * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -116,7 +115,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -181,7 +179,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -220,7 +217,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -291,7 +287,6 @@ done: * Failure: Negative * * Programmer: Pedro Vicente - * pvn@ncsa.uiuc.edu * ???day, August ??, 2002 * * Notes: 'depth' parameter determines how much of the group entry @@ -369,7 +364,6 @@ H5G__ent_reset(H5G_entry_t *ent) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -512,7 +506,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 29 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Gint.c b/src/H5Gint.c index b863e67..ce79f36 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -15,7 +15,7 @@ * * Created: H5Gint.c * April 5 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: General use, "internal" routines for groups. * @@ -34,13 +34,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 */ /****************/ /* Local Macros */ @@ -152,9 +152,9 @@ H5G_t * H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id) { - H5O_obj_create_t ocrt_info; /* Information for object creation */ - H5G_obj_create_t gcrt_info; /* Information for group creation */ - H5G_t * ret_value; /* Return value */ + H5O_obj_create_t ocrt_info; /* Information for object creation */ + H5G_obj_create_t gcrt_info; /* Information for group creation */ + H5G_t * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -201,7 +201,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -211,7 +210,7 @@ H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id) { H5G_t * grp = NULL; /*new group */ unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */ - H5G_t * ret_value; /* Return value */ + H5G_t * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -287,7 +286,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, hid_t dxpl H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ H5O_type_t obj_type; /* Type of object at location */ - H5G_t * ret_value; /* Return value */ + H5G_t * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -319,10 +318,9 @@ H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, hid_t dxpl ret_value = grp; done: - if (!ret_value) { + if (!ret_value) if (loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__open_name() */ @@ -345,9 +343,9 @@ done: H5G_t * H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) { - H5G_t * grp = NULL; /* Group opened */ - H5G_shared_t *shared_fo; /* Shared group object */ - H5G_t * ret_value; /* Return value */ + H5G_t * grp = NULL; /* Group opened */ + H5G_shared_t *shared_fo; /* Shared group object */ + H5G_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -765,12 +763,11 @@ done: } /* end H5G_iterate_cb() */ /*------------------------------------------------------------------------- - * 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 @@ -781,11 +778,11 @@ herr_t H5G_iterate(hid_t loc_id, 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, hid_t lapl_id, hid_t dxpl_id) { - 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; /* Return value */ + H5G_loc_t loc; /* Location of parent for group */ + 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) @@ -794,8 +791,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_o 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) @@ -820,7 +816,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") @@ -1013,9 +1009,9 @@ done: } /* end H5G_visit_cb() */ /*------------------------------------------------------------------------- - * 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 @@ -1027,18 +1023,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. - * - * - * - * 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. * *------------------------------------------------------------------------- */ @@ -1046,15 +1037,15 @@ herr_t H5G_visit(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, hid_t dxpl_id) { - 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 */ - 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; /* Return value */ + 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 = 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 */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); diff --git a/src/H5Glink.c b/src/H5Glink.c index 5892516..70bdea1 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -15,7 +15,7 @@ * * Created: H5Glink.c * Nov 13 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Functions for handling links in groups. * @@ -86,7 +86,6 @@ static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); * (i.e. same as strcmp()) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 5 2005 * *------------------------------------------------------------------------- @@ -112,7 +111,6 @@ H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2) * (i.e. opposite strcmp()) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 25 2006 * *------------------------------------------------------------------------- @@ -137,7 +135,6 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) * as equal, their order in the sorted array is undefined. * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- @@ -145,7 +142,7 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) static int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -171,7 +168,6 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) * as equal, their order in the sorted array is undefined. * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- @@ -179,7 +175,7 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -201,7 +197,6 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 16 2006 * *------------------------------------------------------------------------- @@ -385,26 +380,34 @@ done: } /* end H5G__link_to_loc() */ /*------------------------------------------------------------------------- - * Function: H5G__link_sort_table + * Function: H5G__link_sort_table * * Purpose: Sort table containing a list of links for a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Nov 20, 2006 + * Programmer: Quincey Koziol + * Nov 20, 2006 * *------------------------------------------------------------------------- */ herr_t H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_order_t order) { + herr_t ret_value = SUCCEED; + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(ltable); + /* Can't sort when empty since the links table will be NULL */ + if (0 == ltable->nlinks) + HGOTO_DONE(ret_value); + + /* This should never be NULL if the number of links is non-zero */ + HDassert(ltable->lnks); + /* Pick appropriate sorting routine */ if (idx_type == H5_INDEX_NAME) { if (order == H5_ITER_INC) @@ -424,6 +427,7 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_orde HDassert(order == H5_ITER_NATIVE); } /* end else */ +done: FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G__link_sort_table() */ @@ -526,7 +530,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 13 2006 * *------------------------------------------------------------------------- @@ -547,7 +550,7 @@ H5G__link_name_replace(H5F_t *file, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, obj_path_r = H5G_build_fullpath_refstr_str(grp_full_path_r, lnk->name); if (H5G_name_replace(lnk, H5G_NAME_DELETE, file, obj_path_r, NULL, NULL, dxpl_id) < 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 066590c..8ffc01a 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -15,7 +15,7 @@ * * Created: H5Gloc.c * Sep 13 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Functions for working with group "locations" * @@ -129,15 +129,11 @@ static herr_t H5G_loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name, const /*******************/ /*------------------------------------------------------------------------- - * 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 * *------------------------------------------------------------------------- */ @@ -159,8 +155,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) /* Construct a group location for root group of the file */ if (H5G_root_loc(f, loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") - } /* end case */ - break; + break; + } case H5I_GENPROP_CLS: case H5I_GENPROP_LST: @@ -181,8 +177,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) 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 */ - break; + break; + } case H5I_DATATYPE: { H5T_t *dt; @@ -193,8 +189,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) 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 */ - break; + break; + } case H5I_DATASPACE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") @@ -208,8 +204,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) 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 */ - break; + break; + } case H5I_ATTR: { H5A_t *attr; @@ -220,8 +216,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) 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 */ - break; + break; + } case H5I_REFERENCE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference") @@ -618,8 +614,8 @@ H5G_loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_U htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { - H5G_loc_exists_t udata; /* User data for traversal callback */ - htri_t ret_value; /* Return value */ + H5G_loc_exists_t udata; /* User data for traversal callback */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -642,13 +638,13 @@ done: } /* end H5G_loc_exists() */ /*------------------------------------------------------------------------- - * Function: H5G_loc_info_cb + * Function: H5G__loc_info_cb * - * Purpose: Callback for retrieving object info for an object in a group + * Purpose: Callback for retrieving object info for an object in a group * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 23, 2006 * *------------------------------------------------------------------------- @@ -680,9 +676,9 @@ done: } /* end H5G_loc_info_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_loc_info + * Function: H5G_loc_info * - * Purpose: Retrieve the information for an object from a group location + * Purpose: Retrieve the information for an object from a group location * and path to that object * * Return: Non-negative on success/Negative on failure @@ -849,11 +845,12 @@ H5G_loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_A HDstrncpy(udata->comment, comment.s, udata->bufsize); udata->comment_size = (ssize_t)HDstrlen(comment.s); H5O_msg_reset(H5O_NAME_ID, &comment); - } /* end else */ + } 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) @@ -880,8 +877,8 @@ ssize_t H5G_loc_get_comment(H5G_loc_t *loc, const char *name, char *comment /*out*/, size_t bufsize, hid_t lapl_id, hid_t dxpl_id) { - H5G_loc_gc_t udata; /* User data for traversal callback */ - ssize_t ret_value; /* Return value */ + H5G_loc_gc_t udata; /* User data for traversal callback */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Gname.c b/src/H5Gname.c index 5f8c2d8..bc04488 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -15,7 +15,7 @@ * * Created: H5Gname.c * Sep 12 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Functions for handling group hierarchy paths. * @@ -114,7 +114,6 @@ H5FL_BLK_EXTERN(str_buf); * Failure: Ptr to the null terminator of NAME. * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -151,10 +150,10 @@ H5G__component(const char *name, size_t *size_p) char * H5G_normalize(const char *name) { - char * norm; /* Pointer to the normalized string */ - size_t s, d; /* Positions within the strings */ - unsigned last_slash; /* Flag to indicate last character was a slash */ - char * ret_value; /* Return value */ + char * norm; /* Pointer to the normalized string */ + size_t s, d; /* Positions within the strings */ + unsigned last_slash; /* Flag to indicate last character was a slash */ + char * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -205,7 +204,7 @@ done: * Return: TRUE for valid prefix, FALSE for not a valid prefix, FAIL * on error * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: September 24, 2002 * @@ -269,7 +268,7 @@ done: * * Return: Pointer to reference counted string on success, NULL on error * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: August 19, 2005 * @@ -278,12 +277,12 @@ done: static H5RS_str_t * H5G_build_fullpath(const char *prefix, const char *name) { - char * full_path; /* Full user path built */ - size_t orig_path_len; /* Original length of the path */ - size_t path_len; /* Length of the path */ - size_t name_len; /* Length of the name */ - unsigned need_sep; /* Flag to indicate if separator is needed */ - H5RS_str_t *ret_value; /* Return value */ + char * full_path; /* Full user path built */ + size_t orig_path_len; /* Original length of the path */ + size_t path_len; /* Length of the path */ + size_t name_len; /* Length of the name */ + unsigned need_sep; /* Flag to indicate if separator is needed */ + H5RS_str_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -330,7 +329,7 @@ done: * Return: Success: Non-NULL, combined path * Failure: NULL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * Tuesday, October 11, 2005 * *------------------------------------------------------------------------- @@ -338,8 +337,8 @@ done: H5RS_str_t * H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) { - const char *prefix; /* Pointer to raw string for path */ - H5RS_str_t *ret_value; + const char *prefix; /* Pointer to raw string for path */ + H5RS_str_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -366,7 +365,7 @@ H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) * * Return: Pointer to reference counted string on success, NULL on error * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: August 19, 2005 * @@ -433,7 +432,7 @@ H5G__name_init(H5G_name_t *name, const char *path) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * Thursday, August 22, 2002 * *------------------------------------------------------------------------- @@ -536,18 +535,14 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth) * Programmer: Quincey Koziol * Tuesday, December 13, 2005 * - * Modifications: Leon Arber - * Oct. 18, 2006 - * Added functionality to get the name for a reference. - * *------------------------------------------------------------------------- */ ssize_t H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cached, hid_t lapl_id, hid_t dxpl_id) { - ssize_t len = 0; /* Length of object's name */ - ssize_t ret_value; /* Return value */ + ssize_t len = 0; /* Length of object's name */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -633,7 +628,7 @@ H5G_name_reset(H5G_name_t *name) * * Return: Success * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: August 22, 2002 * @@ -768,7 +763,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: June 5, 2002 * @@ -1047,7 +1042,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: June 11, 2002 * @@ -1135,7 +1130,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS 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) { @@ -1179,11 +1174,11 @@ done: * Purpose: Callback for retrieving object's name by address * * Return: Positive if path is for object desired - * 0 if not correct object - * negative on failure. + * 0 if not correct object + * negative on failure. * * Programmer: Quincey Koziol - * November 4 2007 + * November 4 2007 * *------------------------------------------------------------------------- */ @@ -1246,10 +1241,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 @@ -1259,25 +1255,25 @@ done: ssize_t H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, 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; /* 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 */ + /* Construct a group location for root group of the file */ 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 { @@ -1290,7 +1286,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * /* 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, lapl_id, dxpl_id)) < 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 */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 92e1dfd..b9fba36 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -15,7 +15,7 @@ * * Created: H5Gnode.c * Jun 26 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Functions for handling symbol table nodes. A * symbol table node is a small collection of symbol @@ -134,8 +134,6 @@ H5FL_SEQ_DEFINE(H5G_entry_t); * Programmer: Robb Matzke * Wednesday, October 8, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5RC_t * @@ -157,7 +155,6 @@ H5G_node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 8 1997 * *------------------------------------------------------------------------- @@ -186,7 +183,6 @@ H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 8 1997 * *------------------------------------------------------------------------- @@ -253,7 +249,6 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, const * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- @@ -292,7 +287,6 @@ H5G__node_free(H5G_node_t *sym) * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -363,11 +357,8 @@ done: * Failure: FAIL (same as LT_KEY<RT_KEY) * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -419,11 +410,8 @@ done: * Failure: FAIL (same as UDATA < LT_KEY) * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -480,7 +468,6 @@ done: * Failure: Negative if not found. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -568,7 +555,6 @@ done: * Failure: H5B_INS_ERROR, NEW_NODE_P might not be initialized. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 24 1997 * *------------------------------------------------------------------------- @@ -929,7 +915,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 24 1997 * *------------------------------------------------------------------------- @@ -1336,7 +1321,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 19 2006 * *------------------------------------------------------------------------- @@ -1443,7 +1427,6 @@ H5G__node_iterate_size(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, const void H5_ATT * Return: 0(zero) on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 4 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 62832b5..2323608 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -15,7 +15,7 @@ * * Created: H5Gobj.c * Sep 5 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Functions for abstract handling of objects in groups. * @@ -105,7 +105,6 @@ static herr_t H5G_obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *li * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 29 2005 * *------------------------------------------------------------------------- @@ -159,7 +158,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 29 2005 * *------------------------------------------------------------------------- @@ -289,7 +287,6 @@ done: * Failure: FAIL if error occurred * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 11 2007 * *------------------------------------------------------------------------- @@ -297,8 +294,8 @@ done: htri_t H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id) { - H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ - htri_t ret_value; /* Return value */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -352,7 +349,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- @@ -387,7 +383,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 16 2006 * *------------------------------------------------------------------------- @@ -426,7 +421,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -635,9 +629,9 @@ herr_t H5G__obj_iterate(const H5O_loc_t *grp_oloc, 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, hid_t dxpl_id) { - H5O_linfo_t linfo; /* Link info message */ - htri_t linfo_exists; /* Whether the link info message exists */ - herr_t ret_value; /* Return value */ + H5O_linfo_t linfo; /* Link info message */ + htri_t linfo_exists; /* Whether the link info message exists */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -695,7 +689,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 27 2006 * *------------------------------------------------------------------------- @@ -782,9 +775,9 @@ ssize_t H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name, size_t size, hid_t dxpl_id) { - H5O_linfo_t linfo; /* Link info message */ - htri_t linfo_exists; /* Whether the link info message exists */ - ssize_t ret_value; /* Return value */ + H5O_linfo_t linfo; /* Link info message */ + htri_t linfo_exists; /* Whether the link info message exists */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1075,10 +1068,9 @@ H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, H5 } /* end else */ /* Update link info for a new-style group */ - if (!use_old_format) { + if (!use_old_format) if (H5G_obj_remove_update_linfo(grp_oloc, &linfo, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTUPDATE, FAIL, "unable to update link info") - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1092,7 +1084,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 26 2005 * *------------------------------------------------------------------------- @@ -1126,11 +1117,10 @@ H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hi HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") } /* end else */ } /* end if */ - else { + else /* Get the object's info from the symbol table */ if ((ret_value = H5G__stab_lookup(grp_oloc, name, lnk, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") - } /* end else */ + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1145,7 +1135,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Goh.c b/src/H5Goh.c index 0d51219..3d5b780 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -94,7 +94,7 @@ H5FL_DEFINE(H5G_copy_file_ud_t); static void * H5O_group_get_copy_file_udata(void) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -160,9 +160,9 @@ H5O_group_free_copy_file_udata(void *_udata) static htri_t H5O_group_isa(struct H5O_t *oh) { - htri_t stab_exists; /* Whether the 'stab' message is in the object header */ - htri_t linfo_exists; /* Whether the 'linfo' message is in the object header */ - htri_t ret_value; /* Return value */ + htri_t stab_exists; /* Whether the 'stab' message is in the object header */ + htri_t linfo_exists; /* Whether the 'linfo' message is in the object header */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -196,8 +196,8 @@ done: static hid_t H5O_group_open(const H5G_loc_t *obj_loc, hid_t H5_ATTR_UNUSED lapl_id, hid_t dxpl_id, hbool_t app_ref) { - H5G_t *grp = NULL; /* Group opened */ - hid_t ret_value; /* Return value */ + H5G_t *grp = NULL; /* Group opened */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -235,9 +235,9 @@ done: static void * H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) { - H5G_obj_create_t *crt_info = (H5G_obj_create_t *)_crt_info; /* Group creation parameters */ - H5G_t * grp = NULL; /* New group created */ - void * ret_value; /* Return value */ + H5G_obj_create_t *crt_info = (H5G_obj_create_t *)_crt_info; /* Group creation parameters */ + H5G_t * grp = NULL; /* New group created */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -283,8 +283,8 @@ done: static H5O_loc_t * H5O_group_get_oloc(hid_t obj_id) { - H5G_t * grp; /* Group opened */ - H5O_loc_t *ret_value; /* Return value */ + H5G_t * grp; /* Group opened */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 1547292..6002ff5 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -1,4 +1,4 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Thursday, September 18, 1997 * * Purpose: This file contains declarations which are visible diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 6e37296..5b04e9d 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -35,13 +35,6 @@ #include "H5RSprivate.h" /* Reference-counted strings */ /* - * Define this to enable debugging. - */ -#ifdef NDEBUG -#undef H5G_DEBUG -#endif - -/* * The disk size for a symbol table entry... */ #define H5G_SIZEOF_SCRATCH 16 diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index a9d44cc..92323b4 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -15,7 +15,7 @@ * * Created: H5Gpublic.h * Jul 11 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Public declarations for the H5G package * @@ -37,10 +37,6 @@ /* Public Macros */ /*****************/ -#ifdef __cplusplus -extern "C" { -#endif - /*******************/ /* Public Typedefs */ /*******************/ @@ -69,6 +65,10 @@ typedef struct H5G_info_t { /*********************/ /* Public Prototypes */ /*********************/ +#ifdef __cplusplus +extern "C" { +#endif + H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id); H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id); H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id); diff --git a/src/H5Groot.c b/src/H5Groot.c index 05c9141..61d526b 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -15,7 +15,7 @@ * * Created: H5Groot.c * Apr 8 2009 - * Neil Fortner <nfortne2@hdfgroup.org> + * Neil Fortner * * Purpose: Functions for operating on the root group. * @@ -126,7 +126,6 @@ H5G_rootof(H5F_t *f) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -357,7 +356,6 @@ H5G_root_free(H5G_t *grp) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 5 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Gstab.c b/src/H5Gstab.c index e8e7526..2fe6374 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Friday, September 19, 1997 * */ @@ -118,7 +118,6 @@ typedef struct H5G_bt_it_lbi_t { * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 7 2005 * *------------------------------------------------------------------------- @@ -184,7 +183,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- @@ -241,7 +239,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@uiuc.edu * Nov 7 2005 * *------------------------------------------------------------------------- @@ -295,7 +292,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- @@ -446,8 +442,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 20, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -509,10 +503,10 @@ herr_t H5G__stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { - H5HL_t * heap = NULL; /* Local heap for group */ - H5O_stab_t stab; /* Info about symbol table */ - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; /* Return value */ + H5HL_t * heap = NULL; /* Local heap for group */ + H5O_stab_t stab; /* Info about symbol table */ + H5G_link_table_t ltable = {0, NULL}; /* Link table */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -731,7 +725,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t H5O_stab_t stab; /* Info about local heap & B-tree */ H5G_bt_it_gnbi_t udata; /* Iteration information */ hbool_t udata_valid = FALSE; /* Whether iteration information is valid */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); @@ -839,7 +833,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -847,11 +840,11 @@ done: htri_t H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { - H5HL_t * heap = NULL; /* Pointer to local heap */ - H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ - H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ - H5O_stab_t stab; /* Symbol table message */ - htri_t ret_value; /* Return value */ + H5HL_t * heap = NULL; /* Pointer to local heap */ + H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ + H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ + H5O_stab_t stab; /* Symbol table message */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -939,7 +932,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -1022,7 +1014,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Mar 17, 2009 * *------------------------------------------------------------------------- @@ -1162,9 +1153,9 @@ done: H5G_obj_t H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) { - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ - H5G_obj_t ret_value; /* Return value */ + H5O_stab_t stab; /* Info about local heap & B-tree */ + H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 9422f26..0bfa441 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Monday, October 17, 2005 * * Purpose: Group testing functions. @@ -27,12 +27,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#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 "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5Iprivate.h" /* IDs */ /****************/ /* Local Macros */ @@ -71,7 +71,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 @@ -184,7 +184,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 @@ -242,7 +242,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 @@ -290,7 +290,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 @@ -359,7 +359,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. @@ -437,7 +437,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 @@ -484,7 +484,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. @@ -578,8 +578,7 @@ done: * 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 @@ -633,7 +632,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 @@ -654,9 +653,7 @@ H5G_verify_cached_stabs_test_cb(H5F_t *f, hid_t dxpl_id, const void H5_ATTR_UNUS FUNC_ENTER_NOAPI_NOINIT - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); @@ -696,7 +693,7 @@ H5G_verify_cached_stabs_test_cb(H5F_t *f, hid_t dxpl_id, const void H5_ATTR_UNUS (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") @@ -732,7 +729,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * April 6 2011 * *------------------------------------------------------------------------- diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 043569d..6c5cbd9 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -15,7 +15,7 @@ * * Created: H5Gtraverse.c * Sep 13 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Functions for traversing group hierarchy * @@ -31,17 +31,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#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 "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 */ /****************/ /* Local Macros */ @@ -372,7 +372,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2006 * *------------------------------------------------------------------------- @@ -392,8 +391,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned HDassert(obj_loc); HDassert(nlinks); - /* - * 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. */ @@ -457,7 +455,6 @@ done: * resolved. * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -807,7 +804,6 @@ done: * traversed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 13 2005 * *------------------------------------------------------------------------- @@ -15,7 +15,7 @@ * * Created: H5HF.c * Feb 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Implements a "fractal heap" for storing variable- * length objects in a file. @@ -81,7 +81,6 @@ H5FL_DEFINE_STATIC(H5HF_t); * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -105,7 +104,6 @@ H5HF_op_read(const void *obj, size_t obj_len, void *op_data) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -130,7 +128,6 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data) * NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -138,10 +135,10 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data) H5HF_t * H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) { - H5HF_t * fh = NULL; /* Pointer to new fractal heap */ - H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - haddr_t fh_addr; /* Heap header address */ - H5HF_t * ret_value; /* Return value */ + H5HF_t * fh = NULL; /* Pointer to new fractal heap */ + H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ + haddr_t fh_addr; /* Heap header address */ + H5HF_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -197,7 +194,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 18 2006 * *------------------------------------------------------------------------- @@ -205,9 +201,9 @@ done: H5HF_t * H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) { - H5HF_t * fh = NULL; /* Pointer to new fractal heap */ - H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - H5HF_t * ret_value; /* Return value */ + H5HF_t * fh = NULL; /* Pointer to new fractal heap */ + H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ + H5HF_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -262,7 +258,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -292,7 +287,6 @@ H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 18 2006 * *------------------------------------------------------------------------- @@ -323,7 +317,6 @@ H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr_p) * filled in), negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -388,7 +381,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- @@ -455,7 +447,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 18 2006 * *------------------------------------------------------------------------- @@ -531,7 +522,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -601,7 +591,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 11 2006 * *------------------------------------------------------------------------- @@ -665,7 +654,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -729,7 +717,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -822,7 +809,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 4 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 261acab..7157c93 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -15,7 +15,7 @@ * * Created: H5HFbtree2.c * Aug 7 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: v2 B-tree callbacks for "huge" object tracker * @@ -192,9 +192,9 @@ H5FL_DEFINE_STATIC(H5HF_huge_bt2_ctx_t); static void * H5HF_huge_bt2_crt_context(void *_f) { - H5F_t * f = (H5F_t *)_f; /* User data for building callback context */ - H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ - void * ret_value; /* Return value */ + H5F_t * f = (H5F_t *)_f; /* User data for building callback context */ + H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -305,12 +305,6 @@ H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data) { FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef QAK - HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_found", - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->id); -#endif /* QAK */ *(H5HF_huge_bt2_indir_rec_t *)op_data = *(const H5HF_huge_bt2_indir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) @@ -509,14 +503,6 @@ H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data) { FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef QAK - HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_found", - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->filter_mask, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->obj_size, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->id); -#endif /* QAK */ *(H5HF_huge_bt2_filt_indir_rec_t *)op_data = *(const H5HF_huge_bt2_filt_indir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) @@ -781,10 +767,6 @@ H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2, int *result) FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef QAK - HDfprintf(stderr, "%s: rec1 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec1->addr, rec1->len); - HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->addr, rec2->len); -#endif /* QAK */ if (rec1->addr < rec2->addr) *result = -1; else if (rec1->addr > rec2->addr) @@ -906,13 +888,6 @@ H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data) { FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef QAK - HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_found", - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->filter_mask, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->obj_size); -#endif /* QAK */ *(H5HF_huge_bt2_filt_dir_rec_t *)op_data = *(const H5HF_huge_bt2_filt_dir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) @@ -998,12 +973,6 @@ H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2, int *result FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef QAK - HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec1->addr, - rec1->len, rec1->filter_mask, rec1->obj_size); - HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec2->addr, - rec2->len, rec2->filter_mask, rec2->obj_size); -#endif /* QAK */ if (rec1->addr < rec2->addr) *result = -1; else if (rec1->addr > rec2->addr) diff --git a/src/H5HFcache.c b/src/H5HFcache.c index a648e84..deb19be 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -15,7 +15,7 @@ * * Created: H5HFcache.c * Feb 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Implement fractal heap metadata cache methods. * @@ -146,7 +146,6 @@ H5FL_BLK_DEFINE(direct_block); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -195,7 +194,6 @@ H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -243,7 +241,6 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -433,7 +430,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -567,7 +563,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -613,7 +608,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -651,7 +645,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -682,7 +675,6 @@ H5HF_cache_hdr_size(const H5F_t H5_ATTR_UNUSED *f, const H5HF_hdr_t *hdr, size_t * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -887,7 +879,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -1075,7 +1066,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -1126,7 +1116,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -1164,7 +1153,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -1194,7 +1182,6 @@ H5HF_cache_iblock_size(const H5F_t H5_ATTR_UNUSED *f, const H5HF_indirect_t *ibl * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -1373,7 +1360,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -1660,7 +1646,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -1712,7 +1697,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -1750,7 +1734,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index ad041f1..b0a7d7f 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -15,7 +15,7 @@ * * Created: H5HFdbg.c * Feb 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Dump debugging information about a fractal heap * @@ -97,7 +97,6 @@ static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int i * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 28 2006 * *------------------------------------------------------------------------- @@ -155,7 +154,6 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -249,7 +247,6 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hid_t dxpl_id, hbool_t dump_internal, FILE * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -293,7 +290,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 13 2006 * *------------------------------------------------------------------------- @@ -376,7 +372,6 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 28 2006 * *------------------------------------------------------------------------- @@ -499,7 +494,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -613,7 +607,6 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 7 2006 * *------------------------------------------------------------------------- @@ -671,7 +664,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 13 2006 * *------------------------------------------------------------------------- @@ -703,10 +695,6 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) "Section address:", sect->sect_info.addr); HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, "Section size:", sect->sect_info.size); -#ifdef QAK - HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, - "Section state:", (sect->sect_info.state == H5FS_SECT_LIVE ? "live" : "serialized")); -#endif /* QAK */ /* Dump section-specific debugging information */ if (H5FS_sect_debug(udata->fspace, _sect, udata->stream, udata->indent + 3, MAX(0, udata->fwidth - 3)) < @@ -725,7 +713,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 46be310..25fd768 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -15,7 +15,7 @@ * * Created: H5HFdblock.c * Apr 10 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Direct block routines for fractal heaps. * @@ -77,7 +77,6 @@ H5FL_DEFINE(H5HF_direct_t); * Return: Pointer to new direct block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -209,7 +208,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 17 2006 * *------------------------------------------------------------------------- @@ -321,7 +319,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 13 2006 * *------------------------------------------------------------------------- @@ -422,7 +419,6 @@ done: * Return: Pointer to direct block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -431,9 +427,9 @@ H5HF_direct_t * H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry, H5AC_protect_t rw) { - H5HF_direct_t * dblock; /* Direct block from cache */ - H5HF_dblock_cache_ud_t udata; /* parent and other infor for deserializing direct block */ - H5HF_direct_t * ret_value; /* Return value */ + H5HF_direct_t * dblock; /* Direct block from cache */ + H5HF_dblock_cache_ud_t udata; /* parent and other infor for deserializing direct block */ + H5HF_direct_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -497,7 +493,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 8 2006 * *------------------------------------------------------------------------- @@ -603,7 +598,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -670,7 +664,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index 8d01eab..bb6f3f3 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -15,7 +15,7 @@ * * Created: H5HFdtable.c * Apr 10 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: "Doubling table" routines for fractal heaps. * @@ -73,7 +73,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -137,7 +136,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -153,9 +151,6 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi HDassert(dtable); HDassert(row); HDassert(col); -#ifdef QAK - HDfprintf(stderr, "%s: off = %Hu\n", "H5HF_dtable_lookup", off); -#endif /* QAK */ /* Check for offset in first row */ if (off < dtable->num_id_first_row) { @@ -166,9 +161,6 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi unsigned high_bit = H5VM_log2_gen(off); /* Determine the high bit in the offset */ hsize_t off_mask = ((hsize_t)1) << high_bit; /* Compute mask for determining column */ -#ifdef QAK - HDfprintf(stderr, "%s: high_bit = %u, off_mask = %Hu\n", "H5HF_dtable_lookup", high_bit, off_mask); -#endif /* QAK */ *row = (high_bit - dtable->first_row_bits) + 1; H5_CHECKED_ASSIGN(*col, unsigned, ((off - off_mask) / dtable->row_block_size[*row]), hsize_t); } /* end else */ @@ -184,7 +176,6 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -222,7 +213,6 @@ H5HF_dtable_dest(H5HF_dtable_t *dtable) * Return: Non-negative on success (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 25 2006 * *------------------------------------------------------------------------- @@ -230,7 +220,7 @@ H5HF_dtable_dest(H5HF_dtable_t *dtable) unsigned H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) { - unsigned row; /* Row where block will fit */ + unsigned row = 0; /* Row where block will fit */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -257,7 +247,6 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) * Return: Non-negative on success (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -265,7 +254,7 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) unsigned H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) { - unsigned rows; /* # of rows required for indirect block */ + unsigned rows = 0; /* # of rows required for indirect block */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -287,7 +276,6 @@ H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) * Return: Non-zero span size on success/zero on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 25 2006 * *------------------------------------------------------------------------- @@ -296,11 +284,11 @@ hsize_t H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned start_col, unsigned num_entries) { - unsigned start_entry; /* Entry for first block covered */ - unsigned end_row; /* Row for last block covered */ - unsigned end_col; /* Column for last block covered */ - unsigned end_entry; /* Entry for last block covered */ - hsize_t acc_span_size; /* Accumulated span size */ + unsigned start_entry; /* Entry for first block covered */ + unsigned end_row; /* Row for last block covered */ + unsigned end_col; /* Column for last block covered */ + unsigned end_entry; /* Entry for last block covered */ + hsize_t acc_span_size = 0; /* Accumulated span size */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -317,12 +305,6 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned end_entry = (start_entry + num_entries) - 1; end_row = end_entry / dtable->cparam.width; end_col = end_entry % dtable->cparam.width; -#ifdef QAK - HDfprintf(stderr, "%s: start_row = %u, start_col = %u, start_entry = %u\n", - "H5HF_sect_indirect_span_size", start_row, start_col, start_entry); - HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect_indirect_span_size", - end_row, end_col, end_entry); -#endif /* QAK */ /* Initialize accumulated span size */ acc_span_size = 0; @@ -331,7 +313,7 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned /* Check for multi-row span */ if (start_row != end_row) { - /* Accomodate partial starting row */ + /* Accommodate partial starting row */ if (start_col > 0) { acc_span_size = dtable->row_block_size[start_row] * (dtable->cparam.width - start_col); start_row++; @@ -343,7 +325,7 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned start_row++; } /* end while */ - /* Accomodate partial ending row */ + /* Accommodate partial ending row */ acc_span_size += dtable->row_block_size[start_row] * (end_col + 1); } /* end if */ else { @@ -351,8 +333,5 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned acc_span_size = dtable->row_block_size[start_row] * ((end_col - start_col) + 1); } /* end else */ -#ifdef QAK - HDfprintf(stderr, "%s: acc_span_size = %Hu\n", "H5HF_dtable_span_size", acc_span_size); -#endif /* QAK */ FUNC_LEAVE_NOAPI(acc_span_size) } /* end H5HF_sect_indirect_span_size() */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 0ddd072..7a0bc79 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -15,7 +15,7 @@ * * Created: H5HFhdr.c * Apr 10 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Heap header routines for fractal heaps. * @@ -45,13 +45,13 @@ /* Limit on the size of the max. direct block size */ /* (This is limited to 32-bits currently, because I think it's unlikely to * need to be larger, the 32-bit limit for H5VM_log2_of2(n), and - * some offsets/sizes are encoded with a maxiumum of 32-bits - QAK) + * some offsets/sizes are encoded with a maximum of 32-bits - QAK) */ #define H5HF_MAX_DIRECT_SIZE_LIMIT ((hsize_t)2 * 1024 * 1024 * 1024) /* Limit on the width of the doubling table */ /* (This is limited to 16-bits currently, because I think it's unlikely to - * need to be larger, and its encoded with a maxiumum of 16-bits - QAK) + * need to be larger, and its encoded with a maximum of 16-bits - QAK) */ #define H5HF_WIDTH_LIMIT (64 * 1024) #endif /* NDEBUG */ @@ -91,7 +91,6 @@ H5FL_DEFINE_STATIC(H5HF_hdr_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- @@ -99,8 +98,8 @@ H5FL_DEFINE_STATIC(H5HF_hdr_t); H5HF_hdr_t * H5HF_hdr_alloc(H5F_t *f) { - H5HF_hdr_t *hdr = NULL; /* Shared fractal heap header */ - H5HF_hdr_t *ret_value; /* Return value */ + H5HF_hdr_t *hdr = NULL; /* Shared fractal heap header */ + H5HF_hdr_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -134,7 +133,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- @@ -186,7 +184,6 @@ H5HF_hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2006 * *------------------------------------------------------------------------- @@ -224,7 +221,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2006 * *------------------------------------------------------------------------- @@ -279,7 +275,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- @@ -316,7 +311,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- @@ -324,9 +318,9 @@ done: haddr_t H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) { - H5HF_hdr_t *hdr = NULL; /* The new fractal heap header information */ - size_t dblock_overhead; /* Direct block's overhead */ - haddr_t ret_value; /* Return value */ + H5HF_hdr_t *hdr = NULL; /* The new fractal heap header information */ + size_t dblock_overhead; /* Direct block's overhead */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -515,7 +509,6 @@ done: * Return: Pointer to indirect block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 5 2010 * *------------------------------------------------------------------------- @@ -523,9 +516,9 @@ done: H5HF_hdr_t * H5HF_hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw) { - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ - H5HF_hdr_t * hdr; /* Fractal heap header */ - H5HF_hdr_t * ret_value; /* Return value */ + H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + H5HF_hdr_t * hdr; /* Fractal heap header */ + H5HF_hdr_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -562,7 +555,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -597,7 +589,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -635,7 +626,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 1 2006 * *------------------------------------------------------------------------- @@ -662,7 +652,6 @@ H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 1 2006 * *------------------------------------------------------------------------- @@ -690,7 +679,6 @@ H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -727,7 +715,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- @@ -764,7 +751,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 10 2006 * *------------------------------------------------------------------------- @@ -803,7 +789,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 23 2006 * *------------------------------------------------------------------------- @@ -833,7 +818,6 @@ H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- @@ -870,7 +854,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -906,7 +889,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 3 2006 * *------------------------------------------------------------------------- @@ -958,7 +940,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 14 2006 * *------------------------------------------------------------------------- @@ -1153,7 +1134,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 23 2006 * *------------------------------------------------------------------------- @@ -1192,7 +1172,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -1344,7 +1323,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 17 2006 * *------------------------------------------------------------------------- @@ -1391,7 +1369,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- @@ -1432,7 +1409,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 5 2007 * *------------------------------------------------------------------------- @@ -1469,11 +1445,10 @@ H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) /* (must occur before attempting to delete the heap, so indirect blocks * will get unpinned) */ - if (H5F_addr_defined(hdr->fs_addr)) { + if (H5F_addr_defined(hdr->fs_addr)) /* Delete free space manager for heap */ if (H5HF_space_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap free space manager") - } /* end if */ /* Check for root direct/indirect block */ if (H5F_addr_defined(hdr->man_dtable.table_addr)) { diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 83634e8..a2b23e3 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -15,7 +15,7 @@ * * Created: H5HFhuge.c * Aug 7 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Routines for "huge" objects in fractal heap * @@ -86,7 +86,6 @@ static herr_t H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -166,7 +165,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -187,10 +185,6 @@ H5HF_huge_init(H5HF_hdr_t *hdr) * the file in the heap ID (which will speed up accessing it) and we don't * have any I/O pipeline filters. */ -#ifdef QAK - HDfprintf(stderr, "%s: hdr->id_len = %u\n", "H5HF_huge_init", (unsigned)hdr->id_len); - HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr->filter_len); -#endif /* QAK */ if (hdr->filter_len > 0) { if ((hdr->id_len - 1) >= (unsigned)(hdr->sizeof_addr + hdr->sizeof_size + 4 + hdr->sizeof_size)) { /* Indicate that v2 B-tree doesn't have to be used to locate object */ @@ -240,7 +234,6 @@ H5HF_huge_init(H5HF_hdr_t *hdr) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 15 2006 * *------------------------------------------------------------------------- @@ -248,8 +241,8 @@ H5HF_huge_init(H5HF_hdr_t *hdr) static hsize_t H5HF_huge_new_id(H5HF_hdr_t *hdr) { - hsize_t new_id; /* New object's ID */ - hsize_t ret_value; /* Return value */ + hsize_t new_id; /* New object's ID */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -287,7 +280,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -349,11 +341,6 @@ H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, void *obj, voi if (H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed") -#ifdef QAK - HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, - write_buf); - HDfprintf(stderr, "%s: obj_size = %Zu, obj = %p\n", FUNC, obj_size, obj); -#endif /* QAK */ /* Update size of object on disk */ write_size = nbytes; @@ -387,10 +374,6 @@ H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, void *obj, voi obj_rec.len = write_size; obj_rec.filter_mask = filter_mask; obj_rec.obj_size = obj_size; -#ifdef QAK - HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len, - obj_rec.filter_mask, obj_rec.obj_size); -#endif /* QAK */ /* Insert record for object in v2 B-tree */ if (H5B2_insert(hdr->huge_bt2, dxpl_id, &obj_rec) < 0) @@ -410,9 +393,6 @@ H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, void *obj, voi /* Initialize record for tracking object in v2 B-tree */ obj_rec.addr = obj_addr; obj_rec.len = write_size; -#ifdef QAK - HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); -#endif /* QAK */ /* Insert record for object in v2 B-tree */ if (H5B2_insert(hdr->huge_bt2, dxpl_id, &obj_rec) < 0) @@ -442,11 +422,6 @@ H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, void *obj, voi filt_indir_rec.filter_mask = filter_mask; filt_indir_rec.obj_size = obj_size; filt_indir_rec.id = new_id; -#ifdef QAK - HDfprintf(stderr, "%s: filt_indir_rec = {%a, %Hu, %x, %Hu, %Hu}\n", FUNC, filt_indir_rec.addr, - filt_indir_rec.len, filt_indir_rec.filter_mask, filt_indir_rec.obj_size, - filt_indir_rec.id); -#endif /* QAK */ /* Set pointer to record to insert */ ins_rec = &filt_indir_rec; @@ -456,10 +431,6 @@ H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, void *obj, voi indir_rec.addr = obj_addr; indir_rec.len = write_size; indir_rec.id = new_id; -#ifdef QAK - HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indir_rec.len, - indir_rec.id); -#endif /* QAK */ /* Set pointer to record to insert */ ins_rec = &indir_rec; @@ -494,7 +465,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -586,7 +556,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -735,7 +704,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 21 2007 * *------------------------------------------------------------------------- @@ -813,7 +781,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -848,7 +815,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -883,7 +849,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -992,7 +957,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -1055,7 +1019,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 261c190..394c44e 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -15,7 +15,7 @@ * * Created: H5HFiblock.c * Apr 10 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Indirect block routines for fractal heaps. * @@ -90,7 +90,6 @@ H5FL_SEQ_DEFINE(H5HF_indirect_ptr_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -156,7 +155,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -222,7 +220,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -258,7 +255,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -336,7 +332,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- @@ -367,7 +362,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -508,7 +502,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -565,20 +558,10 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ - if (!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) { - /* Currently, the old block data is "thrown away" after the space is reallocated, - * to avoid data copy in H5MF_realloc() call by just free'ing the space and - * allocating new space. - * - * This also keeps the file smaller, by freeing the space and then - * allocating new space, instead of vice versa (in H5MF_realloc). - * - * QAK - 3/14/2006 - */ + if (!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) /* Free previous indirect block disk space */ if (H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") - } /* end if */ /* Compute size of buffer needed for new indirect block */ iblock->nrows = new_nrows; @@ -615,11 +598,10 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries") /* Check for skipping over rows and add free section for skipped rows */ - if (skip_direct_rows) { + if (skip_direct_rows) /* Add skipped blocks to heap's free space */ if (H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, (new_next_entry - next_entry)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") - } /* end if */ /* Initialize new direct block entries in rows added */ acc_dblock_free = 0; @@ -703,7 +685,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jun 12 2006 * *------------------------------------------------------------------------- @@ -736,20 +717,10 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ - if (!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) { - /* Currently, the old block data is "thrown away" after the space is reallocated, - * to avoid data copy in H5MF_realloc() call by just free'ing the space and - * allocating new space. - * - * This also keeps the file smaller, by freeing the space and then - * allocating new space, instead of vice versa (in H5MF_realloc). - * - * QAK - 6/12/2006 - */ + if (!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) /* Free previous indirect block disk space */ if (H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") - } /* end if */ /* Compute free space in rows to delete */ acc_dblock_free = 0; @@ -849,7 +820,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -931,7 +901,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -996,7 +965,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -1138,7 +1106,6 @@ done: * Return: Pointer to indirect block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -1151,7 +1118,7 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, uns H5HF_parent_t par_info; /* Parent info for loading block */ H5HF_indirect_t *iblock = NULL; /* Indirect block from cache */ hbool_t should_protect = FALSE; /* Whether we should protect the indirect block or not */ - H5HF_indirect_t *ret_value; /* Return value */ + H5HF_indirect_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1264,7 +1231,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -1316,7 +1282,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- @@ -1380,7 +1345,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -1499,7 +1463,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -1533,7 +1496,6 @@ H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *chi * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -1713,7 +1675,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFiter.c b/src/H5HFiter.c index 50d93c2..cbdb919 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -15,7 +15,7 @@ * * Created: H5HFiter.c * Apr 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Block iteration routines for fractal heaps. * @@ -77,7 +77,6 @@ H5FL_DEFINE(H5HF_block_loc_t); * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -107,7 +106,6 @@ H5HF_man_iter_init(H5HF_block_iter_t *biter) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -265,7 +263,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -297,7 +294,6 @@ H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigne * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -357,7 +353,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -417,7 +412,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -452,7 +446,6 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -499,7 +492,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -554,7 +546,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -592,7 +583,6 @@ H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsig * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 25 2006 * *------------------------------------------------------------------------- @@ -631,7 +621,6 @@ H5HF_man_iter_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t *offset) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 25 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFman.c b/src/H5HFman.c index e0293fb..b9b819b 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -15,7 +15,7 @@ * * Created: H5HFman.c * Feb 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: "Managed" object routines for fractal heaps. * @@ -89,7 +89,6 @@ static herr_t H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 13 2006 * *------------------------------------------------------------------------- @@ -218,7 +217,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 17 2006 * *------------------------------------------------------------------------- @@ -368,7 +366,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 17 2006 * *------------------------------------------------------------------------- @@ -403,7 +400,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -439,7 +435,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -474,7 +469,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index aa80c52..ee06294 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Friday, February 24, 2006 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 4b0edf8..afcc828 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -15,7 +15,7 @@ * * Created: H5HFprivate.h * Feb 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Private header for library accessible fractal heap routines. * diff --git a/src/H5HFpublic.h b/src/H5HFpublic.h index aa7903d..73388c0 100644 --- a/src/H5HFpublic.h +++ b/src/H5HFpublic.h @@ -15,7 +15,7 @@ * * Created: H5HFpublic.h * Feb 24 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Public declarations for the fractal heap package. * diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 2d4234f..d363a70 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Monday, May 1, 2006 * - * Purpose: Free space section routines for fractal heaps. + * Purpose: Free space section routines for fractal heaps * */ @@ -372,8 +372,8 @@ done: static H5HF_free_section_t * H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5FS_section_state_t sect_state) { - H5HF_free_section_t *new_sect; /* New section */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *new_sect; /* New section */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -444,7 +444,6 @@ done: * Return: Pointer to new section on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- @@ -452,8 +451,8 @@ done: H5HF_free_section_t * H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry) { - H5HF_free_section_t *sect = NULL; /* 'Single' free space section to add */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *sect = NULL; /* 'Single' free space section to add */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -496,7 +495,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * October 24 2006 * *------------------------------------------------------------------------- @@ -551,15 +549,14 @@ done: } /* end H5HF_sect_single_locate_parent() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_revive + * Function: H5HF_sect_single_revive * - * Purpose: Update the memory information for a 'single' free section + * Purpose: Update the memory information for a 'single' free section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 8 2006 + * Programmer: Quincey Koziol + * May 8 2006 * *------------------------------------------------------------------------- */ @@ -598,15 +595,14 @@ done: } /* end H5HF_sect_single_revive() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_dblock_info + * Function: H5HF_sect_single_dblock_info * - * Purpose: Retrieve the direct block information for a single section + * Purpose: Retrieve the direct block information for a single section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * October 24 2006 + * Programmer: Quincey Koziol + * October 24 2006 * *------------------------------------------------------------------------- */ @@ -653,7 +649,6 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -1097,11 +1092,10 @@ H5HF_sect_single_free(H5FS_section_info_t *_sect) HDassert(sect); /* Check for live reference to an indirect block */ - if (sect->sect_info.state == H5FS_SECT_LIVE) { + if (sect->sect_info.state == H5FS_SECT_LIVE) /* Get parent indirect block, if there was one */ if (sect->u.single.parent) parent = sect->u.single.parent; - } /* end if */ /* Release the section */ if (H5HF_sect_node_free(sect, parent) < 0) @@ -1216,8 +1210,8 @@ static H5HF_free_section_t * H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsigned row, unsigned col, unsigned nentries, H5HF_free_section_t *under_sect) { - H5HF_free_section_t *sect = NULL; /* 'Row' section created */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *sect = NULL; /* 'Row' section created */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1255,7 +1249,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -1302,7 +1295,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -1341,7 +1333,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -1415,7 +1406,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -1456,7 +1446,6 @@ done: * Return: Pointer to indirect block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 9 2006 * *------------------------------------------------------------------------- @@ -1620,8 +1609,8 @@ static H5FS_section_info_t * H5HF_sect_row_deserialize(const H5FS_section_class_t *cls, hid_t dxpl_id, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags) { - H5HF_hdr_t * hdr; /* Fractal heap header */ - H5FS_section_info_t *ret_value; /* Return value */ + H5HF_hdr_t * hdr; /* Fractal heap header */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2025,7 +2014,6 @@ H5HF_sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, * Return: Offset of indirect block in "heap space" (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2056,7 +2044,6 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) * Return: Pointer to the top indirect section (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2159,7 +2146,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2228,7 +2214,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2236,8 +2221,8 @@ done: static H5HF_free_section_t * H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_section_t *row_sect) { - H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2291,7 +2276,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2548,7 +2532,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 3 2006 * *------------------------------------------------------------------------- @@ -2625,7 +2608,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2676,7 +2658,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 3 2006 * *------------------------------------------------------------------------- @@ -2743,7 +2724,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -2802,7 +2782,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -3074,7 +3053,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -3312,7 +3290,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/<can't fail> * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 17 2006 * *------------------------------------------------------------------------- @@ -3346,7 +3323,6 @@ H5HF_sect_indirect_is_first(H5HF_free_section_t *sect) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -3397,7 +3373,6 @@ done: * Return: Pointer to indirect block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 9 2006 * *------------------------------------------------------------------------- @@ -3850,7 +3825,6 @@ done: * Purpose: Deserialize a buffer into a "live" indirect section * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol @@ -3862,16 +3836,16 @@ static H5FS_section_info_t * H5HF_sect_indirect_deserialize(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags) { - H5HF_free_section_t *new_sect; /* New indirect section */ - hsize_t iblock_off; /* Indirect block's offset */ - unsigned start_row; /* Indirect section's start row */ - unsigned start_col; /* Indirect section's start column */ - unsigned nentries; /* Indirect section's number of entries */ - unsigned start_entry; /* Start entry in indirect block */ - unsigned end_entry; /* End entry in indirect block */ - unsigned end_row; /* End row in indirect block */ - unsigned end_col; /* End column in indirect block */ - H5FS_section_info_t *ret_value; /* Return value */ + H5HF_free_section_t *new_sect; /* New indirect section */ + hsize_t iblock_off; /* Indirect block's offset */ + unsigned start_row; /* Indirect section's start row */ + unsigned start_col; /* Indirect section's start column */ + unsigned nentries; /* Indirect section's number of entries */ + unsigned start_entry; /* Start entry in indirect block */ + unsigned end_entry; /* End entry in indirect block */ + unsigned end_row; /* End row in indirect block */ + unsigned end_col; /* End column in indirect block */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -3953,11 +3927,10 @@ H5HF_sect_indirect_free(H5HF_free_section_t *sect) sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); /* Check for live reference to an indirect block */ - if (sect->sect_info.state == H5FS_SECT_LIVE) { + if (sect->sect_info.state == H5FS_SECT_LIVE) /* Get indirect block, if there was one */ if (sect->u.indirect.u.iblock) iblock = sect->u.indirect.u.iblock; - } /* end if */ /* Release the sections */ if (H5HF_sect_node_free(sect, iblock) < 0) diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 7e9f89e..4544975 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -15,7 +15,7 @@ * * Created: H5HFspace.c * May 2 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Space allocation routines for fractal heaps. * @@ -80,14 +80,8 @@ * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Pass values of alignment and threshold to FS_create() and FS_open() - * for handling alignment. - * *------------------------------------------------------------------------- */ herr_t @@ -147,7 +141,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -189,11 +182,9 @@ done: * Purpose: Attempt to find space in a fractal heap * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -202,7 +193,7 @@ htri_t H5HF_space_find(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t request, H5HF_free_section_t **node) { htri_t node_found = FALSE; /* Whether an existing free list node was found */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -242,7 +233,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- @@ -287,7 +277,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -305,11 +294,10 @@ H5HF_space_revert_root(const H5HF_hdr_t *hdr, hid_t dxpl_id) HDassert(hdr); /* Only need to scan the sections if the free space has been initialized */ - if (hdr->fspace) { - /* Iterate over all sections, reseting the parent pointers in 'single' sections */ + if (hdr->fspace) + /* Iterate over all sections, resetting the parent pointers in 'single' sections */ if (H5FS_sect_iterate(hdr->f, dxpl_id, 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") - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -326,7 +314,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- @@ -379,7 +366,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- @@ -398,12 +384,11 @@ H5HF_space_create_root(const H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *ro HDassert(root_iblock); /* Only need to scan the sections if the free space has been initialized */ - if (hdr->fspace) { + if (hdr->fspace) /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect * block */ if (H5FS_sect_iterate(hdr->f, dxpl_id, 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") - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -418,7 +403,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14 2007 * *------------------------------------------------------------------------- @@ -462,7 +446,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 24 2006 * *------------------------------------------------------------------------- @@ -499,7 +482,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -523,9 +505,6 @@ H5HF_space_close(H5HF_hdr_t *hdr, hid_t dxpl_id) /* Retrieve the number of sections for this heap */ if (H5FS_sect_stats(hdr->fspace, NULL, &nsects) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOUNT, FAIL, "can't query free space section count") -#ifdef QAK - HDfprintf(stderr, "%s: nsects = %Hu\n", FUNC, nsects); -#endif /* QAK */ /* Close the free space for the heap */ if (H5FS_close(hdr->f, dxpl_id, hdr->fspace) < 0) @@ -553,7 +532,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 7 2006 * *------------------------------------------------------------------------- @@ -588,7 +566,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -599,9 +576,6 @@ H5HF_space_sect_change_class(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT -#ifdef QAK - HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ /* * Check arguments. diff --git a/src/H5HFstat.c b/src/H5HFstat.c index 328b1d7..e428df9 100644 --- a/src/H5HFstat.c +++ b/src/H5HFstat.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Monday, March 6, 2006 * * Purpose: Fractal heap metadata statistics functions. diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 6a4e292..faea9b8 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Thursday, February 3, 2006 * * Purpose: Fractal heap testing functions. @@ -177,24 +177,19 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) /* Don't worry about comparing the filter names right now... */ /* (they are expanded during the encode/decode process, but aren't copied - * during the H5Z_append operation, generating false positive failures) + * during the H5Z_append operation, generating false positive failures -QAK) */ -#ifdef QAK +#if 0 /* Check filter name */ - HDfprintf(stderr, "%s: Check 1.0\n", "H5HF_cmp_cparam_test"); - HDfprintf(stderr, "%s: cparam1->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam_test", u, - (cparam1->pline.filter[u].name ? cparam1->pline.filter[u].name : "<nil>")); - HDfprintf(stderr, "%s: cparam2->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam_test", u, - (cparam2->pline.filter[u].name ? cparam2->pline.filter[u].name : "<nil>")); - if (!cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) + if(!cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) HGOTO_DONE(-1) - else if (cparam1->pline.filter[u].name && !cparam2->pline.filter[u].name) + else if(cparam1->pline.filter[u].name && !cparam2->pline.filter[u].name) HGOTO_DONE(1) - else if (cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) { - if ((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name))) + else if(cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) { + if((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name))) HGOTO_DONE(ret_value) } /* end if */ -#endif /* QAK */ +#endif /* Check # of filter parameters */ if (cparam1->pline.filter[u].cd_nelmts < cparam2->pline.filter[u].cd_nelmts) @@ -234,7 +229,7 @@ done: unsigned H5HF_get_max_root_rows(const H5HF_t *fh) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -264,7 +259,7 @@ H5HF_get_max_root_rows(const H5HF_t *fh) unsigned H5HF_get_dtable_width_test(const H5HF_t *fh) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -294,7 +289,7 @@ H5HF_get_dtable_width_test(const H5HF_t *fh) unsigned H5HF_get_dtable_max_drows_test(const H5HF_t *fh) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -328,7 +323,7 @@ H5HF_get_dtable_max_drows_test(const H5HF_t *fh) unsigned H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -359,7 +354,7 @@ H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos) hsize_t H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row) { - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -390,7 +385,7 @@ H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row) hsize_t H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row) { - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 3c18933..b130199 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5HFtiny.c - * Aug 14 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5HFtiny.c + * Aug 14 2006 + * Quincey Koziol * - * Purpose: Routines for "tiny" objects in fractal heap + * Purpose: Routines for "tiny" objects in fractal heap * *------------------------------------------------------------------------- */ @@ -31,9 +31,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HFpkg.h" /* Fractal heaps */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HFpkg.h" /* Fractal heaps */ /****************/ /* Local Macros */ @@ -41,10 +41,10 @@ /* Tiny object length information */ #define H5HF_TINY_LEN_SHORT 16 /* Max. length able to be encoded in first heap ID byte */ -#define H5HF_TINY_MASK_SHORT 0x0F /* Mask for length in first heap ID byte */ -#define H5HF_TINY_MASK_EXT 0x0FFF /* Mask for length in two heap ID bytes */ -#define H5HF_TINY_MASK_EXT_1 0x0F00 /* Mask for length in first byte of two heap ID bytes */ -#define H5HF_TINY_MASK_EXT_2 0x00FF /* Mask for length in second byte of two heap ID bytes */ +#define H5HF_TINY_MASK_SHORT 0x0F /* Mask for length in first heap ID byte */ +#define H5HF_TINY_MASK_EXT 0x0FFF /* Mask for length in two heap ID bytes */ +#define H5HF_TINY_MASK_EXT_1 0x0F00 /* Mask for length in first byte of two heap ID bytes */ +#define H5HF_TINY_MASK_EXT_2 0x00FF /* Mask for length in second byte of two heap ID bytes */ /******************/ /* Local Typedefs */ @@ -72,15 +72,14 @@ static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operato /*******************/ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_init + * Function: H5HF_tiny_init * - * Purpose: Initialize information for tracking 'tiny' objects + * Purpose: Initialize information for tracking 'tiny' objects * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Aug 14 2006 + * Programmer: Quincey Koziol + * Aug 14 2006 * *------------------------------------------------------------------------- */ @@ -118,15 +117,14 @@ H5HF_tiny_init(H5HF_hdr_t *hdr) } /* end H5HF_tiny_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_insert + * Function: H5HF_tiny_insert * - * Purpose: Pack a 'tiny' object in a heap ID + * Purpose: Pack a 'tiny' object in a heap ID * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Aug 14 2006 + * Programmer: Quincey Koziol + * Aug 14 2006 * *------------------------------------------------------------------------- */ @@ -138,9 +136,6 @@ H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT -#ifdef QAK - HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ /* * Check arguments. @@ -180,15 +175,14 @@ done: } /* end H5HF_tiny_insert() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_get_obj_len + * Function: H5HF_tiny_get_obj_len * - * Purpose: Get the size of a 'tiny' object in a fractal heap + * Purpose: Get the size of a 'tiny' object in a fractal heap * - * Return: SUCCEED/FAIL + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Aug 14 2006 + * Programmer: Quincey Koziol + * Aug 14 2006 * *------------------------------------------------------------------------- */ @@ -222,15 +216,14 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) } /* end H5HF_tiny_get_obj_len() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_op_real + * Function: H5HF_tiny_op_real * - * Purpose: Internal routine to perform operation on 'tiny' object + * Purpose: Internal routine to perform operation on 'tiny' object * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2006 + * Programmer: Quincey Koziol + * Sep 11 2006 * *------------------------------------------------------------------------- */ @@ -270,7 +263,7 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * */ id++; id++; - } /* end else */ + } /* Call the user's 'op' callback */ if (op(id, (enc_obj_size + 1), op_data) < 0) @@ -281,15 +274,14 @@ done: } /* end H5HF_tiny_op_real() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_read + * Function: H5HF_tiny_read * - * Purpose: Read a 'tiny' object from the heap + * Purpose: Read a 'tiny' object from the heap * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Aug 8 2006 + * Programmer: Quincey Koziol + * Aug 8 2006 * *------------------------------------------------------------------------- */ @@ -316,15 +308,14 @@ done: } /* end H5HF_tiny_read() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_op + * Function: H5HF_tiny_op * - * Purpose: Operate directly on a 'tiny' object + * Purpose: Operate directly on a 'tiny' object * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Sept 11 2006 + * Programmer: Quincey Koziol + * Sept 11 2006 * *------------------------------------------------------------------------- */ @@ -351,15 +342,14 @@ done: } /* end H5HF_tiny_op() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_remove + * Function: H5HF_tiny_remove * - * Purpose: Remove a 'tiny' object from the heap statistics + * Purpose: Remove a 'tiny' object from the heap statistics * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Aug 14 2006 + * Programmer: Quincey Koziol + * Aug 14 2006 * *------------------------------------------------------------------------- */ @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Friday, March 27, 1998 * * Purpose: Operations on the global heap. The global heap is the set of @@ -709,13 +709,6 @@ done: * Programmer: Robb Matzke * Monday, March 30, 1998 * - * Modifications: - * - * John Mainzer - 6/8/05 - * Modified function to use the dirtied parameter of - * H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ herr_t @@ -795,11 +788,11 @@ done: } /* end H5HG_remove() */ /*------------------------------------------------------------------------- - * 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 diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 3d25bc0..f10a68f 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -15,7 +15,7 @@ * * Created: H5HGcache.c * Feb 5 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Implement global heap metadata cache methods. * @@ -210,16 +210,15 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) heap->obj[idx].begin = begin; /* - * The total storage size includes the size of the object header - * and is zero padded so the next object header is properly - * aligned. The entire obj array was calloc'ed, so no need to zero - * the space here. The last bit of space is the free space object - * whose size is never padded and already includes the object - * header. + * The total storage size includes the size of the object + * header and is zero padded so the next object header is + * properly aligned. The entire obj array was calloc'ed, + * so no need to zero the space here. The last bit of space + * is the free space object whose size is never padded and + * already includes the object header. */ if (idx > 0) { need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(heap->obj[idx].size); - if (idx > max_idx) max_idx = idx; } /* end if */ @@ -237,6 +236,7 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) else heap->nused = 1; + /* Sanity check */ HDassert(max_idx < heap->nused); /* Add the new heap to the CWFS list for the file */ @@ -259,7 +259,8 @@ done: * Purpose: Flushes a global heap collection from memory to disk if it's * dirty. Optionally deletes teh heap from memory. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * * Programmer: Robb Matzke * Friday, March 27, 1998 @@ -299,7 +300,8 @@ done: * * Purpose: Destroys a global heap collection in memory * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * * Programmer: Quincey Koziol * Wednesday, January 15, 2003 @@ -343,7 +345,8 @@ done: * * Purpose: Mark a global heap in memory as non-dirty. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * * Programmer: Quincey Koziol * Thursday, March 20, 2003 @@ -378,7 +381,8 @@ done: * H5HG_heap_t on disk, and return it in *len_ptr. On failure, * the value of *len_ptr is undefined. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * * Programmer: John Mainzer * 5/13/04 diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index 885f9cf..867aa5e 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: Global Heap object debugging functions. @@ -68,7 +68,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Mar 27, 1998 * *------------------------------------------------------------------------- diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 8c7239e..78f6611 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: This file contains declarations which are visible @@ -110,9 +110,9 @@ H5FL_BLK_EXTERN(gheap_chunk); /****************************/ typedef struct H5HG_obj_t { - int nrefs; /*reference count */ - size_t size; /*total size of object */ - uint8_t *begin; /*ptr to object into heap->chunk*/ + int nrefs; /* reference count */ + size_t size; /* total size of object */ + uint8_t *begin; /* ptr to object into heap->chunk */ } H5HG_obj_t; /* Forward declarations for fields */ diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 1c80efa..6e2b0f9 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Friday, March 27, 1998 */ #ifndef _H5HGprivate_H diff --git a/src/H5HGpublic.h b/src/H5HGpublic.h index fcec593..acb48a2 100644 --- a/src/H5HGpublic.h +++ b/src/H5HGpublic.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Friday, March 27, 1998 */ #ifndef _H5HGpublic_H diff --git a/src/H5HGquery.c b/src/H5HGquery.c index 9e4862d..e1d1ad1 100644 --- a/src/H5HGquery.c +++ b/src/H5HGquery.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Wednesday, July 20, 2011 * * Purpose: Query routines for global heaps. @@ -13,12 +13,12 @@ /*------------------------------------------------------------------------- * - * Created: H5HL.c - * Jul 16 1997 - * Robb Matzke <matzke@llnl.gov> + * Created: H5HL.c + * Jul 16 1997 + * Robb Matzke * - * Purpose: Heap functions for the local heaps used by symbol - * tables to store names (among other things). + * Purpose: Heap functions for the local heaps used by symbol + * tables to store names (among other things). * *------------------------------------------------------------------------- */ @@ -32,11 +32,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5HLpkg.h" /* Local Heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5HLpkg.h" /* Local Heaps */ +#include "H5MFprivate.h" /* File memory management */ /****************/ /* Local Macros */ @@ -78,23 +78,21 @@ H5FL_BLK_DEFINE(lheap_chunk); /*******************/ /*------------------------------------------------------------------------- - * Function: H5HL_create + * Function: H5HL_create * - * Purpose: Creates a new heap data structure on disk and caches it - * in memory. SIZE_HINT is a hint for the initial size of the - * data area of the heap. If size hint is invalid then a - * reasonable (but probably not optimal) size will be chosen. - * If the heap ever has to grow, then REALLOC_HINT is the - * minimum amount by which the heap will grow. + * Purpose: Creates a new heap data structure on disk and caches it + * in memory. SIZE_HINT is a hint for the initial size of the + * data area of the heap. If size hint is invalid then a + * reasonable (but probably not optimal) size will be chosen. + * If the heap ever has to grow, then REALLOC_HINT is the + * minimum amount by which the heap will grow. * - * Return: Success: Non-negative. The file address of new heap is - * returned through the ADDR argument. + * Return: Success: SUCCEED. The file address of new heap is + * returned through the ADDR argument. + * Failure: FAIL. addr_p will be HADDR_UNDEF. * - * Failure: Negative - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 16 1997 + * Programmer: Robb Matzke + * Jul 16 1997 * *------------------------------------------------------------------------- */ @@ -188,7 +186,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -296,11 +293,9 @@ done: * Purpose: Go through the heap's freelist and determine if we can * eliminate the free blocks at the tail of the buffer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 16, 2003 * *------------------------------------------------------------------------- @@ -420,7 +415,6 @@ done: * Failure: NULL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- @@ -506,13 +500,12 @@ done: * Function: H5HL_offset_into * * Purpose: Called directly after the call to H5HL_protect so that - * a pointer to the object in the heap can be got. + * a pointer to the object in the heap can be obtained. * * Return: Success: Valid pointer. - * Failure: NULL + * Failure: Can't fail * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- @@ -539,11 +532,9 @@ done: * * Purpose: Unprotect the data retrieved by the H5HL_protect call. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- @@ -585,16 +576,15 @@ done: } /* end H5HL_unprotect() */ /*------------------------------------------------------------------------- - * Function: H5HL_remove_free + * Function: H5HL_remove_free * - * Purpose: Removes free list element FL from the specified heap and - * frees it. + * Purpose: Removes free list element FL from the specified heap and + * frees it. * - * Return: NULL + * Return: NULL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 17 1997 + * Programmer: Robb Matzke + * Jul 17 1997 * *------------------------------------------------------------------------- */ @@ -615,16 +605,14 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) } /* end H5HL_remove_free() */ /*------------------------------------------------------------------------- - * Function: H5HL_dirty + * Function: H5HL_dirty * - * Purpose: Mark heap as dirty + * Purpose: Mark heap as dirty * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ @@ -657,16 +645,15 @@ done: } /* end H5HL_dirty() */ /*------------------------------------------------------------------------- - * Function: H5HL_insert + * Function: H5HL_insert * - * Purpose: Inserts a new item into the heap. + * Purpose: Inserts a new item into the heap. * - * Return: Success: Offset of new item within heap. - * Failure: UFAIL + * Return: Success: Offset of new item within heap. + * Failure: UFAIL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 17 1997 + * Programmer: Robb Matzke + * Jul 17 1997 * *------------------------------------------------------------------------- */ @@ -865,26 +852,25 @@ done: } /* H5HL_insert() */ /*------------------------------------------------------------------------- - * Function: H5HL_remove + * Function: H5HL_remove * - * Purpose: Removes an object or part of an object from the heap at - * address ADDR of file F. The object (or part) to remove - * begins at byte OFFSET from the beginning of the heap and - * continues for SIZE bytes. + * Purpose: Removes an object or part of an object from the heap at + * address ADDR of file F. The object (or part) to remove + * begins at byte OFFSET from the beginning of the heap and + * continues for SIZE bytes. * - * Once part of an object is removed, one must not attempt - * to access that part. Removing the beginning of an object - * results in the object OFFSET increasing by the amount - * truncated. Removing the end of an object results in - * object truncation. Removing the middle of an object results - * in two separate objects, one at the original offset and - * one at the first offset past the removed portion. + * Once part of an object is removed, one must not attempt + * to access that part. Removing the beginning of an object + * results in the object OFFSET increasing by the amount + * truncated. Removing the end of an object results in + * object truncation. Removing the middle of an object results + * in two separate objects, one at the original offset and + * one at the first offset past the removed portion. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 16 1997 + * Programmer: Robb Matzke + * Jul 16 1997 * *------------------------------------------------------------------------- */ @@ -1017,15 +1003,14 @@ done: } /* end H5HL_remove() */ /*------------------------------------------------------------------------- - * Function: H5HL_delete + * Function: H5HL_delete * - * Purpose: Deletes a local heap from disk, freeing disk space used. + * Purpose: Deletes a local heap from disk, freeing disk space used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 22 2003 + * Programmer: Quincey Koziol + * Mar 22 2003 * *------------------------------------------------------------------------- */ @@ -1095,15 +1080,14 @@ done: } /* end H5HL_delete() */ /*------------------------------------------------------------------------- - * Function: H5HL_get_size + * Function: H5HL_get_size * - * Purpose: Retrieves the current size of a heap + * Purpose: Retrieves the current size of a heap * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Nov 7 2005 + * Programmer: Quincey Koziol + * Nov 7 2005 * *------------------------------------------------------------------------- */ @@ -1152,7 +1136,7 @@ done: * Purpose: Compute the size in bytes of the specified instance of * H5HL_t via H5HL_size() * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * June 19 2007 diff --git a/src/H5HLcache.c b/src/H5HLcache.c index b903a6e..8461392 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5HLcache.c - * Feb 5 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5HLcache.c + * Feb 5 2008 + * Quincey Koziol * - * Purpose: Implement local heap metadata cache methods. + * Purpose: Implement local heap metadata cache methods. * *------------------------------------------------------------------------- */ @@ -31,11 +31,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLpkg.h" /* Local Heaps */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLpkg.h" /* Local Heaps */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ /* Local Macros */ @@ -43,10 +43,11 @@ #define H5HL_VERSION 0 /* Local heap collection version */ -/* Set the local heap size to speculatively read in */ -/* (needs to be more than the local heap prefix size to work at all and +/* Set the local heap size to speculatively read in + * (needs to be more than the local heap prefix size to work at all and * should be larger than the default local heap size to save the - * extra I/O operations) */ + * extra I/O operations) + */ #define H5HL_SPEC_READ_SIZE 512 /******************/ @@ -114,7 +115,6 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -177,16 +177,14 @@ done: } /* end H5HL_fl_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5HL_fl_serialize + * Function: H5HL_fl_serialize * - * Purpose: Serialize the free list for a heap data block + * Purpose: Serialize the free list for a heap data block * - * Return: Success: SUCCESS - * Failure: FAIL + * Return: Nothing (void) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ @@ -227,7 +225,6 @@ H5HL_fl_serialize(const H5HL_t *heap) * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -370,7 +367,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -473,7 +469,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- @@ -528,7 +523,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 20 2003 * *------------------------------------------------------------------------- @@ -541,7 +535,7 @@ H5HL_prefix_clear(H5F_t H5_ATTR_UNUSED *f, void *thing, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* check arguments */ + /* Check arguments */ HDassert(prfx); /* Mark heap prefix as clean */ @@ -600,7 +594,6 @@ H5HL_prefix_size(const H5F_t H5_ATTR_UNUSED *f, const void *thing, size_t *size_ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 5 2010 * *------------------------------------------------------------------------- @@ -663,10 +656,10 @@ done: * Purpose: Flushes a heap's data block from memory to disk if it's dirty. * Optionally deletes the heap data block from memory. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -718,10 +711,10 @@ done: * * Purpose: Destroys a local heap data block in memory. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- @@ -768,10 +761,10 @@ done: * * Purpose: Mark a local heap data block in memory as non-dirty. * - * Return: Non-negative on success/Negative on failure + * Return: Success: SUCCEED + * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 20 2003 * *------------------------------------------------------------------------- diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 9df2cb5..3410235 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -11,38 +11,28 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * - * Purpose: Local Heap object debugging functions. + * Purpose: Local Heap object debugging functions. */ #define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLpkg.h" /* Local heaps */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLpkg.h" /* Local heaps */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5MMprivate.h" /* Memory management */ /*------------------------------------------------------------------------- - * Function: H5HL_debug + * Function: H5HL_debug * - * Purpose: Prints debugging information about a heap. + * Purpose: Prints debugging information about a heap. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 1 1997 - * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * John Mainzer, 6/17/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. + * Programmer: Robb Matzke + * Aug 1 1997 * *------------------------------------------------------------------------- */ @@ -74,10 +64,10 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size); - /* - * 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))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") @@ -103,16 +93,14 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); else amount_free += freelist->size; - } /* end for */ + } /* 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)); - /* - * 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); done: diff --git a/src/H5HLint.c b/src/H5HLint.c index 6f1983e..41239a8 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5HLint.c - * Oct 12 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5HLint.c + * Oct 12 2008 + * Quincey Koziol * - * Purpose: Local heap internal routines. + * Purpose: Local heap internal routines. * *------------------------------------------------------------------------- */ @@ -31,9 +31,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLpkg.h" /* Local Heaps */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLpkg.h" /* Local Heaps */ /****************/ /* Local Macros */ @@ -73,16 +73,15 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t); H5FL_DEFINE_STATIC(H5HL_prfx_t); /*------------------------------------------------------------------------- - * Function: H5HL_new + * Function: H5HL_new * - * Purpose: Create a new local heap object + * Purpose: Create a new local heap object * - * Return: Success: non-NULL pointer to new local heap - * Failure: NULL + * Return: Success: non-NULL pointer to new local heap + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jan 5 2010 + * Programmer: Quincey Koziol + * Jan 5 2010 * *------------------------------------------------------------------------- */ @@ -118,14 +117,12 @@ done: /*------------------------------------------------------------------------- * Function: H5HL_inc_rc * - * Purpose: Increment ref. count on heap + * Purpose: Increment ref. count on heap * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ @@ -146,14 +143,12 @@ H5HL_inc_rc(H5HL_t *heap) /*------------------------------------------------------------------------- * Function: H5HL_dec_rc * - * Purpose: Decrement ref. count on heap + * Purpose: Decrement ref. count on heap * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Oct 12 2008 + * Programmer: Quincey Koziol + * Oct 12 2008 * *------------------------------------------------------------------------- */ @@ -176,15 +171,14 @@ H5HL_dec_rc(H5HL_t *heap) } /* end H5HL_dec_rc() */ /*------------------------------------------------------------------------- - * Function: H5HL_dest + * Function: H5HL_dest * - * Purpose: Destroys a heap in memory. + * Purpose: Destroys a heap in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 15 2003 + * Programmer: Quincey Koziol + * Jan 15 2003 * *------------------------------------------------------------------------- */ @@ -225,7 +219,6 @@ H5HL_dest(H5HL_t *heap) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -269,7 +262,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -313,7 +305,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -357,7 +348,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 412a4df..d19c984 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: This file contains declarations which are visible @@ -53,12 +53,12 @@ H5FL_BLK_EXTERN(lheap_chunk); /**************************/ #define H5HL_SIZEOF_HDR(F) \ - H5HL_ALIGN(H5_SIZEOF_MAGIC + /*heap signature */ \ - 1 + /*version */ \ - 3 + /*reserved */ \ - H5F_SIZEOF_SIZE(F) + /*data size */ \ - H5F_SIZEOF_SIZE(F) + /*free list head */ \ - H5F_SIZEOF_ADDR(F)) /*data address */ + H5HL_ALIGN(H5_SIZEOF_MAGIC + /* heap signature */ \ + 1 + /* version */ \ + 3 + /* reserved */ \ + H5F_SIZEOF_SIZE(F) + /* data size */ \ + H5F_SIZEOF_SIZE(F) + /* free list head */ \ + H5F_SIZEOF_ADDR(F)) /* data address */ /* Value indicating end of free list on disk */ #define H5HL_FREE_NULL 1 @@ -68,10 +68,10 @@ H5FL_BLK_EXTERN(lheap_chunk); /****************************/ typedef struct H5HL_free_t { - size_t offset; /*offset of free block */ - size_t size; /*size of free block */ - struct H5HL_free_t *prev; /*previous entry in free list */ - struct H5HL_free_t *next; /*next entry in free list */ + size_t offset; /* offset of free block */ + size_t size; /* size of free block */ + struct H5HL_free_t *prev; /* previous entry in free list */ + struct H5HL_free_t *next; /* next entry in free list */ } H5HL_free_t; /* Forward declarations */ @@ -80,49 +80,46 @@ typedef struct H5HL_prfx_t H5HL_prfx_t; struct H5HL_t { /* General heap-management fields */ - size_t rc; /* Ref. count for prefix & data block using this struct */ - size_t prots; /* # of times the heap has been protected */ - size_t sizeof_size; /* Size of file sizes */ - size_t sizeof_addr; /* Size of file addresses */ - hbool_t single_cache_obj; /* Indicate if the heap is a single object in the cache */ - H5HL_free_t *freelist; /*the free list */ + size_t rc; /* Ref. count for prefix & data block using this struct */ + size_t prots; /* # of times the heap has been protected */ + size_t sizeof_size; /* Size of file sizes */ + size_t sizeof_addr; /* Size of file addresses */ + hbool_t single_cache_obj; /* Indicate if the heap is a single object in the cache */ + H5HL_free_t *freelist; /* the free list */ /* Prefix-specific fields */ - H5HL_prfx_t *prfx; /* The prefix object for the heap */ - haddr_t prfx_addr; /* address of heap prefix */ - size_t prfx_size; /* size of heap prefix */ - hsize_t free_block; /* Address of first free block */ + H5HL_prfx_t *prfx; /* The prefix object for the heap */ + haddr_t prfx_addr; /* address of heap prefix */ + size_t prfx_size; /* size of heap prefix */ + hsize_t free_block; /* Address of first free block */ /* Data block-specific fields */ - H5HL_dblk_t *dblk; /* The data block object for the heap */ - haddr_t dblk_addr; /* address of data block */ - size_t dblk_size; /* size of heap data block on disk and in mem */ - uint8_t * dblk_image; /* The data block image */ + H5HL_dblk_t *dblk; /* The data block object for the heap */ + haddr_t dblk_addr; /* address of data block */ + size_t dblk_size; /* size of heap data block on disk and in mem */ + uint8_t * dblk_image; /* The data block image */ }; /* Struct for heap data block */ struct H5HL_dblk_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - H5HL_t *heap; /* Pointer to heap for data block */ + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + H5HL_t *heap; /* Pointer to heap for data block */ }; /* Struct for heap prefix */ struct H5HL_prfx_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - H5HL_t *heap; /* Pointer to heap for prefix */ + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + H5HL_t *heap; /* Pointer to heap for prefix */ }; /* Callback information for loading local heap prefix from disk */ typedef struct H5HL_cache_prfx_ud_t { - /* Downwards */ size_t sizeof_size; /* Size of file sizes */ size_t sizeof_addr; /* Size of file addresses */ haddr_t prfx_addr; /* Address of prefix */ size_t sizeof_prfx; /* Size of heap prefix */ - - /* Upwards */ } H5HL_cache_prfx_ud_t; /* Callback information for loading local heap data block from disk */ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 0ec047b..b57e153 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -13,13 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5HLprivate.h - * Jul 16 1997 - * Robb Matzke <matzke@llnl.gov> + * Created: H5HLprivate.h + * Jul 16 1997 + * Robb Matzke * - * Purpose: - * - * Modifications: + * Purpose: Private declarations for the H5HL (local heap) package. * *------------------------------------------------------------------------- */ @@ -30,23 +28,23 @@ #include "H5HLpublic.h" /* Private headers needed by this file. */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Fprivate.h" /* File access */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Fprivate.h" /* File access */ /* * Feature: Define H5HL_DEBUG on the compiler command line if you want to - * diagnostic messages from this layer. + * enable diagnostic messages from this layer. */ #ifdef NDEBUG #undef H5HL_DEBUG #endif -#define H5HL_ALIGN(X) ((((unsigned)X) + 7) & (unsigned)(~0x07)) /*align on 8-byte boundary */ +#define H5HL_ALIGN(X) ((((unsigned)X) + 7) & (unsigned)(~0x07)) /* align on 8-byte boundary */ #define H5HL_SIZEOF_FREE(F) \ - H5HL_ALIGN(H5F_SIZEOF_SIZE(F) + /*ptr to next free block */ \ - H5F_SIZEOF_SIZE(F)) /*size of this free block */ + H5HL_ALIGN(H5F_SIZEOF_SIZE(F) + /* ptr to next free block */ \ + H5F_SIZEOF_SIZE(F)) /* size of this free block */ /****************************/ /* Library Private Typedefs */ @@ -56,7 +54,7 @@ typedef struct H5HL_t H5HL_t; /* - * Library prototypes... + * Library prototypes */ H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr /*out*/); H5_DLL H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw); diff --git a/src/H5HLpublic.h b/src/H5HLpublic.h index 451e6c7..26bae68 100644 --- a/src/H5HLpublic.h +++ b/src/H5HLpublic.h @@ -15,7 +15,7 @@ * * Created: H5HLpublic.h * Jul 16 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Public declarations for the H5HL (local heap) package. * @@ -12,25 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * FILE: H5I.c - Internal storage routines for handling "IDs" + * FILE: H5I.c - Internal storage routines for handling "IDs" * - * REMARKS: ID's which allow objects (void *'s currently) to be bundled - * into "types" for more general storage. + * REMARKS: IDs which allow objects (void * currently) to be bundled + * into "types" for more general storage. * - * DESIGN: The types are stored in an array of pointers to store each - * type in an element. Each "type" node contains a link to a - * hash table to manage the IDs in each type. Allowed types are - * values within the range 1 to H5I_MAX_NUM_TYPES and are given out - * at run-time. Types used by the library are stored in global - * variables defined in H5Ipublic.h. - * - * AUTHOR: Quincey Koziol - * - * MODIFICATIONS: - * 1/3/96 - Starting writing specs & coding prototype - * 1/7/96 - Finished coding prototype - * 6/10/97 - Moved into HDF5 library - * 5/18/04 - Expanded to allow registration of new types at run-time + * DESIGN: The types are stored in an array of pointers to store each + * type in an element. Each "type" node contains a link to a + * hash table to manage the IDs in each type. Allowed types are + * values within the range 1 to H5I_MAX_NUM_TYPES and are given out + * at run-time. Types used by the library are stored in global + * variables defined in H5Ipublic.h. */ #define H5I_PACKAGE /*suppress error about including H5Ipkg */ @@ -38,25 +30,25 @@ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5I_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Ipkg.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip Lists */ /* Define this to compile in support for dumping ID information */ /* #define H5I_DEBUG_OUTPUT */ #ifndef H5I_DEBUG_OUTPUT -#include "H5Gprivate.h" /* Groups */ -#else /* H5I_DEBUG_OUTPUT */ +#include "H5Gprivate.h" /* Groups */ +#else /* H5I_DEBUG_OUTPUT */ #define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Tprivate.h" /* Datatypes */ -#endif /* H5I_DEBUG_OUTPUT */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Tprivate.h" /* Datatypes */ +#endif /* H5I_DEBUG_OUTPUT */ /* Local Macros */ @@ -71,10 +63,10 @@ /* Atom information structure used */ typedef struct H5I_id_info_t { - hid_t id; /* ID for this info */ - unsigned count; /* ref. count for this atom */ - unsigned app_count; /* ref. count of application visible atoms */ - const void *obj_ptr; /* pointer associated with the atom */ + hid_t id; /* ID for this info */ + unsigned count; /* ref. count for this atom */ + unsigned app_count; /* ref. count of application visible atoms */ + const void *obj_ptr; /* pointer associated with the atom */ } H5I_id_info_t; /* ID type structure used */ @@ -172,18 +164,16 @@ H5I_init_interface(void) } /* end H5I_init_interface() */ /*------------------------------------------------------------------------- - * Function: H5I_term_interface + * Function: H5I_term_interface * - * Purpose: Terminate the H5I interface: release all memory, reset all - * global variables to initial values. This only happens if all - * types have been destroyed from other interfaces. + * Purpose: Terminate the H5I interface: release all memory, reset all + * global variables to initial values. This only happens if all + * types have been destroyed from other interfaces. * - * Return: Success: Positive if any action was taken that might - * affect some other interface; zero otherwise. + * Return: Success: Positive if any action was taken that might + * affect some other interface; zero otherwise. * - * Failure: Negative. - * - * Programmer: Unknown + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -223,39 +213,35 @@ H5I_term_interface(void) } /* end H5I_term_interface() */ /*------------------------------------------------------------------------- - * Function: H5Iregister_type - * - * Purpose: Public interface to H5I_register_type. Creates a new type - * of ID's to give out. A specific number (RESERVED) of type - * entries may be reserved to enable "constant" values to be handed - * out which are valid IDs in the type, but which do not map to any - * data structures and are not allocated dynamically later. HASH_SIZE is - * the minimum hash table size to use for the type. FREE_FUNC is - * called with an object pointer when the object is removed from - * the type. + * Function: H5Iregister_type * - * Return: Success: Type ID of the new type - * Failure: H5I_BADID + * Purpose: Public interface to H5I_register_type. Creates a new type + * of ID's to give out. A specific number (RESERVED) of type + * entries may be reserved to enable "constant" values to be handed + * out which are valid IDs in the type, but which do not map to any + * data structures and are not allocated dynamically later. HASH_SIZE is + * the minimum hash table size to use for the type. FREE_FUNC is + * called with an object pointer when the object is removed from + * the type. * - * Programmers: Nathaniel Furrer - * James Laird - * Friday, April 30, 2004 + * Return: Success: Type ID of the new type + * Failure: H5I_BADID * *------------------------------------------------------------------------- */ H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) { - H5I_class_t *cls = NULL; /* New ID class */ - H5I_type_t new_type; /* New ID type value */ - H5I_type_t ret_value; /* Return value */ + H5I_class_t *cls = NULL; /* New ID class */ + H5I_type_t new_type; /* New ID type value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE3("It", "zIux", hash_size, reserved, free_func); /* Generate a new H5I_type_t value */ - /* Increment the number of types*/ + /* Increment the number of types */ if (H5I_next_type < H5I_MAX_NUM_TYPES) { new_type = H5I_next_type; H5_INC_ENUM(H5I_type_t, H5I_next_type); @@ -298,27 +284,21 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) done: /* Clean up on error */ - if (ret_value < 0) { + if (ret_value < 0) if (cls) cls = H5FL_FREE(H5I_class_t, cls); - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Iregister_type() */ /*------------------------------------------------------------------------- - * Function: H5I_register_type + * Function: H5I_register_type * - * Purpose: Creates a new type of ID's to give out. - * The class is initialized or its reference count is incremented + * Purpose: Creates a new type of ID's to give out. + * The class is initialized or its reference count is incremented * (if it is already initialized). * - * Return: Success: Type ID of the new type - * Failure: H5I_BADID - * - * Programmers: Nathaniel Furrer - * James Laird - * Friday, April 30, 2004 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -377,17 +357,12 @@ done: } /* end H5I_register_type() */ /*------------------------------------------------------------------------- - * Function: H5Itype_exists + * Function: H5Itype_exists * * Purpose: Query function to inform the user if a given type is * currently registered with the library. * - * Return: Success: 1 if the type is registered, 0 if it is not - * Failure: Negative - * - * Programmer: James Laird - * Nathaniel Furrer - * Tuesday, June 29, 2004 + * Return: TRUE/FALSE/FAIL * *------------------------------------------------------------------------- */ @@ -399,9 +374,9 @@ H5Itype_exists(H5I_type_t type) FUNC_ENTER_API(FAIL) H5TRACE1("t", "It", type); + /* Validate parameter */ if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - if (type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") @@ -413,18 +388,17 @@ done: } /* end H5Itype_exists() */ /*------------------------------------------------------------------------- - * Function: H5Inmembers + * Function: H5Inmembers * - * Purpose: Returns the number of members in a type. Public interface to - * H5I_nmembers. The public interface throws an error if the + * Purpose: Returns the number of members in a type. Public interface to + * H5I_nmembers. The public interface throws an error if the * supplied type does not exist. This is different than the * private interface, which will just return 0. * - * Return: Success: Zero - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * Friday, April 23, 2004 * *------------------------------------------------------------------------- @@ -463,16 +437,16 @@ done: } /* end H5Inmembers() */ /*------------------------------------------------------------------------- - * Function: H5I_nmembers + * Function: H5I_nmembers * - * Purpose: Returns the number of members in a type. + * Purpose: Returns the number of members in a type. * - * Return: Success: Number of members; zero if the type is empty - * or has been deleted. + * Return: Success: Number of members; zero if the type is empty + * or has been deleted. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 24, 1999 * *------------------------------------------------------------------------- @@ -480,8 +454,8 @@ done: int H5I_nmembers(H5I_type_t type) { - H5I_id_type_t *type_ptr = NULL; - int ret_value; + H5I_id_type_t *type_ptr = NULL; + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -498,17 +472,16 @@ done: } /* end H5I_nmembers() */ /*------------------------------------------------------------------------- - * Function: H5Iclear_type + * Function: H5Iclear_type * - * Purpose: Removes all objects from the type, calling the free - * function for each object regardless of the reference count. - * Public interface to H5I_clear_type. + * Purpose: Removes all objects from the type, calling the free + * function for each object regardless of the reference count. + * Public interface to H5I_clear_type. * - * Return: Success: Non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * Friday, April 23, 2004 * *------------------------------------------------------------------------- @@ -516,7 +489,7 @@ done: herr_t H5Iclear_type(H5I_type_t type, hbool_t force) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "Itb", type, force); @@ -559,15 +532,14 @@ H5I__free_cb(void *_item, void H5_ATTR_UNUSED *_key, void H5_ATTR_UNUSED *_udata } /* end H5I__free_cb() */ /*------------------------------------------------------------------------- - * Function: H5I_clear_type + * Function: H5I_clear_type * - * Purpose: Removes all objects from the type, calling the free - * function for each object regardless of the reference count. + * Purpose: Removes all objects from the type, calling the free + * function for each object regardless of the reference count. * - * Return: Success: Non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 24, 1999 * *------------------------------------------------------------------------- @@ -580,6 +552,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) FUNC_ENTER_NOAPI(FAIL) + /* Validate parameters */ if (type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") @@ -609,11 +582,10 @@ done: /*------------------------------------------------------------------------- * Function: H5I__clear_type_cb * - * Purpose: Attempts to free the specified ID , calling the free + * Purpose: Attempts to free the specified ID, calling the free * function for the object. * - * Return: Success: Non-negative - * Failure: negative + * Return: TRUE/FALSE/FAIL * * Programmer: Neil Fortner * Friday, July 10, 2015 @@ -629,18 +601,18 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(id); HDassert(udata); HDassert(udata->type_ptr); - /* - * Do nothing to the object if the reference count is larger than + /* Do nothing to the object if the reference count is larger than * one and forcing is off. */ if (udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { /* Check for a 'free' function and call it, if it exists */ - /* (Casting away const OK -QAK) */ - if (udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { + if (udata->type_ptr->cls->free_func && + (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ if (udata->force) { #ifdef H5I_DEBUG if (H5DEBUG(I)) { @@ -674,25 +646,25 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) } /* end H5I__clear_type_cb() */ /*------------------------------------------------------------------------- - * Function: H5Idestroy_type + * Function: H5Idestroy_type * - * Purpose: Destroys a type along with all atoms in that type - * regardless of their reference counts. Destroying IDs - * involves calling the free-func for each ID's object and - * then adding the ID struct to the ID free list. Public - * interface to H5I__destroy_type. + * Purpose: Destroys a type along with all atoms in that type + * regardless of their reference counts. Destroying IDs + * involves calling the free-func for each ID's object and + * then adding the ID struct to the ID free list. Public + * interface to H5I__destroy_type. * - * Return: Zero on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Nathaniel Furrer - * James Laird + * Programmer: Nathaniel Furrer + * James Laird * *------------------------------------------------------------------------- */ herr_t H5Idestroy_type(H5I_type_t type) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "It", type); @@ -707,17 +679,17 @@ done: } /* end H5Idestroy_type() */ /*------------------------------------------------------------------------- - * Function: H5I__destroy_type + * Function: H5I__destroy_type * - * Purpose: Destroys a type along with all atoms in that type - * regardless of their reference counts. Destroying IDs - * involves calling the free-func for each ID's object and - * then adding the ID struct to the ID free list. + * Purpose: Destroys a type along with all atoms in that type + * regardless of their reference counts. Destroying IDs + * involves calling the free-func for each ID's object and + * then adding the ID struct to the ID free list. * - * Return: Zero on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Nathaniel Furrer - * James Laird + * Programmer: Nathaniel Furrer + * James Laird * *------------------------------------------------------------------------- */ @@ -729,6 +701,7 @@ H5I__destroy_type(H5I_type_t type) FUNC_ENTER_STATIC + /* Validate parameter */ if (type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") @@ -760,22 +733,19 @@ done: } /* end H5I__destroy_type() */ /*------------------------------------------------------------------------- - * Function: H5Iregister - * - * Purpose: Public interface to H5I_register. + * Function: H5Iregister * - * Return: Success: New object id. - * Failure: Negative + * Purpose: Public interface to H5I_register. * - * Programmer: Nathaniel Furrer - * James Laird + * Return: Success: New object ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Iregister(H5I_type_t type, const void *object) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "It*x", type, object); @@ -830,44 +800,42 @@ H5I__wrapped_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) } /* end H5I__wrapped_cb() */ /*------------------------------------------------------------------------- - * Function: H5I_register - * - * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. - * This routine does _not_ check for unique-ness of the objects, - * if you register an object twice, you will get two different - * IDs for it. This routine does make certain that each ID in a - * type is unique. IDs are created by getting a unique number - * for the type the ID is in and incorporating the type into - * the ID which is returned to the user. + * Function: H5I_register * - * Return: Success: New object id. - * Failure: Negative + * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. + * This routine does _not_ check for unique-ness of the objects, + * if you register an object twice, you will get two different + * IDs for it. This routine does make certain that each ID in a + * type is unique. IDs are created by getting a unique number + * for the type the ID is in and incorporating the type into + * the ID which is returned to the user. * - * Programmer: Unknown + * Return: Success: New object ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *id_ptr; /*ptr to the new ID information */ - hid_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments */ if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") type_ptr = H5I_id_type_list_g[type]; if (NULL == type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, H5I_INVALID_HID, "invalid type") /* If there is an available ID structure, use it. */ if (type_ptr->avail_count > 0) { /* Use existing available ID struct */ if (NULL == (id_ptr = (H5I_id_info_t *)H5SL_remove_first(type_ptr->avail_ids))) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREMOVE, FAIL, "can't remove ID from available ID list") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREMOVE, H5I_INVALID_HID, "can't remove ID from available ID list") /* Decrease count of available ID structures */ type_ptr->avail_count--; @@ -896,11 +864,11 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) /* Iterate over all the ID nodes, looking for a gap in the ID sequence */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__wrapped_cb, &udata)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "ID iteration failed") + HGOTO_ERROR(H5E_ATOM, H5E_BADITER, H5I_INVALID_HID, "ID iteration failed") /* If we didn't break out of the iteration and we're at the max. ID, we've used all the IDs */ if (0 == iter_status && udata.nextid >= ID_MASK) - HGOTO_ERROR(H5E_ATOM, H5E_NOIDS, FAIL, "no IDs available in type") + HGOTO_ERROR(H5E_ATOM, H5E_NOIDS, H5I_INVALID_HID, "no IDs available in type") /* Sanity check */ HDassert(udata.nextid < ID_MASK); @@ -911,7 +879,7 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) /* Allocate new ID struct */ if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) - HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Make a new ID */ id_ptr->id = H5I_MAKE(type, type_ptr->nextid); @@ -938,24 +906,24 @@ done: } /* end H5I_register() */ /*------------------------------------------------------------------------- - * Function: H5I_subst + * Function: H5I_subst * - * Purpose: Substitute a new object pointer for the specified ID. + * Purpose: Substitute a new object pointer for the specified ID. * - * Return: Success: Non-null previous object pointer associated - * with the specified ID. - * Failure: NULL + * Return: Success: Non-NULL previous object pointer associated + * with the specified ID. + * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, February 27, 2010 + * Programmer: Quincey Koziol + * Saturday, February 27, 2010 * *------------------------------------------------------------------------- */ void * H5I_subst(hid_t id, const void *new_object) { - H5I_id_info_t *id_ptr; /* Ptr to the atom */ - void * ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -964,76 +932,69 @@ H5I_subst(hid_t id, const void *new_object) HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") /* Get the old object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ /* Set the new object pointer for the ID */ id_ptr->obj_ptr = new_object; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end if */ +} /* end H5I_subst() */ /*------------------------------------------------------------------------- - * Function: H5I_object + * Function: H5I_object * - * Purpose: Find an object pointer for the specified ID. + * Purpose: Find an object pointer for the specified ID. * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Return: Success: Non-NULL object pointer associated with the + * specified ID * - * Programmer: Unknown + * Failure: NULL * *------------------------------------------------------------------------- */ void * H5I_object(hid_t id) { - H5I_id_info_t *id_ptr; /*ptr to the new atom */ - void * ret_value = NULL; /*return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* General lookup of the ID */ if (NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; - } /* end if */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end if */ +} /* end H5I_object() */ /*------------------------------------------------------------------------- - * Function: H5Iobject_verify - * - * Purpose: Find an object pointer for the specified ID, verifying that - * its in a particular type. Public interface to - * H5I_object_verify. + * Function: H5Iobject_verify * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Purpose: Find an object pointer for the specified ID, verifying that + * its in a particular type. Public interface to + * H5I_object_verify. * - * Programmer: Nathaniel Furrer - * James Laird - * Friday, April 23, 2004 + * Return: Success: Non-NULL object pointer associated with the + * specified ID. + * Failure: NULL * *------------------------------------------------------------------------- */ void * H5Iobject_verify(hid_t id, H5I_type_t id_type) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); + /* Validate parameters */ if (H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - if (id_type < 1 || id_type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") @@ -1044,25 +1005,25 @@ done: } /* end H5Iobject_verify() */ /*------------------------------------------------------------------------- - * Function: H5I_object_verify + * Function: H5I_object_verify * - * Purpose: Find an object pointer for the specified ID, verifying that - * its in a particular type. + * Purpose: Find an object pointer for the specified ID, verifying that + * its in a particular type. * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Return: Success: Non-NULL object pointer associated with the + * specified ID. + * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, July 31, 2002 + * Programmer: Quincey Koziol + * Wednesday, July 31, 2002 * *------------------------------------------------------------------------- */ void * H5I_object_verify(hid_t id, H5I_type_t id_type) { - H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */ - void * ret_value = NULL; /*return value */ + H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1071,34 +1032,35 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) /* Verify that the type of the ID is correct & lookup the ID */ if (id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; - } /* end if */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + } done: FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ /*------------------------------------------------------------------------- - * Function: H5I_get_type + * Function: H5I_get_type * - * Purpose: Given an object ID return the type to which it - * belongs. The ID need not be the ID of an object which - * currently exists because the type number is encoded - * in the object ID. + * Purpose: Given an object ID return the type to which it + * belongs. The ID need not be the ID of an object which + * currently exists because the type number is encoded + * in the object ID. * - * Return: Success: A valid type number - * Failure: H5I_BADID, a negative value. + * Return: Success: A positive integer (corresponding to an H5I_type_t + * enum value for library ID types, but not for user + * ID types). + * Failure: H5I_BADID * - * Programmer: Robb Matzke - * Friday, February 19, 1999 + * Programmer: Robb Matzke + * Friday, February 19, 1999 * *------------------------------------------------------------------------- */ H5I_type_t H5I_get_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_NOAPI(H5I_BADID) @@ -1112,17 +1074,17 @@ done: } /* end H5I_get_type() */ /*------------------------------------------------------------------------- - * Function: H5Iget_type - * - * Purpose: The public version of H5I_get_type(), obtains a type number - * when given an ID. The ID need not be the ID of an - * object which currently exists because the type number is - * encoded as part of the ID. + * Function: H5Iget_type * - * Return: Success: Type number - * Failure: H5I_BADID, a negative value + * Purpose: The public version of H5I_get_type(), obtains a type number + * when given an ID. The ID need not be the ID of an + * object which currently exists because the type number is + * encoded as part of the ID. * - * Programmer: Unknown + * Return: Success: A positive integer (corresponding to an H5I_type_t + * enum value for library ID types, but not for user + * ID types). + * Failure: H5I_BADID * *------------------------------------------------------------------------- */ @@ -1144,26 +1106,26 @@ done: } /* end H5Iget_type() */ /*------------------------------------------------------------------------- - * Function: H5Iremove_verify + * Function: H5Iremove_verify * - * Purpose: Removes the specified ID from its type, first checking that the - * type of the ID and the type type are the same. Public interface to - * H5I__remove_verify. + * Purpose: Removes the specified ID from its type, first checking that the + * type of the ID and the type type are the same. Public interface to + * H5I__remove_verify. * - * Return: Success: A pointer to the object that was removed, the - * same pointer which would have been found by - * calling H5I_object(). - * Failure: NULL + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * *------------------------------------------------------------------------- */ void * H5Iremove_verify(hid_t id, H5I_type_t id_type) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); @@ -1179,25 +1141,25 @@ done: } /* end H5Iremove_verify() */ /*------------------------------------------------------------------------- - * Function: H5I__remove_verify + * Function: H5I__remove_verify * - * Purpose: Removes the specified ID from its type, first checking that - * the ID's type is the same as the ID type supplied as an argument + * Purpose: Removes the specified ID from its type, first checking that + * the ID's type is the same as the ID type supplied as an argument * - * Return: Success: A pointer to the object that was removed, the - * same pointer which would have been found by - * calling H5I_object(). - * Failure: NULL + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL * - * Programmer: James Laird - * Nat Furrer + * Programmer: James Laird + * Nat Furrer * *------------------------------------------------------------------------- */ void * H5I__remove_verify(hid_t id, H5I_type_t id_type) { - void *ret_value = NULL; /*return value */ + void *ret_value = NULL; /*return value */ FUNC_ENTER_STATIC_NOERR @@ -1211,14 +1173,14 @@ H5I__remove_verify(hid_t id, H5I_type_t id_type) } /* end H5I__remove_verify() */ /*------------------------------------------------------------------------- - * Function: H5I__remove_common + * Function: H5I__remove_common * - * Purpose: Common code to remove a specified ID from its type. + * Purpose: Common code to remove a specified ID from its type. * - * Return: Success: A pointer to the object that was removed, the - * same pointer which would have been found by - * calling H5I_object(). - * Failure: NULL + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL * * Programmer: Quincey Koziol * October 3, 2013 @@ -1228,8 +1190,8 @@ H5I__remove_verify(hid_t id, H5I_type_t id_type) static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) { - H5I_id_info_t *curr_id; /*ptr to the current atom */ - void * ret_value; /*return value */ + H5I_id_info_t *curr_id; /* Pointer to the current atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1285,25 +1247,23 @@ done: } /* end H5I__remove_common() */ /*------------------------------------------------------------------------- - * Function: H5I_remove + * Function: H5I_remove * - * Purpose: Removes the specified ID from its type. + * Purpose: Removes the specified ID from its type. * - * Return: Success: A pointer to the object that was removed, the - * same pointer which would have been found by - * calling H5I_object(). - * Failure: NULL - * - * Programmer: Unknown + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL * *------------------------------------------------------------------------- */ void * H5I_remove(hid_t id) { - H5I_id_type_t *type_ptr; /*ptr to the atomic type */ - H5I_type_t type; /*atom's atomic type */ - void * ret_value; /*return value */ + H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ + H5I_type_t type; /* Atom's atomic type */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1324,14 +1284,14 @@ done: } /* end H5I_remove() */ /*------------------------------------------------------------------------- - * Function: H5Idec_ref + * Function: H5Idec_ref * - * Purpose: Decrements the number of references outstanding for an ID. + * Purpose: Decrements the number of references outstanding for an ID. * If the reference count for an ID reaches zero, the object * will be closed. * - * Return: Success: New reference count - * Failure: Negative + * Return: Success: New reference count + * Failure: -1 * * Programmer: Quincey Koziol * Dec 7, 2003 @@ -1341,57 +1301,54 @@ done: int H5Idec_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") /* Do actual decrement operation */ if ((ret_value = H5I_dec_app_ref(id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") + HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Idec_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_dec_ref + * Function: H5I_dec_ref * - * Purpose: Decrements the number of references outstanding for an ID. - * This will fail if the type is not a reference counted type. - * The ID type's 'free' function will be called for the ID - * if the reference count for the ID reaches 0 and a free - * function has been defined at type creation time. + * Purpose: Decrements the number of references outstanding for an ID. + * This will fail if the type is not a reference counted type. + * The ID type's 'free' function will be called for the ID + * if the reference count for the ID reaches 0 and a free + * function has been defined at type creation time. * - * Return: Success: New reference count. + * Return: Success: New reference count * - * Failure: Negative - * - * Programmer: Unknown + * Failure: -1 * *------------------------------------------------------------------------- */ int H5I_dec_ref(hid_t id) { - H5I_id_info_t *id_ptr; /*ptr to the new ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Sanity check */ HDassert(id >= 0); /* General lookup of the ID */ if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") - /* - * If this is the last reference to the object then invoke the type's + /* If this is the last reference to the object then invoke the type's * free method on the object. If the free method is undefined or * successful then remove the object from the type; otherwise leave * the object in the type without decrementing the reference @@ -1406,7 +1363,7 @@ H5I_dec_ref(hid_t id) * file. We have to close the dataset anyway. (SLU - 2010/9/7) */ if (1 == id_ptr->count) { - H5I_id_type_t *type_ptr; /*ptr to the type */ + H5I_id_type_t *type_ptr; /*ptr to the type */ /* Get the ID's type */ type_ptr = H5I_id_type_list_g[H5I_TYPE(id)]; @@ -1415,11 +1372,11 @@ H5I_dec_ref(hid_t id) if (!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) { /* Remove the node from the type */ if (NULL == H5I__remove_common(type_ptr, id)) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't remove ID node") + HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, (-1), "can't remove ID node") ret_value = 0; } /* end if */ else - ret_value = FAIL; + ret_value = -1; } /* end if */ else { --(id_ptr->count); @@ -1431,13 +1388,13 @@ done: } /* end H5I_dec_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_dec_app_ref + * Function: H5I_dec_app_ref * - * Purpose: H5I_dec_ref wrapper for case of modifying the application ref. - * count for an ID as well as normal reference count. + * Purpose: H5I_dec_ref wrapper for case of modifying the application ref. + * count for an ID as well as normal reference count. * - * Return: Success: New app. reference count. - * Failure: Negative + * Return: Success: New app. reference count + * Failure: -1 * * Programmer: Quincey Koziol * Sept 16, 2010 @@ -1447,23 +1404,23 @@ done: int H5I_dec_app_ref(hid_t id) { - H5I_id_info_t *id_ptr; /*ptr to the new ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Sanity check */ HDassert(id >= 0); /* Call regular decrement reference count routine */ if ((ret_value = H5I_dec_ref(id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") + HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") /* Check if the ID still exists */ if (ret_value > 0) { /* General lookup of the ID */ if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") /* Adjust app_ref */ --(id_ptr->app_count); @@ -1478,25 +1435,22 @@ done: } /* end H5I_dec_app_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_dec_app_ref_always_close + * Function: H5I_dec_app_ref_always_close * - * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID, - * even when the free routine fails - * - * Return: Success: New app. reference count. - * Failure: Negative + * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID, + * even when the free routine fails * - * Programmer: Quincey Koziol - * Sept 16, 2010 + * Return: Success: New app. reference count + * Failure: -1 * *------------------------------------------------------------------------- */ int H5I_dec_app_ref_always_close(hid_t id) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Sanity check */ HDassert(id >= 0); @@ -1514,23 +1468,20 @@ H5I_dec_app_ref_always_close(hid_t id) */ H5I_remove(id); - HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") - } /* end if */ + HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_app_ref_always_close() */ /*------------------------------------------------------------------------- - * Function: H5Iinc_ref + * Function: H5Iinc_ref * - * Purpose: Increments the number of references outstanding for an ID. + * Purpose: Increments the number of references outstanding for an ID. * - * Return: Success: New reference count - * Failure: Negative - * - * Programmer: Quincey Koziol - * Dec 7, 2003 + * Return: Success: New reference count + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -1539,48 +1490,45 @@ H5Iinc_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") /* Do actual increment operation */ if ((ret_value = H5I_inc_ref(id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count") + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_inc_ref - * - * Purpose: Increment the reference count for an object. + * Function: H5I_inc_ref * - * Return: Success: The new reference count. - * Failure: Negative + * Purpose: Increment the reference count for an object. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Return: Success: The new reference count + * Failure: -1 * *------------------------------------------------------------------------- */ int H5I_inc_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /*ptr to the ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Sanity check */ HDassert(id >= 0); /* General lookup of the ID */ if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") /* Adjust reference counts */ ++(id_ptr->count); @@ -1595,15 +1543,12 @@ done: } /* end H5I_inc_ref() */ /*------------------------------------------------------------------------- - * Function: H5Iget_ref - * - * Purpose: Retrieves the number of references outstanding for an ID. + * Function: H5Iget_ref * - * Return: Success: Reference count - * Failure: Negative + * Purpose: Retrieves the number of references outstanding for an ID. * - * Programmer: Quincey Koziol - * Dec 7, 2003 + * Return: Success: Reference count + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -1612,48 +1557,45 @@ H5Iget_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") /* Do actual retrieve operation */ if ((ret_value = H5I_get_ref(id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_get_ref + * Function: H5I_get_ref * - * Purpose: Retrieve the reference count for an object. + * Purpose: Retrieve the reference count for an object. * - * Return: Success: The reference count. - * Failure: Negative - * - * Programmer: Quincey Koziol - * Saturday, Decemeber 6, 2003 + * Return: Success: The reference count + * Failure: -1 * *------------------------------------------------------------------------- */ int H5I_get_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /*ptr to the ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Sanity check */ HDassert(id >= 0); /* General lookup of the ID */ if (NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") /* Set return value */ ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count); @@ -1663,16 +1605,12 @@ done: } /* end H5I_get_ref() */ /*------------------------------------------------------------------------- - * Function: H5Iinc_type_ref + * Function: H5Iinc_type_ref * - * Purpose: Increments the number of references outstanding for an ID type. + * Purpose: Increments the number of references outstanding for an ID type. * - * Return: Success: New reference count - * Failure: Negative - * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Return: Success: New reference count + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -1681,43 +1619,38 @@ H5Iinc_type_ref(H5I_type_t type) { int ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "It", type); /* Check arguments */ if (type <= 0 || type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual increment operation */ if ((ret_value = H5I__inc_type_ref(type)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID type ref count") + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID type ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ /*------------------------------------------------------------------------- - * Function: H5I__inc_type_ref - * - * Purpose: Increment the reference count for an ID type. + * Function: H5I__inc_type_ref * - * Return: Success: The new reference count. - * Failure: Negative + * Purpose: Increment the reference count for an ID type. * - * Programmer: James Laird - * Nat Furrer - * Friday, April 30, 2004 + * Return: Success: The new reference count + * Failure: -1 * *------------------------------------------------------------------------- */ static int H5I__inc_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* ptr to the type */ - int ret_value; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1726,8 +1659,8 @@ H5I__inc_type_ref(H5I_type_t type) /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + if (NULL == type_ptr) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Set return value */ ret_value = (int)(++(type_ptr->init_count)); @@ -1737,37 +1670,39 @@ done: } /* end H5I__inc_type_ref() */ /*------------------------------------------------------------------------- - * Function: H5Idec_type_ref - * - * Purpose: Decrements the reference count on an entire type of IDs. - * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling - * the free-func for each ID's object and then adding the ID - * struct to the ID free list. Public interface to - * H5I_dec_type_ref. - * Returns the number of references to the type on success; a - * return value of 0 means that the type will have to be - * re-initialized before it can be used again (and should probably - * be set to H5I_UNINIT). - * - * Return: Number of references to type on success/Negative on failure - * - * Programmer: Nathaniel Furrer - * James Laird + * Function: H5Idec_type_ref + * + * Purpose: Decrements the reference count on an entire type of IDs. + * If the type reference count becomes zero then the type is + * destroyed along with all atoms in that type regardless of + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. Public interface to + * H5I_dec_type_ref. + * Returns the number of references to the type on success; a + * return value of 0 means that the type will have to be + * re-initialized before it can be used again (and should probably + * be set to H5I_UNINIT). + * + * NOTE: Using an error type to also represent a count is semantially + * incorrect. We should consider fixing this in a future major + * release (DER). + * + * Return: Success: Number of references to type + * Failure: -1 * *------------------------------------------------------------------------- */ herr_t H5Idec_type_ref(H5I_type_t type) { - herr_t ret_value; /* Return value */ + herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("e", "It", type); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") ret_value = H5I_dec_type_ref(type); @@ -1776,30 +1711,29 @@ done: } /* end H5Idec_type_ref() */ /*------------------------------------------------------------------------- - * Function: H5I_dec_type_ref - * - * Purpose: Decrements the reference count on an entire type of IDs. - * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling - * the free-func for each ID's object and then adding the ID - * struct to the ID free list. - * Returns the number of references to the type on success; a - * return value of 0 means that the type will have to be - * re-initialized before it can be used again (and should probably - * be set to H5I_UNINIT). - * - * Return: Number of references to type on success/Negative on failure - * - * Programmer: Unknown + * Function: H5I_dec_type_ref + * + * Purpose: Decrements the reference count on an entire type of IDs. + * If the type reference count becomes zero then the type is + * destroyed along with all atoms in that type regardless of + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. + * Returns the number of references to the type on success; a + * return value of 0 means that the type will have to be + * re-initialized before it can be used again (and should probably + * be set to H5I_UNINIT). + * + * Return: Success: Number of references to type + * Failure: FAIL * *------------------------------------------------------------------------- */ herr_t H5I_dec_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - herr_t ret_value; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + herr_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1810,8 +1744,7 @@ H5I_dec_type_ref(H5I_type_t type) if (type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - /* - * Decrement the number of users of the atomic type. If this is the + /* Decrement the number of users of the atomic type. If this is the * last user of the type then release all atoms from the type and * free all memory it used. The free function is invoked for each atom * being freed. @@ -1819,27 +1752,23 @@ H5I_dec_type_ref(H5I_type_t type) if (1 == type_ptr->init_count) { H5I__destroy_type(type); ret_value = 0; - } /* end if */ + } else { --(type_ptr->init_count); ret_value = (herr_t)type_ptr->init_count; - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_type_ref() */ /*------------------------------------------------------------------------- - * Function: H5Iget_type_ref + * Function: H5Iget_type_ref * - * Purpose: Retrieves the number of references outstanding for a type. + * Purpose: Retrieves the number of references outstanding for a type. * - * Return: Success: Reference count - * Failure: Negative - * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Return: Success: Reference count + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -1848,44 +1777,39 @@ H5Iget_type_ref(H5I_type_t type) { int ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "It", type); /* Check arguments */ if (type <= 0 || type >= H5I_next_type) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual retrieve operation */ if ((ret_value = H5I__get_type_ref(type)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID type ref count") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID type ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ /*------------------------------------------------------------------------- - * Function: H5I__get_type_ref - * - * Purpose: Retrieve the reference count for an ID type. + * Function: H5I__get_type_ref * - * Return: Success: The reference count. + * Purpose: Retrieve the reference count for an ID type. * - * Failure: Negative + * Return: Success: The reference count * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Failure: -1 * *------------------------------------------------------------------------- */ static int H5I__get_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - int ret_value; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1905,17 +1829,12 @@ done: } /* end H5I__get_type_ref() */ /*------------------------------------------------------------------------- - * Function: H5Iis_valid + * Function: H5Iis_valid * - * Purpose: Check if the given id is valid. An id is valid if it is in + * Purpose: Check if the given id is valid. An id is valid if it is in * use and has an application reference count of at least 1. * - * Return: Success: TRUE if the id is valid, FALSE otherwise. - * - * Failure: Negative (never fails currently) - * - * Programmer: Neil Fortner - * Friday, October 31, 2008 (boo) + * Return: TRUE/FALSE/FAIL * *------------------------------------------------------------------------- */ @@ -1931,9 +1850,7 @@ H5Iis_valid(hid_t id) /* Find the ID */ if (NULL == (id_ptr = H5I__find_id(id))) ret_value = FALSE; - - /* Check if the found id is an internal id */ - else if (!id_ptr->app_count) + else if (!id_ptr->app_count) /* Check if the found id is an internal id */ ret_value = FALSE; done: @@ -1941,19 +1858,14 @@ done: } /* end H5Iis_valid() */ /*------------------------------------------------------------------------- - * Function: H5I__search_cb + * Function: H5I__search_cb * - * Purpose: Callback routine for H5Isearch, when it calls H5I_iterate. - * Calls "user" callback search function, and then sets return - * value, based on the result of that callback. + * Purpose: Callback routine for H5Isearch, when it calls H5I_iterate. + * Calls "user" callback search function, and then sets return + * value, based on the result of that callback. * - * Return: Success: The first object in the type for which FUNC - * returns non-zero. NULL if FUNC returned zero - * for every object in the type. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Friday, March 30, 2012 + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) * *------------------------------------------------------------------------- */ @@ -1973,26 +1885,22 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) } /* end H5I__search_cb() */ /*------------------------------------------------------------------------- - * Function: H5Isearch - * - * Purpose: Apply function FUNC to each member of type TYPE and return a - * pointer to the first object for which FUNC returns non-zero. - * The FUNC should take a pointer to the object and the KEY as - * arguments and return non-zero to terminate the search (zero - * to continue). Public interface to H5I_search. + * Function: H5Isearch * - * Limitation: Currently there is no way to start searching from where a - * previous search left off. + * Purpose: Apply function FUNC to each member of type TYPE and return a + * pointer to the first object for which FUNC returns non-zero. + * The FUNC should take a pointer to the object and the KEY as + * arguments and return non-zero to terminate the search (zero + * to continue). Public interface to H5I_search. * - * Return: Success: The first object in the type for which FUNC - * returns non-zero. NULL if FUNC returned zero - * for every object in the type. + * Limitation: Currently there is no way to start searching from where a + * previous search left off. * - * Failure: NULL + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. * - * Programmer: James Laird - * Nathaniel Furrer - * Friday, April 23, 2004 + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -2027,17 +1935,14 @@ done: } /* end H5Isearch() */ /*------------------------------------------------------------------------- - * Function: H5I__iterate_cb + * Function: H5I__iterate_cb * - * Purpose: Callback routine for H5I_iterate, invokes "user" callback + * Purpose: Callback routine for H5I_iterate, invokes "user" callback * function, and then sets return value, based on the result of * that callback. * - * Return: Success: Non-negative on success - * Failure: Negative - * - * Programmer: Quincey Koziol - * Thursday, October 3, 2013 + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) * *------------------------------------------------------------------------- */ @@ -2050,55 +1955,56 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_ENTER_STATIC_NOERR - /* Don't make callback if app_ref is set and the appl. ref count is 0 */ + /* Only invoke the callback function if this ID is visible externally and + * its reference count is positive. + */ if ((!udata->app_ref) || (item->app_count > 0)) { herr_t cb_ret_val; - /* (Casting away const OK) */ - cb_ret_val = (*udata->user_func)((void *)item->obj_ptr, item->id, udata->user_udata); + /* Invoke callback function */ + cb_ret_val = (*udata->user_func)((void *)item->obj_ptr, item->id, + udata->user_udata); /* (Casting away const OK) */ + + /* Set the return value based on the callback's return value */ if (cb_ret_val > 0) ret_value = H5_ITER_STOP; /* terminate iteration early */ else if (cb_ret_val < 0) ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_cb() */ /*------------------------------------------------------------------------- - * Function: H5I_iterate + * Function: H5I_iterate * - * Purpose: Apply function FUNC to each member of type TYPE (with - * non-zero application reference count if app_ref is TRUE). - * Stop if FUNC returns a non zero value (i.e. anything - * other than H5_ITER_CONT). + * Purpose: Apply function FUNC to each member of type TYPE (with + * non-zero application reference count if app_ref is TRUE). + * Stop if FUNC returns a non zero value (i.e. anything + * other than H5_ITER_CONT). * - * If FUNC returns a positive value (i.e. H5_ITER_STOP), - * return SUCCEED. + * If FUNC returns a positive value (i.e. H5_ITER_STOP), + * return SUCCEED. * - * If FUNC returns a negative value (i.e. H5_ITER_ERROR), - * return FAIL. + * If FUNC returns a negative value (i.e. H5_ITER_ERROR), + * return FAIL. * - * The FUNC should take a pointer to the object and the - * udata as arguments and return non-zero to terminate - * siteration, and zero to continue. + * The FUNC should take a pointer to the object and the + * udata as arguments and return non-zero to terminate + * siteration, and zero to continue. * - * Limitation: Currently there is no way to start the iteration from - * where a previous iteration left off. + * Limitation: Currently there is no way to start the iteration from + * where a previous iteration left off. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * Monday, December 6, 2011 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - herr_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2120,32 +2026,30 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re /* Iterate over IDs */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_iterate() */ /*------------------------------------------------------------------------- - * Function: H5I__find_id + * Function: H5I__find_id * - * Purpose: Given an object ID find the info struct that describes the - * object. + * Purpose: Given an object ID find the info struct that describes the + * object. * - * Return: Success: Ptr to the object's info struct. + * Return: Success: A pointer to the object's info struct. * - * Failure: NULL - * - * Programmer: Unknown + * Failure: NULL * *------------------------------------------------------------------------- */ static H5I_id_info_t * H5I__find_id(hid_t id) { - H5I_type_t type; /*ID's type */ - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *ret_value; /*return value */ + H5I_type_t type; /*ID's type */ + H5I_id_type_t *type_ptr; /*ptr to the type */ + H5I_id_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -2153,7 +2057,6 @@ H5I__find_id(hid_t id) type = H5I_TYPE(id); if (type <= H5I_BADID || type >= H5I_next_type) HGOTO_DONE(NULL) - type_ptr = H5I_id_type_list_g[type]; if (!type_ptr || type_ptr->init_count <= 0) HGOTO_DONE(NULL) @@ -2166,24 +2069,20 @@ done: } /* end H5I__find_id() */ /*------------------------------------------------------------------------- - * Function: H5Iget_name + * Function: H5Iget_name * - * Purpose: Gets a name of an object from its ID. + * Purpose: Gets a name of an object from its ID. * - * Return: Success: The length of name. + * Return: Success: The length of the name * - * Failure: -1 - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: July 26, 2002 + * Failure: -1 * * Comments: Public function - * 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, + * 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) + * If an error occurs then the buffer pointed to by 'name' (NULL or non-NULL) * is unchanged and the function returns a negative value. * If a zero is returned for the name's length, then there is no name * associated with the ID. @@ -2196,70 +2095,64 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size) H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); /* Get object location */ if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") /* Call internal group routine to retrieve object's name */ if ((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ /*------------------------------------------------------------------------- - * 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. + * Function: H5Iget_file_id * - * Return: Success: file ID + * Purpose: Obtains the file ID given an object ID. The user has to + * close this ID. * - * Failure: a negative value + * Return: Success: The file ID associated with the object * - * Programmer: Raymond Lu - * Oct 27, 2003 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Iget_file_id(hid_t obj_id) { - 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", obj_id); if ((ret_value = H5I_get_file_id(obj_id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_file_id() */ /*------------------------------------------------------------------------- - * Function: H5I_get_file_id + * Function: H5I_get_file_id * - * Purpose: The private version of H5Iget_file_id(), obtains the file + * Purpose: The private version of H5Iget_file_id(), obtains the file * ID given an object ID. * - * Return: Success: file ID - * Failure: a negative value - * - * Programmer: Raymond Lu - * Oct 27, 2003 + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5I_get_file_id(hid_t obj_id, hbool_t app_ref) { - H5I_type_t type; /* ID type */ - hid_t ret_value; /* Return value */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2268,7 +2161,7 @@ H5I_get_file_id(hid_t obj_id, hbool_t app_ref) if (type == H5I_FILE) { /* Increment reference count on file ID */ if (H5I_inc_ref(obj_id, app_ref) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") /* Set return value */ ret_value = obj_id; @@ -2278,14 +2171,14 @@ H5I_get_file_id(hid_t obj_id, hbool_t app_ref) /* Get the object location information */ if (H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") /* Get the file ID for the object */ if ((ret_value = H5F_get_id(loc.oloc->file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get file ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get file ID") } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid object ID") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2316,9 +2209,9 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_ENTER_STATIC_NOERR - HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); - HDfprintf(stderr, " count = %u\n", item->count); - HDfprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); + HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); + HDfprintf(stderr, " count = %u\n", item->count); + HDfprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); /* Get the group location, so we get get the name */ switch (type) { @@ -2372,14 +2265,14 @@ H5I__debug(H5I_type_t type) type_ptr = H5I_id_type_list_g[type]; /* Header */ - HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); - HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - HDfprintf(stderr, " wrapped = %u\n", type_ptr->wrapped); - HDfprintf(stderr, " id_count = %u\n", type_ptr->id_count); - HDfprintf(stderr, " nextid = %u\n", type_ptr->nextid); + HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); + HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + HDfprintf(stderr, " wrapped = %u\n", type_ptr->wrapped); + HDfprintf(stderr, " id_count = %u\n", type_ptr->id_count); + HDfprintf(stderr, " nextid = %u\n", type_ptr->nextid); /* List */ - HDfprintf(stderr, " List:\n"); + HDfprintf(stderr, " List:\n"); H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index b05028c..ed7f4b7 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, May 15, 2003 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 5abe3da..448749a 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -28,26 +28,26 @@ * fail otherwise). * * When adding types here, add a section to the 'misc19' test in test/tmisc.c - * to verify that the H5I{inc|dec|get}_ref() routines work correctly with in. + * to verify that the H5I{inc|dec|get}_ref() routines work correctly with it. * */ typedef enum H5I_type_t { - H5I_UNINIT = (-2), /*uninitialized type */ - H5I_BADID = (-1), /*invalid Type */ - H5I_FILE = 1, /*type ID for File objects */ - H5I_GROUP, /*type ID for Group objects */ - H5I_DATATYPE, /*type ID for Datatype objects */ - H5I_DATASPACE, /*type ID for Dataspace objects */ - H5I_DATASET, /*type ID for Dataset objects */ - H5I_ATTR, /*type ID for Attribute objects */ - H5I_REFERENCE, /*type ID for Reference objects */ - H5I_VFL, /*type ID for virtual file layer */ - H5I_GENPROP_CLS, /*type ID for generic property list classes */ - H5I_GENPROP_LST, /*type ID for generic property lists */ - H5I_ERROR_CLASS, /*type ID for error classes */ - H5I_ERROR_MSG, /*type ID for error messages */ - H5I_ERROR_STACK, /*type ID for error stacks */ - H5I_NTYPES /*number of library types, MUST BE LAST! */ + H5I_UNINIT = (-2), /* uninitialized type */ + H5I_BADID = (-1), /* invalid Type */ + H5I_FILE = 1, /* type ID for File objects */ + H5I_GROUP, /* type ID for Group objects */ + H5I_DATATYPE, /* type ID for Datatype objects */ + H5I_DATASPACE, /* type ID for Dataspace objects */ + H5I_DATASET, /* type ID for Dataset objects */ + H5I_ATTR, /* type ID for Attribute objects */ + H5I_REFERENCE, /* type ID for Reference objects */ + H5I_VFL, /* type ID for virtual file layer */ + H5I_GENPROP_CLS, /* type ID for generic property list classes */ + H5I_GENPROP_LST, /* type ID for generic property lists */ + H5I_ERROR_CLASS, /* type ID for error classes */ + H5I_ERROR_MSG, /* type ID for error messages */ + H5I_ERROR_STACK, /* type ID for error stacks */ + H5I_NTYPES /* number of library types, MUST BE LAST! */ } H5I_type_t; /* Type of atoms to return to users */ diff --git a/src/H5Itest.c b/src/H5Itest.c index 0dbbaba..7256881 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@hdfgoup.org> +/* Programmer: Quincey Koziol * Tuesday, July 27, 2010 * * Purpose: ID testing functions. @@ -27,11 +27,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Ipkg.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Ipkg.h" /* IDs */ /****************/ /* Local Macros */ @@ -54,14 +54,14 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5I_get_name_test + * Function: H5I_get_name_test * - * Purpose: Testing version of H5Iget_name() + * Purpose: Testing version of H5Iget_name() * - * Return: Success: The length of name. - * Failure: -1 + * Return: Success: The length of name. + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 27, 2010 * *------------------------------------------------------------------------- @@ -69,18 +69,18 @@ ssize_t H5I_get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached) { - H5G_loc_t loc; /* Object location */ - ssize_t ret_value; /* Return value */ + H5G_loc_t loc; /* Object location */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Get object location */ if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") /* Call internal group routine to retrieve object's name */ if ((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_NOAPI(ret_value) @@ -282,8 +282,8 @@ H5L_term_interface(void) * 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 * @@ -548,7 +548,7 @@ done: * * 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 + * 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). @@ -753,8 +753,7 @@ done: * * 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 @@ -765,7 +764,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; - htri_t ret_value; + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); @@ -773,8 +772,11 @@ 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") + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) @@ -794,7 +796,6 @@ done: * Purpose: Gets metadata for a link. * * Return: Success: Non-negative with information in LINFO - * * Failure: Negative * * Programmer: James Laird @@ -806,7 +807,7 @@ herr_t H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); @@ -816,6 +817,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) @@ -975,9 +977,9 @@ done: * 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,8 +1019,9 @@ done: * Same pattern of behavior as H5Iget_name. * * Return: Success: Non-negative length of name, with information - * in NAME buffer - * Failure: Negative + * in NAME buffer + * + * Failure: -1 * * Programmer: Quincey Koziol * Saturday, November 11, 2006 @@ -1033,22 +1036,23 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value; /* 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") 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") + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; else 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, (-1), "not link access property list ID") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -1062,7 +1066,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 /* Traverse the group hierarchy to locate the link to get name of */ if (H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_SYM, H5E_EXISTS, (-1), "name doesn't exist") /* Set the return value */ ret_value = udata.name_len; @@ -1080,16 +1084,12 @@ done: * 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. + * 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. - * - * - * Programmer: Quincey Koziol - * Thursday, November 16, 2006 + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ @@ -1147,12 +1147,12 @@ done: * 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. + * 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 @@ -1173,8 +1173,10 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 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 (!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") if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -1223,12 +1225,12 @@ done: * _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. + * 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 @@ -1279,12 +1281,12 @@ done: * _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. + * 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 3 2007 @@ -1301,14 +1303,17 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_i 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 (!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") if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) @@ -1902,7 +1907,7 @@ done: * * 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 @@ -2351,11 +2356,10 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "an object with that name already exists") /* Check for crossing file boundaries with a new hard link */ - if (udata->lnk->type == H5L_TYPE_HARD) { + if (udata->lnk->type == H5L_TYPE_HARD) /* Check that both objects are in same file */ if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "moving a link across files is not allowed") - } /* end if */ /* Give the object its new name */ /* Casting away const okay -JML */ @@ -2737,7 +2741,7 @@ done: * * Purpose: Returns metadata about a link. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Monday, April 17 2006 @@ -2891,7 +2895,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 29 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 23fe03c..ed3d39a 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -21,7 +21,7 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lpkg.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5Opublic.h" /* File objects */ @@ -148,7 +148,7 @@ done: /*------------------------------------------------------------------------- * Function: H5L_extern_traverse * - * Purpose: Default traversal function for external links. This can + * Purpose: Default traversal function for external links. This can * be overridden using H5Lregister(). * * Given a filename and path packed into the link udata, @@ -157,25 +157,10 @@ done: * 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 + * Programmer: James Laird * Monday, July 10, 2006 - * Modifications: - * Vailin Choi, April 2, 2008 - * Add handling to search for the target file - * See description in RM: H5Lcreate_external - * - * Vailin Choi; Sept. 12th, 2008; bug #1247 - * Retrieve the file access property list identifer that is set - * for link access property via H5Pget_elink_fapl(). - * If the return value is H5P_DEFAULT, the parent's file access - * property is used to H5F_open() the target file; - * Otherwise, the file access property retrieved from H5Pget_elink_fapl() - * is used to H5F_open() the target file. - * - * Vailin Choi; Nov 2010 - * Free memory pointed to by tmp_env_prefix for HDF5_EXT_PREFIX case. * *------------------------------------------------------------------------- */ @@ -204,18 +189,18 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const char * actual_file_name = NULL; /* Parent file's actual 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 */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Sanity checks */ HDassert(p); /* 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 */ @@ -225,19 +210,19 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* 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 */ @@ -245,15 +230,15 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const 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) { @@ -265,7 +250,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* Query length of parent group name */ if ((group_name_len = H5G_get_name(&loc, NULL, (size_t)0, NULL, lapl_id, H5AC_ind_dxpl_id)) < 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++; @@ -273,8 +258,8 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* 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 = %Zu", 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; @@ -282,21 +267,21 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* Get parent group name */ if (H5G_get_name(&loc, parent_group_name, (size_t)group_name_len, NULL, lapl_id, H5AC_ind_dxpl_id) < 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") /* * Start searching for the target file @@ -307,7 +292,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* Copy the file name to use */ if (NULL == (temp_file_name = H5MM_strdup(file_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") temp_file_name_len = HDstrlen(temp_file_name); /* target file_name is an absolute pathname: see RM for detailed description */ @@ -352,7 +337,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const char *tmp_env_prefix, *saved_env; if (NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) - HGOTO_ERROR(H5E_LINK, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_LINK, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") while ((tmp_env_prefix) && (*tmp_env_prefix)) { char *out_prefix_name; @@ -361,7 +346,8 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const if (out_prefix_name && (*out_prefix_name)) { if (H5L_build_name(out_prefix_name, temp_file_name, &full_name /*out*/) < 0) { saved_env = (char *)H5MM_xfree(saved_env); - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, + "can't prepend prefix to filename") } /* end if */ ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, @@ -379,10 +365,10 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* try searching from property list */ if (ext_file == NULL) { if (H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix") if (my_prefix) { if (H5L_build_name(my_prefix, temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't prepend prefix to filename") if (NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) H5E_clear_stack(NULL); @@ -396,7 +382,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const if (NULL != (extpath = H5F_EXTPATH(loc.oloc->file))) { if (H5L_build_name(extpath, temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't prepend prefix to filename") if (NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) H5E_clear_stack(NULL); @@ -419,12 +405,12 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* Copy resolved file name */ if (NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(loc.oloc->file)))) - HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't duplicate resolved file name string") + HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID, "can't duplicate resolved file name string") /* get last component of file_name */ H5_GET_LAST_DELIMITER(actual_file_name, ptr) if (!ptr) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) @@ -433,12 +419,12 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* Build new file name for the external file */ if (H5L_build_name(actual_file_name, temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't prepend prefix to filename") /* Try opening with the resolved name */ if (NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) full_name = (char *)H5MM_xfree(full_name); @@ -446,11 +432,11 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const /* Retrieve the "group location" for the file's root group */ if (H5G_root_loc(ext_file, &root_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") + HGOTO_ERROR(H5E_SYM, 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, lapl_id, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Set return value */ ret_value = ext_obj; @@ -458,9 +444,10 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const 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); full_name = (char *)H5MM_xfree(full_name); @@ -470,7 +457,8 @@ done: 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) @@ -479,16 +467,16 @@ done: /*------------------------------------------------------------------------- * Function: H5L_extern_query * - * Purpose: Default query function for external links. This can + * Purpose: Default query function for external links. This can * be overridden using H5Lregister(). * * Returns the size of the link's user data. If a buffer of * is provided, copies at most buf_size bytes of the udata * into it. * - * Return: Size of buffer on success/Negative on failure + * Return: Size of buffer on success/Negative on failure * - * Programmer: James Laird + * Programmer: James Laird * Monday, July 10, 2006 * *------------------------------------------------------------------------- @@ -526,21 +514,21 @@ done: } /* end H5L_extern_query() */ /*------------------------------------------------------------------------- - * Function: H5Lcreate_external + * 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. * FILE_NAME is the name of the file that OBJ_NAME is is contained * within. If OBJ_NAME is given as a relative path name, the * path will be relative to the root group of FILE_NAME. - * LINK_NAME is interpreted relative to LINK_LOC_ID, which is + * 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 * *------------------------------------------------------------------------- diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h index 47967a7..b006f3c 100644 --- a/src/H5Lpkg.h +++ b/src/H5Lpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird <matzke@llnl.gov> + * Programmer: James Laird * Friday, December 1, 2005 * * Purpose: This file contains declarations which are visible @@ -15,7 +15,7 @@ * * Created: H5MF.c * Jul 11 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: File memory management functions. * @@ -209,7 +209,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -255,7 +254,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -307,7 +305,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -392,7 +389,6 @@ done: * Failure: HADDR_UNDEF * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 11 1997 * *------------------------------------------------------------------------- @@ -572,7 +568,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -787,7 +782,7 @@ done: /*------------------------------------------------------------------------- * Function: H5MF_get_freespace * - * Purpose: Retrieve the amount of free space in a file. + * Purpose: Retrieve the amount of free space in the file * * Return: Success: Amount of free space in file * Failure: Negative @@ -795,11 +790,6 @@ done: * Programmer: Quincey Koziol * Monday, October 6, 2003 * - * Modifications: - * Vailin Choi; July 2012 - * As the default free-list mapping is changed to H5FD_FLMAP_DICHOTOMY, - * checks are added to account for the last section of each free-space manager - * and the remaining space in the two aggregators are at EOF. *------------------------------------------------------------------------- */ herr_t @@ -928,7 +918,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 14 2008 * *------------------------------------------------------------------------- diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index b3a9d88..98f59c3 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: Routines for aggregating free space allocations @@ -84,7 +84,7 @@ static herr_t H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5F_blk_a haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG @@ -146,7 +146,7 @@ H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *o haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */ hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */ haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_AGGR_DEBUG @@ -436,7 +436,7 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t bl if (f->shared->feature_flags & aggr->feature_flag) { /* * If the block being tested adjoins the beginning of the aggregator - * block, check if the aggregator can accomodate the extension. + * block, check if the aggregator can accommodate the extension. */ if (H5F_addr_eq(blk_end, aggr->addr)) { haddr_t eoa; /* EOA for the file */ @@ -480,10 +480,11 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t bl */ aggr->size += extra; aggr->size -= extra_requested; - } /* end if */ - } /* end if */ + } /* end else-if */ + } /* end else */ } /* end if */ - else { /* The aggreator is not at end of file */ + else { + /* The aggreator is not at end of file */ /* Check if aggregator has enough internal space to satisfy the extension. */ if (aggr->size >= extra_requested) { /* Extend block into aggregator */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 7ce6cf7..2c3e27e 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -15,7 +15,7 @@ * * Created: H5MFdbg.c * Jan 31 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: File memory management debugging functions. * @@ -84,7 +84,6 @@ typedef struct { * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 31 2008 * *------------------------------------------------------------------------- @@ -133,7 +132,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 31 2008 * *------------------------------------------------------------------------- diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 4654227..e6dfde2 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -48,10 +48,10 @@ /* Define this to dump free space tracker contents after they've been modified */ /* #define H5MF_ALLOC_DEBUG_DUMP */ -/* Free space section types for file */ +/* Free-space section types for file */ /* (values stored in free space data structures in file) */ -#define H5MF_FSPACE_SECT_SIMPLE 0 /* Section is a range of actual bytes in file */ - +/* Section is a range of actual bytes in file */ +#define H5MF_FSPACE_SECT_SIMPLE 0 /****************************/ /* Package Private Typedefs */ /****************************/ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index c2f109a..97715ac 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -15,12 +15,10 @@ * * Created: H5MFprivate.h * Jul 11 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Private header file for file memory management. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MFprivate_H diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 7a8ab24..8427ca3 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: Free space section callbacks for file. @@ -109,7 +109,6 @@ H5FL_DEFINE(H5MF_free_section_t); * Return: Pointer to new section on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 8 2008 * *------------------------------------------------------------------------- @@ -117,8 +116,8 @@ H5FL_DEFINE(H5MF_free_section_t); H5MF_free_section_t * H5MF_sect_simple_new(haddr_t sect_off, hsize_t sect_size) { - H5MF_free_section_t *sect = NULL; /* 'Simple' free space section to add */ - H5MF_free_section_t *ret_value; /* Return value */ + H5MF_free_section_t *sect; /* 'Simple' free space section to add */ + H5MF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -163,8 +162,8 @@ H5MF_sect_simple_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, hid const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr, hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags) { - H5MF_free_section_t *sect; /* New section */ - H5FS_section_info_t *ret_value; /* Return value */ + H5MF_free_section_t *sect; /* New section */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -202,9 +201,9 @@ static htri_t H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata) { - const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */ - const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */ - htri_t ret_value; /* Return value */ + const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */ + const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -280,9 +279,9 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) { const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ - haddr_t eoa; /* End of address space in the file */ - haddr_t end; /* End of section to extend */ - htri_t ret_value; /* Return value */ + haddr_t eoa; /* End of address space in the file */ + haddr_t end; /* End of section to extend */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -15,7 +15,7 @@ * * Created: H5MM.c * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Memory management functions * @@ -55,7 +55,7 @@ void * H5MM_malloc(size_t size) { - void *ret_value; + void *ret_value = NULL; HDassert(size); @@ -94,7 +94,7 @@ H5MM_malloc(size_t size) void * H5MM_calloc(size_t size) { - void *ret_value; + void *ret_value = NULL; HDassert(size); diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index fe93522..90a79c7 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -15,7 +15,7 @@ * * Created: H5MMprivate.h * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Private header for memory management. * diff --git a/src/H5MMpublic.h b/src/H5MMpublic.h index f66fafb..62d2d98 100644 --- a/src/H5MMpublic.h +++ b/src/H5MMpublic.h @@ -13,15 +13,13 @@ /*------------------------------------------------------------------------- * - * Created: H5MMproto.h + * Created: H5MMpublic.h * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Public declarations for the H5MM (memory management) * package. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MMpublic_H @@ -15,7 +15,7 @@ * * Created: H5MP.c * May 2 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Implements memory pools. (Similar to Apache's APR * memory pools) @@ -73,7 +73,6 @@ H5FL_DEFINE(H5MP_pool_t); * Return: Pointer to the memory pool "header" on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2005 * *------------------------------------------------------------------------- @@ -81,8 +80,8 @@ H5FL_DEFINE(H5MP_pool_t); H5MP_pool_t * H5MP_create(size_t page_size, unsigned flags) { - H5MP_pool_t *mp = NULL; /* New memory pool header */ - H5MP_pool_t *ret_value; /* Return value */ + H5MP_pool_t *mp = NULL; /* New memory pool header */ + H5MP_pool_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -122,7 +121,6 @@ done: * Return: Pointer to the page allocated on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 4 2005 * *------------------------------------------------------------------------- @@ -130,9 +128,9 @@ done: static H5MP_page_t * H5MP_new_page(H5MP_pool_t *mp, size_t page_size) { - H5MP_page_t * new_page; /* New page created */ - H5MP_page_blk_t *first_blk; /* Pointer to first block in page */ - H5MP_page_t * ret_value; /* Return value */ + H5MP_page_t * new_page; /* New page created */ + H5MP_page_blk_t *first_blk; /* Pointer to first block in page */ + H5MP_page_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -153,9 +151,6 @@ H5MP_new_page(H5MP_pool_t *mp, size_t page_size) new_page->free_size = mp->max_size; new_page->fac_alloc = TRUE; } /* end else */ -#ifdef QAK - HDfprintf(stderr, "%s: Allocating new page = %p\n", FUNC, new_page); -#endif /* QAK */ /* Initialize page information */ first_blk = H5MP_PAGE_FIRST_BLOCK(new_page); @@ -191,7 +186,6 @@ done: * Return: Pointer to the space allocated on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2005 * *------------------------------------------------------------------------- @@ -202,7 +196,7 @@ H5MP_malloc(H5MP_pool_t *mp, size_t request) H5MP_page_t * alloc_page = NULL; /* Page to allocate space from */ H5MP_page_blk_t *alloc_free; /* Pointer to free space in page */ size_t needed; /* Size requested, plus block header and alignment */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -212,10 +206,6 @@ H5MP_malloc(H5MP_pool_t *mp, size_t request) /* Compute actual size needed */ needed = H5MP_BLOCK_ALIGN(request) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)); -#ifdef QAK - HDfprintf(stderr, "%s: sizeof(H5MP_page_blk_t) = %Zu\n", FUNC, sizeof(H5MP_page_blk_t)); - HDfprintf(stderr, "%s: request = %Zu, needed = %Zu\n", FUNC, request, needed); -#endif /* QAK */ /* See if the request can be handled by existing free space */ if (needed <= mp->free_size) { @@ -312,9 +302,6 @@ found: /* Set new space pointer for the return value */ ret_value = ((unsigned char *)alloc_free) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)); -#ifdef QAK - HDfprintf(stderr, "%s: Allocating space from page, ret_value = %p\n", FUNC, ret_value); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -328,7 +315,6 @@ done: * Return: NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 3 2005 * * Note: Should we release pages that have no used blocks? @@ -357,9 +343,6 @@ H5MP_free(H5MP_pool_t *mp, void *spc) /* Add it's space to the amount of free space in the page & pool */ spc_page = spc_blk->page; -#ifdef QAK - HDfprintf(stderr, "%s: Freeing from page = %p\n", "H5MP_free", spc_page); -#endif /* QAK */ spc_page->free_size += spc_blk->size; mp->free_size += spc_blk->size; @@ -416,7 +399,6 @@ H5MP_free(H5MP_pool_t *mp, void *spc) * Return: Non-negative on success/negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 3 2005 * *------------------------------------------------------------------------- diff --git a/src/H5MPpkg.h b/src/H5MPpkg.h index 23bcecf..46a6789 100644 --- a/src/H5MPpkg.h +++ b/src/H5MPpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Monday, May 2, 2005 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h index 22e36cc..de3f45c 100644 --- a/src/H5MPprivate.h +++ b/src/H5MPprivate.h @@ -15,7 +15,7 @@ * * Created: H5MPprivate.h * May 2 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Private header for memory pool routines. * diff --git a/src/H5MPtest.c b/src/H5MPtest.c index 8ba54f9..eeaa3a4 100644 --- a/src/H5MPtest.c +++ b/src/H5MPtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Tuesday, May 3, 2005 * * Purpose: Memory pool testing functions. @@ -41,8 +41,6 @@ * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -72,8 +70,6 @@ H5MP_get_pool_free_size(const H5MP_pool_t *mp, size_t *free_size) * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -106,8 +102,6 @@ H5MP_get_pool_first_page(const H5MP_pool_t *mp, H5MP_page_t **page) * Programmer: Quincey Koziol * Wednesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -141,10 +135,6 @@ H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp) /* Check that the free space from the blocks on the free list * corresponds to space in page */ -#ifdef QAK - HDfprintf(stderr, "%s: page_free = %Zu, page->free_size = %Zu\n", "H5MP_pool_is_free_size_correct", - page_free, page->free_size); -#endif /* QAK */ if (page_free != page->free_size) HGOTO_DONE(FALSE) @@ -157,10 +147,6 @@ H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp) /* Check that the free space from the pages * corresponds to free space in pool */ -#ifdef QAK - HDfprintf(stderr, "%s: pool_free = %Zu, mp->free_size = %Zu\n", "H5MP_pool_is_free_size_correct", - pool_free, mp->free_size); -#endif /* QAK */ if (pool_free != mp->free_size) HGOTO_DONE(FALSE) @@ -180,8 +166,6 @@ done: * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -211,8 +195,6 @@ H5MP_get_page_free_size(const H5MP_page_t *page, size_t *free_size) * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5O.c - * Aug 5 1997 - * Robb Matzke <matzke@llnl.gov> + * Created: H5O.c * - * Purpose: Object header routines. + * Purpose: Public object header routines * *------------------------------------------------------------------------- */ @@ -34,16 +32,16 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ /* Local Macros */ @@ -192,9 +190,9 @@ H5O_init_interface(void) } /* end H5O_init_interface() */ /*------------------------------------------------------------------------- - * 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 @@ -205,41 +203,43 @@ H5O_init_interface(void) * 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 + * Programmer: James Laird + * July 14 2006 * *------------------------------------------------------------------------- */ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; - hid_t ret_value = FAIL; + H5G_loc_t loc; /* Location of group */ + 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") /* Open the object */ if ((ret_value = H5O_open_name(&loc, name, lapl_id, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ /*------------------------------------------------------------------------- - * Function: H5Oopen_by_idx + * Function: H5Oopen_by_idx * - * Purpose: Opens an object within an HDF5 file, according to the offset + * Purpose: Opens an object within an HDF5 file, according to the offset * within an index. * * This function opens an object in the same way that H5Gopen, @@ -251,11 +251,11 @@ done: * 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: Quincey Koziol - * November 20 2006 + * Programmer: Quincey Koziol + * November 20 2006 * *------------------------------------------------------------------------- */ @@ -263,29 +263,29 @@ hid_t 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; + 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 */ - 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") 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") if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; else 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") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -295,26 +295,26 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ite /* Find the object's location, according to the order in the index */ if (H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc /*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5I_INVALID_HID, "group not found") loc_found = TRUE; /* Open the object */ if ((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: /* Release the object location if we failed after copying it */ if (ret_value < 0 && loc_found) if (H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5Oopen_by_addr + * Function: H5Oopen_by_addr * - * Purpose: Warning! This function is EXTREMELY DANGEROUS! + * Purpose: Warning! This function is EXTREMELY DANGEROUS! * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA, * and other VERY BAD THINGS! * @@ -338,32 +338,32 @@ done: * HDF5 file, and HDF5's file drivers will transparently * map this to an address on disk for the filesystem. * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: An open object identifier + * Failure: H5I_INVALID_HID * - * Programmer: James Laird - * July 14 2006 + * Programmer: James Laird + * July 14 2006 * *------------------------------------------------------------------------- */ hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr) { - H5G_loc_t loc; + H5G_loc_t loc; /* Location within file */ 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 lapl_id = H5P_LINK_ACCESS_DEFAULT; /* lapl to use to open this object */ - hid_t ret_value = FAIL; + 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 */ 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 (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no address supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -375,30 +375,29 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) /* Open the object */ if ((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: - FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_addr() */ /*------------------------------------------------------------------------- - * Function: H5Olink + * Function: H5Olink * - * Purpose: Creates a hard link from NEW_NAME to the object specified - * by OBJ_ID using properties defined in the Link Creation + * Purpose: Creates a hard link from NEW_NAME to the object specified + * by OBJ_ID using properties defined in the Link Creation * Property List LCPL. * - * This function should be used to link objects that have just + * This function should be used to link objects that have just * been created. * - * NEW_NAME is interpreted relative to - * NEW_LOC_ID, which is either a file ID or a - * group ID. + * NEW_NAME is interpreted relative to + * NEW_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: James Laird + * Programmer: James Laird * Tuesday, December 13, 2005 * *------------------------------------------------------------------------- @@ -406,8 +405,8 @@ done: herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t new_loc; - H5G_loc_t obj_loc; + H5G_loc_t new_loc; /* Location of group to link from */ + H5G_loc_t obj_loc; /* Location of object to link to */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -440,9 +439,9 @@ done: } /* end H5Olink() */ /*------------------------------------------------------------------------- - * Function: H5Oincr_refcount + * Function: H5Oincr_refcount * - * Purpose: Warning! This function is EXTREMELY DANGEROUS! + * Purpose: Warning! This function is EXTREMELY DANGEROUS! * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA, * and other VERY BAD THINGS! * @@ -451,26 +450,26 @@ done: * that references an object by address is created. When the * link is deleted, H5Odecr_refcount should be used. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: James Laird - * July 14 2006 + * Programmer: James Laird + * July 14 2006 * *------------------------------------------------------------------------- */ herr_t H5Oincr_refcount(hid_t object_id) { - H5O_loc_t *oloc; - herr_t ret_value = SUCCEED; + H5O_loc_t *oloc; /* Object location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); - /* Get the object's oloc so we can adjust its link count */ + /* Get the location object */ 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_BADTYPE, FAIL, "invalid location identifier") if (H5O_link(oloc, 1, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -480,9 +479,9 @@ done: } /* end H5O_incr_refcount() */ /*------------------------------------------------------------------------- - * Function: H5Odecr_refcount + * Function: H5Odecr_refcount * - * Purpose: Warning! This function is EXTREMELY DANGEROUS! + * Purpose: Warning! This function is EXTREMELY DANGEROUS! * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA, * and other VERY BAD THINGS! * @@ -491,26 +490,26 @@ done: * that reference an object by address are deleted, and only * after H5Oincr_refcount has already been used. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: James Laird - * July 14 2006 + * Programmer: James Laird + * July 14 2006 * *------------------------------------------------------------------------- */ herr_t H5Odecr_refcount(hid_t object_id) { - H5O_loc_t *oloc; - herr_t ret_value = SUCCEED; + H5O_loc_t *oloc; /* Object location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); - /* Get the object's oloc so we can adjust its link count */ + /* Get the location object */ 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_BADTYPE, FAIL, "invalid location identifier") if (H5O_link(oloc, -1, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -520,15 +519,15 @@ done: } /* end H5Odecr_refcount() */ /*------------------------------------------------------------------------- - * 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: Negative * - * Programmer: Quincey Koziol - * February 2 2010 + * Programmer: Quincey Koziol + * February 2 2010 * *------------------------------------------------------------------------- */ @@ -536,7 +535,7 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ - hid_t ret_value = FAIL; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); @@ -560,15 +559,15 @@ done: } /* end H5Oexists_by_name() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info + * Function: H5Oget_info * - * Purpose: Retrieve information about an object. + * Purpose: Retrieve information about an object. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * November 21 2006 + * Programmer: Quincey Koziol + * November 21 2006 * *------------------------------------------------------------------------- */ @@ -596,12 +595,12 @@ done: } /* end H5Oget_info() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_name + * Function: H5Oget_info_by_name * - * Purpose: Retrieve information about an object. + * Purpose: Retrieve information about an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * November 21 2006 @@ -638,16 +637,16 @@ done: } /* end H5Oget_info_by_name() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_idx + * Function: H5Oget_info_by_idx * - * Purpose: Retrieve information about an object, according to the order + * Purpose: Retrieve information about an object, according to the order * of an index. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * November 26 2006 + * Programmer: Quincey Koziol + * November 26 2006 * *------------------------------------------------------------------------- */ @@ -705,19 +704,19 @@ done: } /* end H5Oget_info_by_idx() */ /*------------------------------------------------------------------------- - * 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: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 30 2007 + * Programmer: Quincey Koziol + * August 30 2007 * *------------------------------------------------------------------------- */ @@ -730,9 +729,9 @@ H5Oset_comment(hid_t obj_id, const char *comment) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", obj_id, comment); - /* Check args */ + /* Get the location object */ 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") /* (Re)set the object's comment */ if (H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) @@ -743,19 +742,19 @@ done: } /* end H5Oset_comment() */ /*------------------------------------------------------------------------- - * 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: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 30 2007 + * Programmer: Quincey Koziol + * August 30 2007 * *------------------------------------------------------------------------- */ @@ -787,91 +786,91 @@ done: } /* end H5Oset_comment_by_name() */ /*------------------------------------------------------------------------- - * 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 + * Programmer: Quincey Koziol + * August 30 2007 * *------------------------------------------------------------------------- */ 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 */ + H5G_loc_t loc; /* Location of group */ + 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, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, (-1), "object not found") done: FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment() */ /*------------------------------------------------------------------------- - * 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 + * Programmer: Quincey Koziol + * August 30 2007 * *------------------------------------------------------------------------- */ ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + H5G_loc_t loc; /* Location of group */ + 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") if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; else 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, (-1), "not link access property list ID") /* Retrieve the object's comment */ if ((ret_value = H5G_loc_get_comment(&loc, name, comment /*out*/, bufsize, lapl_id, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, (-1), "object not found") done: FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment_by_name() */ /*------------------------------------------------------------------------- - * Function: H5Ovisit + * Function: H5Ovisit * - * 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 @@ -887,16 +886,16 @@ done: * iteration index and iteration order given) will be used to in * the callback about the 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 25 2007 + * Programmer: Quincey Koziol + * November 25 2007 * *------------------------------------------------------------------------- */ @@ -926,9 +925,9 @@ done: } /* end H5Ovisit() */ /*------------------------------------------------------------------------- - * Function: H5Ovisit_by_name + * Function: H5Ovisit_by_name * - * 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 @@ -944,16 +943,16 @@ done: * iteration index and iteration order given) will be used to in * the callback about the 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 + * Programmer: Quincey Koziol + * November 24 2007 * *------------------------------------------------------------------------- */ @@ -990,20 +989,20 @@ done: } /* end H5Ovisit_by_name() */ /*------------------------------------------------------------------------- - * 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: Success: Non-negative + * Failure: Negative * - * Programmer: James Laird - * July 14 2006 + * Programmer: James Laird + * July 14 2006 * *------------------------------------------------------------------------- */ @@ -1064,7 +1063,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -1435,7 +1433,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -1551,7 +1548,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -1599,7 +1595,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -1823,7 +1818,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -1869,7 +1863,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -1904,7 +1897,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -2078,7 +2070,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * <koziol@ncsa.uiuc.edu> * Tuesday, January 21, 2003 * *------------------------------------------------------------------------- @@ -2149,7 +2140,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 19 2003 * *------------------------------------------------------------------------- @@ -2203,7 +2193,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 19 2003 * *------------------------------------------------------------------------- @@ -2483,7 +2472,6 @@ H5O_loc_reset(H5O_loc_t *loc) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Monday, September 19, 2005 * * Notes: 'depth' parameter determines how much of the group entry @@ -2719,15 +2707,12 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) } /* end H5O_get_hdr_info_real() */ /*------------------------------------------------------------------------- - * Function: H5O_get_info - * - * Purpose: Retrieve the information for an object + * Function: H5O_get_info * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Retrieve information about an object. * - * Programmer: Quincey Koziol - * November 21 2006 + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index f11a11a..28bc305 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -15,7 +15,7 @@ * * Created: H5Oainfo.c * Mar 6 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Attribute Information messages. * @@ -93,7 +93,6 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- @@ -103,9 +102,9 @@ H5O_ainfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { - H5O_ainfo_t * ainfo = NULL; /* Attribute info */ - unsigned char flags; /* Flags for encoding attribute info */ - void * ret_value; /* Return value */ + H5O_ainfo_t * ainfo = NULL; /* Attribute info */ + unsigned char flags; /* Flags for encoding attribute info */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -167,7 +166,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- @@ -222,7 +220,6 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- @@ -230,9 +227,9 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co static void * H5O_ainfo_copy(const void *_mesg, void *_dest) { - const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; - H5O_ainfo_t * dest = (H5O_ainfo_t *)_dest; - void * ret_value; /* Return value */ + const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; + H5O_ainfo_t * dest = (H5O_ainfo_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -262,7 +259,6 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- @@ -270,8 +266,8 @@ done: static size_t H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { - const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; - size_t ret_value; /* Return value */ + const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -292,7 +288,7 @@ H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void /*------------------------------------------------------------------------- * Function: H5O_ainfo_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * @@ -399,7 +395,7 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t H5 { H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src; H5O_ainfo_t *ainfo_dst = NULL; - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -462,11 +458,10 @@ H5O_ainfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo HDassert(ainfo_src); - if (H5F_addr_defined(ainfo_src->fheap_addr)) { + if (H5F_addr_defined(ainfo_src->fheap_addr)) if (H5A_dense_post_copy_file_all(src_oloc, ainfo_src, dst_oloc, (H5O_ainfo_t *)mesg_dst, dxpl_id, cpy_info) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't copy attribute") - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -480,7 +475,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 93d051b..032bded 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -15,7 +15,7 @@ * * Created: H5Oalloc.c * Nov 17 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Object header allocation routines. * @@ -91,7 +91,6 @@ H5FL_EXTERN(H5O_cont_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -217,7 +216,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -315,7 +313,6 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *ga * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 22 2006 * *------------------------------------------------------------------------- @@ -425,7 +422,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 21 2005 * *------------------------------------------------------------------------- @@ -500,7 +496,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, siz uint8_t * old_image; /* Old address of chunk's image in memory */ size_t old_size; /* Old size of chunk */ htri_t was_extended; /* If chunk can be extended */ - size_t extend_msg; /* Index of null message to extend */ + size_t extend_msg = 0; /* Index of null message to extend */ hbool_t extended_msg = FALSE; /* Whether an existing message was extended */ uint8_t new_size_flags = 0; /* New chunk #0 size flags */ hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */ @@ -648,8 +644,8 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, siz oh->mesg[u].raw = oh->chunk[chunkno].image + extra_prfx_size + (oh->mesg[u].raw - old_image); /* Find continuation message which points to this chunk and adjust chunk's size */ - /* (Chunk 0 doesn't have a continuation message that points to it and - * it's size is directly encoded in the object header) */ + /* (Chunk 0 doesn't have a continuation message that points to it, + * its size is directly encoded in the object header) */ if (chunkno > 0 && (H5O_CONT_ID == oh->mesg[u].type->id) && (((H5O_cont_t *)(oh->mesg[u].native))->chunkno == chunkno)) { H5O_chunk_proxy_t *chk_proxy2 = NULL; /* Chunk that continuation message is in */ @@ -719,7 +715,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 7 1997 * *------------------------------------------------------------------------- @@ -878,7 +873,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new /* * The total chunk size must include the requested space plus enough * for the message header. This must be at least some minimum and - * aligned propertly. + * aligned properly. */ size = MAX(H5O_MIN_SIZE, size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); HDassert(size == H5O_ALIGN_OH(oh, size)); @@ -895,9 +890,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new if (HADDR_UNDEF == new_chunk_addr) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for new chunk") - /* - * Create the new chunk giving it a file address. - */ + /* Create the new chunk giving it a file address. */ if (oh->nchunks >= oh->alloc_nchunks) { size_t na = MAX(H5O_NCHUNKS, oh->alloc_nchunks * 2); /* Double # of chunks allocated */ H5O_chunk_t *x; @@ -1103,7 +1096,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -1187,7 +1179,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 22 2006 * *------------------------------------------------------------------------- @@ -1436,7 +1427,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 17 2005 * *------------------------------------------------------------------------- @@ -1754,7 +1744,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 10 2005 * *------------------------------------------------------------------------- @@ -1764,7 +1753,7 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, 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; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1895,7 +1884,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 17 2005 * *------------------------------------------------------------------------- @@ -1905,7 +1893,7 @@ H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, 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; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2084,14 +2072,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 4 2005 * - * Modifications: - * Feb. 2009: Vailin Choi - * Add 2 more parameters to H5O_move_msgs_forward() for moving - * messages forward into "continuation" message - * *------------------------------------------------------------------------- */ herr_t @@ -2149,7 +2131,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Oct 20 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 1a0d632..4bacee4 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -244,7 +244,7 @@ done: if (NULL == ret_value) if (attr) { if (attr->shared) { - /* Free any dynamicly allocated items */ + /* Free any dynamically allocated items */ if (H5A_free(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info") @@ -384,7 +384,7 @@ done: static void * H5O_attr_copy(const void *_src, void *_dst) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -470,13 +470,6 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) * Programmer: Robb Matzke * Tuesday, December 9, 1997 * - * Modification:Raymond Lu - * 25 June 2008 - * Made this function empty. The freeing action is actually - * done in H5O_attr_free (see H5O_msg_free_real). But this - * empty reset function needs to be here. Otherwise, the - * caller function H5O_msg_reset_real will zero-set the whole - * message. *------------------------------------------------------------------------- */ herr_t @@ -490,17 +483,13 @@ H5O_attr_reset(void H5_ATTR_UNUSED *_mesg) /*------------------------------------------------------------------------- * Function: H5O_attr_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, November 18, 2004 * - * Modification:Raymond Lu - * 4 June 2008 - * Let this function call H5A_close in turn. - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 0521a87..14daa3d 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Oattribute.c - * Dec 11 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Oattribute.c * - * Purpose: Object header attribute routines. + * Purpose: Object header attribute routines. * *------------------------------------------------------------------------- */ @@ -38,8 +36,8 @@ #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 "H5Iprivate.h" /* IDs */ +#include "H5Fprivate.h" /* File */ /****************/ /* Local Macros */ @@ -152,13 +150,8 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, cons * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified and might possibly need - * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t @@ -403,13 +396,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * - * Modifications: - * Vailin Choi; September 2011 - * Change oh_modified from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t @@ -455,11 +443,6 @@ done: * Programmer: Quincey Koziol * Monday, December 11, 2006 * - * Modification:Raymond Lu - * 23 June 2008 - * If the attribute is in dense storage and has already been - * opened, make a copy of already opened object to share some - * object information. *------------------------------------------------------------------------- */ H5A_t * @@ -558,7 +541,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -594,11 +576,6 @@ done: * Programmer: Quincey Koziol * Monday, December 18, 2006 * - * Modification:Raymond Lu - * 23 June 2008 - * After opening the attribute, check whether it's in dense - * storage and has already been opened. If it has, close the - * opened object and make a copy of already opened object. *------------------------------------------------------------------------- */ H5A_t * @@ -755,7 +732,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 2 2007 * *------------------------------------------------------------------------- @@ -830,18 +806,12 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * * Modification:Raymond Lu * 4 June 2008 * Took out the data copying part because the attribute data * is shared between attribute handle and object header. - * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified but does not need to - * condense messages in the object header *------------------------------------------------------------------------- */ static herr_t @@ -999,13 +969,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 5 2006 * - * Modifications: - * Vailin Choi; September 2011 - * Change "oh_modified" from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t @@ -1049,13 +1014,8 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 5 2006 * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified and might possibly need - * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t @@ -1129,7 +1089,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_ mesg->native = NULL; /* Delete old attribute */ - /* (doesn't decrement the link count on shared components becuase + /* (doesn't decrement the link count on shared components because * the "native" pointer has been reset) */ if (H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0) @@ -1516,13 +1476,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified and might possibly need - * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t @@ -1795,13 +1750,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * - * Modifications: - * Vailin Choi; September 2011 - * Change "oh_modified" from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Obogus.c b/src/H5Obogus.c index 994e8e8..01adabf 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -15,7 +15,7 @@ * * Created: H5Obogus.c * Jan 21 2003 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: "bogus" message. This message is guaranteed to never * be found in a valid HDF5 file and is only used to @@ -102,7 +102,6 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * *------------------------------------------------------------------------- @@ -150,7 +149,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * *------------------------------------------------------------------------- @@ -185,7 +183,6 @@ H5O_bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * *------------------------------------------------------------------------- @@ -207,11 +204,8 @@ H5O_bogus_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 27423ae..cd8ea76 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@hdfgroup.org> +/* Programmer: Quincey Koziol * Thursday, March 1, 2007 * * Purpose: A message holding non-default v1 B-tree 'K' value diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 8a8ce9f..8a77761 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -15,7 +15,7 @@ * * Created: H5Ocache.c * Sep 28 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Object header metadata cache virtual functions. * @@ -137,7 +137,6 @@ H5FL_SEQ_DEFINE(H5O_cont_t); * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -352,7 +351,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -499,7 +497,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- @@ -545,7 +542,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 20 2003 * * Changes: In the parallel case, there is the possibility that the @@ -660,7 +656,6 @@ H5O_size(const H5F_t H5_ATTR_UNUSED *f, const H5O_t *oh, size_t *size_ptr) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 12 2008 * *------------------------------------------------------------------------- @@ -758,7 +753,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 12 2008 * *------------------------------------------------------------------------- @@ -808,7 +802,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- @@ -856,7 +849,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * * Changes: In the parallel case, there is the possibility that the @@ -933,7 +925,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- @@ -963,7 +954,6 @@ H5O_cache_chk_size(const H5F_t H5_ATTR_UNUSED *f, const H5O_chunk_proxy_t *chk_p * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- @@ -1010,7 +1000,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- @@ -1362,7 +1351,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- @@ -1429,7 +1417,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 13, 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 10320e7..f47bec2 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -15,7 +15,7 @@ * * Created: H5Ochunk.c * Jul 13 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Object header chunk routines. * @@ -67,15 +67,13 @@ 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 * Jul 13 2008 * *------------------------------------------------------------------------- @@ -120,15 +118,13 @@ done: } /* end H5O_chunk_add() */ /*------------------------------------------------------------------------- - * 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 * Jul 17 2008 * *------------------------------------------------------------------------- @@ -137,7 +133,7 @@ H5O_chunk_proxy_t * H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for protected chunk */ - H5O_chunk_proxy_t *ret_value; /* Return value */ + H5O_chunk_proxy_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -194,15 +190,13 @@ done: } /* end H5O_chunk_protect() */ /*------------------------------------------------------------------------- - * 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 * Jul 17 2008 * *------------------------------------------------------------------------- @@ -246,15 +240,13 @@ done: } /* end H5O_chunk_unprotect() */ /*------------------------------------------------------------------------- - * 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 * May 6 2010 * *------------------------------------------------------------------------- @@ -287,15 +279,13 @@ done: } /* 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 * Jul 13 2008 * *------------------------------------------------------------------------- @@ -339,15 +329,13 @@ done: } /* end H5O_chunk_update_idx() */ /*------------------------------------------------------------------------- - * 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 * Jul 13 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 787cd40..50e7ee0 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -15,7 +15,7 @@ * * Created: H5Ocont.c * Aug 6 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: The object header continuation message. This * message is only generated and read from within @@ -80,7 +80,6 @@ H5FL_DEFINE(H5O_cont_t); * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -123,7 +122,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 7 1997 * *------------------------------------------------------------------------- @@ -161,7 +159,6 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -183,7 +180,7 @@ H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void /*------------------------------------------------------------------------- * Function: H5O_cont_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * @@ -245,11 +242,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 0c27f30..2cc3f24 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -15,7 +15,7 @@ * * Created: H5Ocopy.c * Nov 6 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Object copying routines. * @@ -296,13 +296,6 @@ done: * Programmer: Peter Cao * May 30, 2005 * - * Modifications: - * Vailin Choi; Feb 2012 - * Bug fix for HDFFV-7853 - * When the object is opened, call the object's flush class action - * to ensure that cached data is flushed so that H5Ocopy will get - * the correct data. - * *------------------------------------------------------------------------- */ static herr_t @@ -1507,10 +1500,6 @@ done: * Programmer: Neil Fortner * Nov 3 2011 * - * Modifications: - * Vailin Choi; August 2012 - * Use H5O_obj_class to get object type instead of - * H5O_get_info(...TRUE....) saving time in traversing metadata. *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 87f0dd4..92d0175 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -15,7 +15,7 @@ * * Created: H5Odbg.c * Nov 17 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Object header debugging routines. * @@ -76,7 +76,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -232,11 +231,8 @@ H5O_assert(const H5O_t *oh) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 13 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -275,13 +271,8 @@ done: * Return: Non-negative on success/Negative on failure * * 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 @@ -496,7 +487,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 7a84df5..ae24682 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@hdfgroup.org> +/* Programmer: Quincey Koziol * Thursday, March 1, 2007 * * Purpose: A message holding driver info settings @@ -80,8 +80,8 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { - H5O_drvinfo_t *mesg; /* Native message */ - void * ret_value; /* Return value */ + H5O_drvinfo_t *mesg; /* Native message */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -175,9 +175,9 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share static void * H5O_drvinfo_copy(const void *_mesg, void *_dest) { - const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; - H5O_drvinfo_t * dest = (H5O_drvinfo_t *)_dest; - void * ret_value; + const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; + H5O_drvinfo_t * dest = (H5O_drvinfo_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -223,8 +223,8 @@ done: static size_t H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { - const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; - size_t ret_value; + const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -249,7 +249,6 @@ H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_s * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 1 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Odtype.c b/src/H5Odtype.c index bc257b9..953ce7c 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -14,16 +14,16 @@ #define H5O_PACKAGE /*suppress error about including H5Opkg */ #define H5T_PACKAGE /*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 "H5Opkg.h" /* Object headers */ -#include "H5Tpkg.h" /* Datatypes */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#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 */ /* PRIVATE PROTOTYPES */ static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg); @@ -2102,7 +2102,7 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int ind case H5T_SGN_ERROR: case H5T_NSGN: default: - sprintf(buf, "H5T_SGN_%d", (int)(dt->shared->u.atomic.u.i.sign)); + HDsprintf(buf, "H5T_SGN_%d", (int)(dt->shared->u.atomic.u.i.sign)); s = buf; break; } /* end switch */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 04c8599..d038329 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Tuesday, November 25, 1997 */ @@ -452,7 +452,7 @@ H5O_efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_ds H5O_efl_t *efl_dst = NULL; H5HL_t * heap = NULL; /* Pointer to local heap for EFL file names */ size_t idx, size, name_offset, heap_size; - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 776d6dc..1095d1b 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -11,24 +11,24 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Wednesday, September 30, 1998 * - * Purpose: The fill message indicates a bit pattern to use for - * uninitialized data points of a dataset. + * Purpose: The fill message indicates a bit pattern to use for + * uninitialized data points of a dataset. */ #define H5O_PACKAGE /*suppress error about including H5Opkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#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 "H5Pprivate.h" /* Property lists */ -#include "H5Sprivate.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#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 "H5Pprivate.h" /* Property lists */ +#include "H5Sprivate.h" /* Dataspaces */ static void * H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); @@ -167,14 +167,14 @@ H5FL_DEFINE(H5O_fill_t); H5FL_BLK_EXTERN(type_conv); /*------------------------------------------------------------------------- - * Function: H5O_fill_new_decode + * Function: H5O_fill_new_decode * - * Purpose: Decode a new fill value message. The new fill value - * message is fill value plus space allocation time and - * fill value writing time and whether fill value is defined. + * Purpose: Decode a new fill value message. The new fill value + * message is fill value plus space allocation time and + * fill value writing time and whether fill value is defined. * - * Return: Success: Ptr to new message in native struct. - * Failure: NULL + * Return: Success: Ptr to new message in native struct. + * Failure: NULL * * Programmer: Raymond Lu * Feb 26, 2002 @@ -186,8 +186,8 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { - H5O_fill_t *fill = NULL; - void * ret_value; + H5O_fill_t *fill = NULL; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -344,13 +344,13 @@ done: } /* end H5O_fill_old_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_new_encode + * Function: H5O_fill_new_encode * - * Purpose: Encode a new fill value message. The new fill value - * message is fill value plus space allocation time and - * fill value writing time and whether fill value is defined. + * Purpose: Encode a new fill value message. The new fill value + * message is fill value plus space allocation time and + * fill value writing time and whether fill value is defined. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Feb 26, 2002 @@ -472,15 +472,15 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) } /* end H5O_fill_old_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_copy + * Function: H5O_fill_copy * - * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if - * necessary. The new fill value message is fill value plus - * space allocation time and fill value writing time and - * whether fill value is defined. + * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if + * necessary. The new fill value message is fill value plus + * space allocation time and fill value writing time and + * whether fill value is defined. * - * Return: Success: Ptr to _DEST - * Failure: NULL + * Return: Success: Ptr to _DEST + * Failure: NULL * * Programmer: Raymond Lu * Feb 26, 2002 @@ -590,16 +590,16 @@ done: } /* end H5O_fill_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_new_size + * Function: H5O_fill_new_size * - * Purpose: Returns the size of the raw message in bytes not counting the - * message type or size fields, but only the data fields. This - * function doesn't take into account alignment. The new fill - * value message is fill value plus space allocation time and - * fill value writing time and whether fill value is defined. + * Purpose: Returns the size of the raw message in bytes not counting the + * message type or size fields, but only the data fields. This + * function doesn't take into account alignment. The new fill + * value message is fill value plus space allocation time and + * fill value writing time and whether fill value is defined. * - * Return: Success: Message data size in bytes w/o alignment. - * Failure: 0 + * Return: Success: Message data size in bytes w/o alignment. + * Failure: 0 * * Programmer: Raymond Lu * Feb 26, 2002 @@ -624,15 +624,15 @@ H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) 1 + /* Fill value write time */ 1; /* Fill value defined */ if (fill->fill_defined) - ret_value += 4 + /* Fill value size */ - (fill->size > 0 ? (size_t)fill->size : 0); /* Size of fill value */ + ret_value += 4 + /* Fill value size */ + (fill->size > 0 ? (size_t)fill->size : 0); /* Size of fill value */ } /* end if */ else { ret_value = 1 + /* Version number */ 1; /* Status flags */ if (fill->size > 0) - ret_value += 4 + /* Fill value size */ - (size_t)fill->size; /* Size of fill value */ + ret_value += 4 + /* Fill value size */ + (size_t)fill->size; /* Size of fill value */ } /* end else */ FUNC_LEAVE_NOAPI(ret_value) @@ -666,13 +666,13 @@ H5O_fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) } /* end H5O_fill_old_size() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_reset_dyn + * Function: H5O_fill_reset_dyn * - * Purpose: Resets dynamic fill value fields + * Purpose: Resets dynamic fill value fields * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, January 22, 2007 * *------------------------------------------------------------------------- @@ -731,13 +731,13 @@ done: } /* end H5O_fill_reset_dyn() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_reset + * Function: H5O_fill_reset * - * Purpose: Resets a message to an initial state. + * Purpose: Resets a message to an initial state. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * *------------------------------------------------------------------------- @@ -763,13 +763,13 @@ H5O_fill_reset(void *_fill) } /* end H5O_fill_reset() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_free + * Function: H5O_fill_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, December 5, 2002 * *------------------------------------------------------------------------- @@ -787,13 +787,13 @@ H5O_fill_free(void *fill) } /* end H5O_fill_free() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_debug + * Function: H5O_fill_debug * - * Purpose: Prints debugging info for the message. + * Purpose: Prints debugging info for the message. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * *------------------------------------------------------------------------- @@ -887,16 +887,16 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void } /* end H5O_fill_debug() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_convert + * Function: H5O_fill_convert * - * Purpose: Convert a fill value from whatever data type it currently has - * to the specified dataset type. The `type' field of the fill - * value struct will be set to NULL to indicate that it has the - * same type as the dataset. + * Purpose: Convert a fill value from whatever data type it currently has + * to the specified dataset type. The `type' field of the fill + * value struct will be set to NULL to indicate that it has the + * same type as the dataset. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * *------------------------------------------------------------------------- @@ -904,9 +904,9 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_t dxpl_id) { - H5T_path_t *tpath; /* Type conversion info */ - void * buf = NULL, *bkg = NULL; /* Conversion buffers */ - hid_t src_id = -1, dst_id = -1; /* Datatype identifiers */ + H5T_path_t *tpath; /* Type conversion info */ + void * buf = NULL, *bkg = NULL; /* Conversion buffers */ + hid_t src_id = -1, dst_id = -1; /* Datatype identifiers */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -993,7 +993,7 @@ done: * * Purpose: Set the encoding for a fill value to the latest version. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Tuesday, July 24, 2007 diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 1dca8b5..e670a85 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -15,7 +15,7 @@ * * Created: H5Oginfo.c * Aug 23 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Group Information messages. * @@ -85,7 +85,6 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- @@ -95,9 +94,9 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { - H5O_ginfo_t * ginfo = NULL; /* Pointer to group information message */ - unsigned char flags; /* Flags for encoding group info */ - void * ret_value; /* Return value */ + H5O_ginfo_t * ginfo = NULL; /* Pointer to group information message */ + unsigned char flags; /* Flags for encoding group info */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -158,7 +157,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- @@ -210,7 +208,6 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- @@ -218,9 +215,9 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, static void * H5O_ginfo_copy(const void *_mesg, void *_dest) { - const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; - H5O_ginfo_t * dest = (H5O_ginfo_t *)_dest; - void * ret_value; /* Return value */ + const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; + H5O_ginfo_t * dest = (H5O_ginfo_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -251,7 +248,6 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- @@ -259,8 +255,8 @@ done: static size_t H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { - const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; - size_t ret_value; /* Return value */ + const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -282,7 +278,7 @@ H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha /*------------------------------------------------------------------------- * Function: H5O_ginfo_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * @@ -311,7 +307,6 @@ H5O_ginfo_free(void *mesg) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 74c8c7f..4466940 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Wednesday, October 8, 1997 * * Purpose: Messages related to data layout. @@ -94,7 +94,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * { H5O_layout_t *mesg = NULL; unsigned u; - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -366,9 +366,9 @@ done: static void * H5O_layout_copy(const void *_mesg, void *_dest) { - const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg; - H5O_layout_t * dest = (H5O_layout_t *)_dest; - void * ret_value; /* Return value */ + const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg; + H5O_layout_t * dest = (H5O_layout_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -443,14 +443,14 @@ H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi } /* end H5O_layout_size() */ /*------------------------------------------------------------------------- - * Function: H5O_layout_reset + * Function: H5O__layout_reset * - * Purpose: Frees resources within a data type message, but doesn't free - * the message itself. + * Purpose: Frees resources within a data type message, but doesn't free + * the message itself. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, September 13, 2002 * *------------------------------------------------------------------------- diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index a10f03d..f17f8de 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -15,7 +15,7 @@ * * Created: H5Olinfo.c * Aug 23 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Link Information messages. * @@ -102,7 +102,6 @@ H5FL_DEFINE_STATIC(H5O_linfo_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- @@ -177,7 +176,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- @@ -232,7 +230,6 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- @@ -272,7 +269,6 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- @@ -433,7 +429,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 26 2006 * *------------------------------------------------------------------------- @@ -534,7 +529,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- diff --git a/src/H5Olink.c b/src/H5Olink.c index 98d11aa..215fc84 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -15,7 +15,7 @@ * * Created: H5Olink.c * Aug 29 2005 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Link messages. * @@ -108,7 +108,6 @@ H5FL_DEFINE_STATIC(H5O_link_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- @@ -286,7 +285,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- @@ -411,7 +409,6 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- @@ -478,7 +475,6 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- @@ -801,7 +797,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- diff --git a/src/H5Omessage.c b/src/H5Omessage.c index d0347b5..53d5456 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -95,7 +95,6 @@ static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, cons * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 1 2006 * *------------------------------------------------------------------------- @@ -142,7 +141,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -184,7 +182,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 8 2006 * *------------------------------------------------------------------------- @@ -226,7 +223,7 @@ done: * Purpose: Modifies an existing message or creates a new message. * * The UPDATE_FLAGS argument are flags that allow the caller - * to skip updating the modification time or reseting the message + * to skip updating the modification time or resetting the message * data. This is useful when several calls to H5O_msg_write will be * made in a sequence. * @@ -235,7 +232,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -282,7 +278,7 @@ done: * Purpose: Modifies an existing message or creates a new message. * * The UPDATE_FLAGS argument are flags that allow the caller - * to skip updating the modification time or reseting the message + * to skip updating the modification time or resetting the message * data. This is useful when several calls to H5O_msg_write will be * made in a sequence. * @@ -290,7 +286,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 6 2007 * *------------------------------------------------------------------------- @@ -328,7 +323,7 @@ done: * Purpose: Modifies an existing message or creates a new message. * * The UPDATE_FLAGS argument are flags that allow the caller - * to skip updating the modification time or reseting the message + * to skip updating the modification time or resetting the message * data. This is useful when several calls to H5O_msg_write will be * made in a sequence. * @@ -337,7 +332,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -438,7 +432,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -446,8 +439,8 @@ done: void * H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header to use */ - void * ret_value; /* Return value */ + H5O_t *oh = NULL; /* Object header to use */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -490,7 +483,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -546,7 +538,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * *------------------------------------------------------------------------- @@ -582,7 +573,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * *------------------------------------------------------------------------- @@ -628,8 +618,8 @@ done: void * H5O_msg_free(unsigned type_id, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void * ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -677,7 +667,6 @@ H5O_msg_free_mesg(H5O_mesg_t *mesg) * pointer. * * Return: Success: NULL - * * Failure: NULL * * Programmer: Robb Matzke @@ -722,8 +711,8 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) void * H5O_msg_copy(unsigned type_id, const void *mesg, void *dst) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void * ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -759,10 +748,10 @@ done: int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { - H5O_t * oh = NULL; /* Object header to operate on */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - unsigned msg_count; /* Message count */ - int ret_value; /* Return value */ + H5O_t * oh = NULL; /* Object header to operate on */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + unsigned msg_count; /* Message count */ + int ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -807,8 +796,8 @@ done: unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) { - unsigned u; /* Local index variable */ - unsigned ret_value; /* Return value */ + unsigned u; /* Local index variable */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -845,8 +834,8 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header for location */ - htri_t ret_value; /* Return value */ + H5O_t *oh = NULL; /* Object header for location */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -925,7 +914,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 28 1997 * *------------------------------------------------------------------------- @@ -975,7 +963,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -1024,13 +1011,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified and might possibly need - * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t @@ -1094,7 +1076,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 28 1997 * *------------------------------------------------------------------------- @@ -1151,7 +1132,6 @@ done: * object headers were processed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 19 2004 * * Description: @@ -1216,7 +1196,6 @@ done: * object headers were processed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * * Description: @@ -1235,12 +1214,6 @@ done: * C. Negative causes the iterator to immediately return that value, * indicating failure. * - * Modifications: - * Vailin Choi; September 2011 - * Change "oh_modified" from boolean to unsigned so as to know: - * 1) object header is just modified - * 2) object header is modified and possibly need to condense messages there - * *------------------------------------------------------------------------- */ herr_t @@ -1321,7 +1294,6 @@ done: * Return: Size of message on success, 0 on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 13 2003 * *------------------------------------------------------------------------- @@ -1362,7 +1334,6 @@ done: * Return: Size of message on success, 0 on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -1423,7 +1394,6 @@ done: * Return: Size of message on success, 0 on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 7 2007 * *------------------------------------------------------------------------- @@ -1556,7 +1526,6 @@ H5O_msg_can_share_in_ohdr(unsigned type_id) * Object is not shared: FALSE * * Programmer: James Laird - * jlaird@ncsa.uiuc.edu * April 5 2006 * *------------------------------------------------------------------------- @@ -1600,7 +1569,6 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg) * Failure: Negative * * Programmer: James Laird - * jlaird@hdfgroup.org * November 1 2006 * *------------------------------------------------------------------------- @@ -1650,7 +1618,6 @@ done: * Failure: Negative * * Programmer: James Laird - * jlaird@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -1719,7 +1686,7 @@ done: /*------------------------------------------------------------------------- * Function: H5O_msg_encode * - * Purpose: Encode an object(data type and simple data space only) + * Purpose: Encode an object(data type and simple dataspace only) * description into a buffer. * * Return: Success: Non-negative @@ -1727,7 +1694,6 @@ done: * Failure: Negative * * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu * July 13, 2004 * *------------------------------------------------------------------------- @@ -1765,23 +1731,17 @@ done: * Failure: NULL * * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu * July 14, 2004 * - * Modifications: Neil Fortner - * Feb 4 2009 - * Added open_oh parameter. This parameter is optional and - * contains this message's protected object header - * *------------------------------------------------------------------------- */ void * H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, size_t buf_size, const unsigned char *buf) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void * ret_value; /* Return value */ - unsigned ioflags = 0; /* Flags for decode routine */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + unsigned ioflags = 0; /* Flags for decode routine */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1822,7 +1782,7 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *native_src hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id) { - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2032,7 +1992,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * September 26 2003 * *------------------------------------------------------------------------- @@ -2072,7 +2031,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 14 2007 * *------------------------------------------------------------------------- @@ -2172,7 +2130,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 21 2005 * *------------------------------------------------------------------------- @@ -2220,7 +2177,6 @@ done: * Failure: <0 * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Apr 22 2010 * *------------------------------------------------------------------------- @@ -2274,7 +2230,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Apr 22 2010 * *------------------------------------------------------------------------- @@ -2331,7 +2286,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Apr 22 2010 * *------------------------------------------------------------------------- diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 1a8b610..6c3361e 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -11,10 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> - * Friday, July 24, 1998 +/* Programmer: Robb Matzke + * Friday, July 24, 1998 * - * Purpose: The object modification time message. + * Purpose: The object modification time message. */ #define H5O_PACKAGE /*suppress error about including H5Opkg */ @@ -99,18 +99,20 @@ static hbool_t ntzset = FALSE; H5FL_DEFINE(time_t); /*------------------------------------------------------------------------- - * Function: H5O_mtime_new_decode + * Function: H5O_mtime_new_decode * - * Purpose: Decode a new modification time message and return a pointer to a - * new time_t value. + * Purpose: Decode a new modification time message and return a pointer to + * a new time_t value. * - * Return: Success: Ptr to new message in native struct. + * The new modification time message format was added due to the + * performance overhead of the old format. * - * Failure: NULL + * Return: Success: Ptr to new message in native struct. * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 3 2002 + * Failure: NULL + * + * Programmer: Quincey Koziol + * Jan 3 2002 * *------------------------------------------------------------------------- */ @@ -152,18 +154,20 @@ done: } /* end H5O_mtime_new_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_decode + * Function: H5O_mtime_decode + * + * Purpose: Decode a modification time message and return a pointer to a + * new time_t value. * - * Purpose: Decode a modification time message and return a pointer to a - * new time_t value. + * The new modification time message format was added due to the + * performance overhead of the old format. * - * Return: Success: Ptr to new message in native struct. + * Return: Success: Ptr to new message in native struct. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 24 1998 + * Programmer: Robb Matzke + * Jul 24 1998 * *------------------------------------------------------------------------- */ @@ -173,8 +177,8 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { time_t * mesg, the_time; - int i; struct tm tm; + int i; /* Local index variable */ void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -213,15 +217,14 @@ done: } /* end H5O_mtime_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_new_encode + * Function: H5O_mtime_new_encode * - * Purpose: Encodes a new modification time message. + * Purpose: Encodes a new modification time message. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 3 2002 + * Programmer: Quincey Koziol + * Jan 3 2002 * *------------------------------------------------------------------------- */ @@ -253,17 +256,14 @@ H5O_mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha } /* end H5O_mtime_new_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_encode + * Function: H5O_mtime_encode * - * Purpose: Encodes a modification time message. + * Purpose: Encodes a modification time message. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 24 1998 + * Return: Non-negative on success/Negative on failure * - * Modifications: + * Programmer: Robb Matzke + * Jul 24 1998 * *------------------------------------------------------------------------- */ @@ -290,20 +290,17 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, } /*------------------------------------------------------------------------- - * Function: H5O_mtime_copy - * - * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if - * necessary. + * Function: H5O_mtime_copy * - * Return: Success: Ptr to _DEST + * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if + * necessary. * - * Failure: NULL + * Return: Success: Ptr to _DEST * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 24 1998 + * Failure: NULL * - * Modifications: + * Programmer: Robb Matzke + * Jul 24 1998 * *------------------------------------------------------------------------- */ @@ -332,22 +329,19 @@ done: } /*------------------------------------------------------------------------- - * Function: H5O_mtime_new_size + * Function: H5O_mtime_new_size * - * Purpose: Returns the size of the raw message in bytes not - * counting the message type or size fields, but only the data - * fields. This function doesn't take into account - * alignment. + * Purpose: Returns the size of the raw message in bytes not + * counting the message type or size fields, but only the data + * fields. This function doesn't take into account + * alignment. * - * Return: Success: Message data size in bytes w/o alignment. + * Return: Success: Message data size in bytes w/o alignment. * - * Failure: 0 + * Failure: 0 * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 3 2002 - * - * Modifications: + * Programmer: Quincey Koziol + * Jan 3 2002 * *------------------------------------------------------------------------- */ @@ -365,22 +359,19 @@ H5O_mtime_new_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable } /* end H5O_mtime_new_size() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_size + * Function: H5O_mtime_size * - * Purpose: Returns the size of the raw message in bytes not - * counting the message type or size fields, but only the data - * fields. This function doesn't take into account - * alignment. + * Purpose: Returns the size of the raw message in bytes not + * counting the message type or size fields, but only the data + * fields. This function doesn't take into account + * alignment. * - * Return: Success: Message data size in bytes w/o alignment. + * Return: Success: Message data size in bytes w/o alignment. * - * Failure: 0 + * Failure: 0 * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 14 1998 - * - * Modifications: + * Programmer: Robb Matzke + * Jul 14 1998 * *------------------------------------------------------------------------- */ @@ -398,7 +389,7 @@ H5O_mtime_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha } /*------------------------------------------------------------------------- - * Function: H5O_mtime_reset + * Function: H5O_mtime_reset * * Purpose: Frees resources within a modification time message, but doesn't free * the message itself. @@ -421,13 +412,13 @@ H5O_mtime_reset(void H5_ATTR_UNUSED *_mesg) } /*------------------------------------------------------------------------- - * Function: H5O_mtime_free + * Function: H5O_mtime_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, March 30, 2000 * *------------------------------------------------------------------------- @@ -445,15 +436,14 @@ H5O_mtime_free(void *mesg) } /* end H5O_mtime_free() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_debug + * Function: H5O_mtime_debug * - * Purpose: Prints debugging info for the message. + * Purpose: Prints debugging info for the message. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 24 1998 + * Programmer: Robb Matzke + * Jul 24 1998 * *------------------------------------------------------------------------- */ diff --git a/src/H5Oname.c b/src/H5Oname.c index d60d1c3..1591dbf 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -15,7 +15,7 @@ * * Created: H5Oname.c * Aug 12 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Object name message. * @@ -24,10 +24,10 @@ #define H5O_PACKAGE /*suppress error about including H5Opkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ static void * H5O_name_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, @@ -74,7 +74,6 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{ * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * *------------------------------------------------------------------------- @@ -103,10 +102,9 @@ H5O_name_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ ret_value = mesg; done: - if (NULL == ret_value) { + if (NULL == ret_value) if (mesg) mesg = (H5O_name_t *)H5MM_xfree(mesg); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_name_decode() */ @@ -119,11 +117,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -155,19 +150,16 @@ H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * H5O_name_copy(const void *_mesg, void *_dest) { - const H5O_name_t *mesg = (const H5O_name_t *)_mesg; - H5O_name_t * dest = (H5O_name_t *)_dest; - void * ret_value; /* Return value */ + const H5O_name_t *mesg = (const H5O_name_t *)_mesg; + H5O_name_t * dest = (H5O_name_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -206,18 +198,15 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { - const H5O_name_t *mesg = (const H5O_name_t *)_mesg; - size_t ret_value; + const H5O_name_t *mesg = (const H5O_name_t *)_mesg; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -239,11 +228,8 @@ H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -270,11 +256,8 @@ H5O_name_reset(void *_mesg) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Onull.c b/src/H5Onull.c index bfde430..781e03c 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -15,7 +15,6 @@ * * Created: H5Onull.c * Aug 6 1997 - * Robb Matzke <matzke@llnl.gov> * * Purpose: The null message. * diff --git a/src/H5Opline.c b/src/H5Opline.c index f6b7de7..01479e4 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -12,22 +12,22 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> - * Wednesday, April 15, 1998 + * Programmer: Robb Matzke + * Wednesday, April 15, 1998 * - * Purpose: Data filter pipeline message. + * Purpose: Data filter pipeline message. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Zpkg.h" /* Data filters */ /* PRIVATE PROTOTYPES */ static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg); @@ -65,40 +65,40 @@ static herr_t H5O_pline_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{ - H5O_PLINE_ID, /* message id number */ - "filter pipeline", /* message name for debugging */ - sizeof(H5O_pline_t), /* native message size */ + H5O_PLINE_ID, /* message id number */ + "filter pipeline", /* message name for debugging */ + sizeof(H5O_pline_t), /* native message size */ H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_pline_shared_decode, /* decode message */ - H5O_pline_shared_encode, /* encode message */ - H5O_pline_copy, /* copy the native value */ - H5O_pline_shared_size, /* size of raw message */ - H5O_pline_reset, /* reset method */ - H5O_pline_free, /* free method */ - H5O_pline_shared_delete, /* file delete method */ - H5O_pline_shared_link, /* link method */ - NULL, /* set share method */ - NULL, /*can share method */ + H5O_pline_shared_decode, /* decode message */ + H5O_pline_shared_encode, /* encode message */ + H5O_pline_copy, /* copy the native value */ + H5O_pline_shared_size, /* size of raw message */ + H5O_pline_reset, /* reset method */ + H5O_pline_free, /* free method */ + H5O_pline_shared_delete, /* file delete method */ + H5O_pline_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /*can share method */ H5O_pline_pre_copy_file, /* pre copy native value to file */ H5O_pline_shared_copy_file, /* copy native value to file */ H5O_pline_shared_post_copy_file, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O_pline_shared_debug /* debug the message */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O_pline_shared_debug /* debug the message */ }}; /* Declare a free list to manage the H5O_pline_t struct */ H5FL_DEFINE(H5O_pline_t); /*------------------------------------------------------------------------- - * Function: H5O_pline_decode + * Function: H5O_pline_decode * - * Purpose: Decodes a filter pipeline message. + * Purpose: Decodes a filter pipeline message. * - * Return: Success: Ptr to the native message. - * Failure: NULL + * Return: Success: Ptr to the native message. + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -235,13 +235,13 @@ done: } /* end H5O_pline_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_encode + * Function: H5O_pline_encode * - * Purpose: Encodes message MESG into buffer P. + * Purpose: Encodes message MESG into buffer P. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -332,17 +332,17 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) } /* end H5O_pline_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_copy + * Function: H5O_pline_copy * - * Purpose: Copies a filter pipeline message from SRC to DST allocating - * DST if necessary. If DST is already allocated then we assume - * that it isn't initialized. + * Purpose: Copies a filter pipeline message from SRC to DST allocating + * DST if necessary. If DST is already allocated then we assume + * that it isn't initialized. * - * Return: Success: Ptr to DST or allocated result. + * Return: Success: Ptr to DST or allocated result. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -353,7 +353,7 @@ H5O_pline_copy(const void *_src, void *_dst /*out*/) const H5O_pline_t *src = (const H5O_pline_t *)_src; /* Source pipeline message */ H5O_pline_t * dst = (H5O_pline_t *)_dst; /* Destination pipeline message */ size_t i; /* Local index variable */ - H5O_pline_t * ret_value; /* Return value */ + H5O_pline_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -426,15 +426,15 @@ done: } /* end H5O_pline_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_size + * Function: H5O_pline_size * - * Purpose: Determines the size of a raw filter pipeline message. + * Purpose: Determines the size of a raw filter pipeline message. * - * Return: Success: Size of message. + * Return: Success: Size of message. * - * Failure: zero + * Failure: zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -444,14 +444,14 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) { const H5O_pline_t *pline = (const H5O_pline_t *)mesg; /* Pipeline message */ size_t i; /* Local index variable */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Message header */ - ret_value = 1 + /*version */ - 1 + /*number of filters */ - (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0); /*reserved */ + ret_value = 1 + /*version */ + 1 + /*number of filters */ + (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0); /*reserved */ /* Calculate size of each filter in pipeline */ for (i = 0; i < pline->nused; i++) { @@ -471,14 +471,14 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) } /* end else */ ret_value += - 2 + /*filter identification number */ + 2 + /*filter identification number */ (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 - : 0) + /*name length */ - 2 + /*flags */ - 2 + /*number of client data values */ + : 0) + /*name length */ + 2 + /*flags */ + 2 + /*number of client data values */ (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) - : name_len); /*length of the filter name */ + : name_len); /*length of the filter name */ ret_value += pline->filter[i].cd_nelmts * 4; if (pline->version == H5O_PLINE_VERSION_1) @@ -490,14 +490,14 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) } /* end H5O_pline_size() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_reset + * Function: H5O_pline_reset * - * Purpose: Resets a filter pipeline message by clearing all filters. - * The MESG buffer is not freed. + * Purpose: Resets a filter pipeline message by clearing all filters. + * The MESG buffer is not freed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -518,7 +518,6 @@ H5O_pline_reset(void *mesg) /* Free the filter information and array */ if (pline->filter) { - /* Free information for each filter */ for (i = 0; i < pline->nused; i++) { if (pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name) @@ -545,13 +544,13 @@ H5O_pline_reset(void *mesg) } /* end H5O_pline_reset() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_free + * Function: H5O_pline_free * - * Purpose: Free's the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2000 * *------------------------------------------------------------------------- @@ -609,15 +608,15 @@ done: } /* end H5O_pline_pre_copy_file() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_debug + * Function: H5O_pline_debug * - * Purpose: Prints debugging information for filter pipeline message MESG - * on output stream STREAM. Each line is indented INDENT - * characters and the field name takes up FWIDTH characters. + * Purpose: Prints debugging information for filter pipeline message MESG + * on output stream STREAM. Each line is indented INDENT + * characters and the field name takes up FWIDTH characters. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -677,7 +676,7 @@ H5O_pline_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const voi * * Purpose: Set the encoding for a I/O filter pipeline to the latest version. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Tuesday, July 24, 2007 diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 8665c49..6b5c8f7 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -15,7 +15,7 @@ * * Created: H5Oprivate.h * Aug 5 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Object header private include file. * @@ -105,6 +105,7 @@ typedef struct H5O_t H5O_t; #define H5O_BOGUS_MSG_ID_SIZE sizeof(unsigned) #endif /* H5O_ENABLE_BOGUS */ + #ifdef H5O_ENABLE_BAD_MESG_COUNT #define H5O_BAD_MESG_COUNT_NAME "bad message count" /* Flag setting bad message count */ #define H5O_BAD_MESG_COUNT_SIZE sizeof(hbool_t) @@ -210,7 +211,6 @@ typedef struct H5O_copy_t { #define H5O_REFCOUNT_ID 0x0016 /* Reference count message. */ #define H5O_UNKNOWN_ID 0x0017 /* Placeholder message ID for unknown message. */ /* (this should never exist in a file) */ - /* * Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g * in H5O.c when creating a new message type. Also bump the value of diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 0080a37..f7d0dbd 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -15,7 +15,7 @@ * * Created: H5Opublic.h * Aug 5 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Public declarations for the H5O (object header) * package. @@ -83,10 +83,10 @@ /* Types of objects in file */ typedef enum H5O_type_t { - H5O_TYPE_UNKNOWN = -1, /* Unknown object type */ - H5O_TYPE_GROUP, /* Object is a group */ - H5O_TYPE_DATASET, /* Object is a dataset */ - H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ + H5O_TYPE_UNKNOWN = -1, /* Unknown object type */ + H5O_TYPE_GROUP, /* Object is a group */ + H5O_TYPE_DATASET, /* Object is a dataset */ + H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ H5O_TYPE_NTYPES /* Number of different object types (must be last!) */ } H5O_type_t; @@ -111,13 +111,13 @@ typedef struct H5O_hdr_info_t { /* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */ typedef struct H5O_info_t { unsigned long fileno; /* File number that object is located in */ - haddr_t addr; /* Object address in file */ + haddr_t addr; /* Object address in file */ H5O_type_t type; /* Basic object type (group, dataset, etc.) */ unsigned rc; /* Reference count of object */ - time_t atime; /* Access time */ - time_t mtime; /* Modification time */ - time_t ctime; /* Change time */ - time_t btime; /* Birth time */ + time_t atime; /* Access time */ + time_t mtime; /* Modification time */ + time_t ctime; /* Change time */ + time_t btime; /* Birth time */ hsize_t num_attrs; /* # of attributes attached to object */ H5O_hdr_info_t hdr; /* Object header information */ /* Extra metadata storage for obj & attributes */ @@ -148,13 +148,13 @@ typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data); /* Public Variables */ /********************/ +/*********************/ +/* Public Prototypes */ +/*********************/ #ifdef __cplusplus extern "C" { #endif -/*********************/ -/* Public Prototypes */ -/*********************/ H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, @@ -190,7 +190,7 @@ H5_DLL herr_t H5Oclose(hid_t object_id); /* Typedefs */ -/* A struct that's part of the H5G_stat_t routine (deprecated) */ +/* A struct that's part of the H5G_stat_t structure (deprecated) */ typedef struct H5O_stat_t { hsize_t size; /* Total size of object header in file */ hsize_t free; /* Free space within object header */ @@ -199,7 +199,6 @@ typedef struct H5O_stat_t { } H5O_stat_t; /* Function prototypes */ - #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index bd679c1..a5be3a3 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -15,7 +15,7 @@ * * Created: H5Orefcount.c * Mar 10 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Object ref. count messages. * @@ -80,7 +80,6 @@ H5FL_DEFINE_STATIC(H5O_refcount_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- @@ -128,7 +127,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- @@ -165,7 +163,6 @@ H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- @@ -173,9 +170,9 @@ H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar static void * H5O_refcount_copy(const void *_mesg, void *_dest) { - const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; - H5O_refcount_t * dest = (H5O_refcount_t *)_dest; - void * ret_value; /* Return value */ + const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; + H5O_refcount_t * dest = (H5O_refcount_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -205,7 +202,6 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- @@ -228,7 +224,7 @@ H5O_refcount_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_ /*------------------------------------------------------------------------- * Function: H5O_refcount_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * @@ -290,7 +286,6 @@ H5O_refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UN * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index b9c1530..df58460 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -112,9 +112,9 @@ H5O_sdspace_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5S_extent_t *sdim = NULL; /* New extent dimensionality structure */ - void * ret_value; - unsigned i; /* local counting variable */ unsigned flags, version; + unsigned i; /* Local counting variable */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -295,9 +295,9 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) static void * H5O_sdspace_copy(const void *_mesg, void *_dest) { - const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg; - H5S_extent_t * dest = (H5S_extent_t *)_dest; - void * ret_value; /* Return value */ + const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg; + H5S_extent_t * dest = (H5S_extent_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -377,8 +377,6 @@ H5O_sdspace_size(const H5F_t *f, const void *_mesg) * Programmer: Robb Matzke * Thursday, April 30, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -396,7 +394,7 @@ H5O_sdspace_reset(void *_mesg) /*------------------------------------------------------------------------- * Function: H5O_sdsdpace_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 4803c91..d9ae2df 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Wednesday, April 1, 1998 * * Purpose: Functions that operate on a shared message. The shared @@ -90,7 +90,6 @@ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 24 2003 * *------------------------------------------------------------------------- @@ -205,7 +204,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 26 2003 * *------------------------------------------------------------------------- @@ -301,9 +299,9 @@ void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, 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; /* Return value */ + H5O_shared_t sh_mesg; /* Shared message info */ + unsigned version; /* Shared message version */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -428,7 +426,6 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf /*out*/, const H5O_shared_t *sh_m * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 26 2003 * *------------------------------------------------------------------------- @@ -464,7 +461,7 @@ 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) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -560,8 +557,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 @@ -618,17 +614,16 @@ done: /*------------------------------------------------------------------------- * Function: H5O_shared_post_copy_file * - * Purpose: Delate a shared message and replace with a new one. + * Purpose: Delete a shared message and replace with a new one. * The function is needed at cases such as coping a shared reg_ref attribute. * When a shared reg_ref attribute is copied from one file to * another, the values in file need to be replaced. The only way * 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 * May 24 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Oshared.h b/src/H5Oshared.h index f293234..25b395a 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * Friday, January 19, 2007 * * Purpose: This file contains inline definitions for "generic" routines @@ -48,7 +48,7 @@ static H5_INLINE void * H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -163,7 +163,7 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) { const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -316,8 +316,8 @@ static H5_INLINE void * H5O_SHARED_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, hid_t dxpl_id) { - void *dst_mesg = NULL; /* Destination message */ - void *ret_value; /* Return value */ + void *dst_mesg = NULL; /* Destination message */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 1392d10..f1a9066 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -150,9 +150,9 @@ H5O_shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c static void * H5O_shmesg_copy(const void *_mesg, void *_dest) { - const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; - H5O_shmesg_table_t * dest = (H5O_shmesg_table_t *)_dest; - void * ret_value; + const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; + H5O_shmesg_table_t * dest = (H5O_shmesg_table_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -190,7 +190,7 @@ done: static size_t H5O_shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Ostab.c b/src/H5Ostab.c index a756b01..b831fdd 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -15,7 +15,7 @@ * * Created: H5Ostab.c * Aug 6 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Symbol table messages. * @@ -86,7 +86,6 @@ H5FL_DEFINE_STATIC(H5O_stab_t); * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -96,8 +95,8 @@ H5O_stab_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *op unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { - H5O_stab_t *stab = NULL; - void * ret_value; /* Return value */ + H5O_stab_t *stab = NULL; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -115,10 +114,9 @@ H5O_stab_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *op ret_value = stab; done: - if (ret_value == NULL) { + if (ret_value == NULL) if (stab != NULL) stab = H5FL_FREE(H5O_stab_t, stab); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_stab_decode() */ @@ -131,7 +129,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -166,7 +163,6 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -174,9 +170,9 @@ 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) { - const H5O_stab_t *stab = (const H5O_stab_t *)_mesg; - H5O_stab_t * dest = (H5O_stab_t *)_dest; - void * ret_value; /* Return value */ + 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 @@ -207,7 +203,6 @@ done: * Failure: zero * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -215,7 +210,7 @@ done: static size_t H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -235,8 +230,6 @@ H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void * Programmer: Quincey Koziol * Thursday, March 30, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -304,8 +297,8 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, hbool_t H H5O_stab_t * stab_src = (H5O_stab_t *)native_src; H5O_stab_t * stab_dst = NULL; H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *)_udata; - size_t size_hint; /* Local heap initial size */ - void * ret_value; /* Return value */ + size_t size_hint; /* Local heap initial size */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -398,11 +391,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Otest.c b/src/H5Otest.c index 51b9d1a..9cef4d1 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@hdfgroup.org> +/* Programmer: Quincey Koziol * Monday, December 4, 2006 * * Purpose: Object header testing functions. @@ -85,10 +85,10 @@ htri_t H5O_is_attr_dense_test(hid_t oid) { - H5O_t * oh = NULL; /* Object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t * loc; /* Pointer to object's location */ - htri_t ret_value; /* Return value */ + H5O_t * oh = NULL; /* Object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + H5O_loc_t * loc; /* Pointer to object's location */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -152,7 +152,7 @@ H5O_is_attr_empty_test(hid_t oid) htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ H5O_loc_t * loc; /* Pointer to object's location */ hsize_t nattrs; /* Number of attributes */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index 8484b83..f0f54ba 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -15,7 +15,7 @@ * * Created: H5Ounknown.c * Apr 19 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Handle unknown message classes in a minimal way. * @@ -60,11 +60,11 @@ const H5O_msg_class_t H5O_MSG_UNKNOWN[1] = {{ H5FL_DEFINE(H5O_unknown_t); /*------------------------------------------------------------------------- - * Function: H5O_unknown_free + * Function: H5O_unknown_free * - * Purpose: Free's the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, May 1, 2007 @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ @@ -117,7 +117,7 @@ H5P__term_pub_interface(void) 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 @@ -131,10 +131,10 @@ H5P__term_pub_interface(void) hid_t H5Pcopy(hid_t id) { - void *obj; /* Property object to copy */ - hid_t ret_value = FALSE; /* return value */ + void *obj; /* Property object to copy */ + 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) @@ -142,14 +142,14 @@ H5Pcopy(hid_t id) /* 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 { @@ -157,12 +157,13 @@ H5Pcopy(hid_t id) /* 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"); + 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"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, + "unable to atomize property list class"); } /* end if */ } /* end else */ @@ -196,7 +197,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 @@ -209,40 +210,40 @@ H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t cls_create H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data) { - 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 */ + H5P_genclass_t *par_class = NULL; /* Pointer to the parent class */ + H5P_genclass_t *pclass = NULL; /* Property list class created */ + 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") + 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) + if (H5I_INVALID_HID == ret_value && pclass) H5P_close_class(pclass); FUNC_LEAVE_API(ret_value) @@ -257,7 +258,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 @@ -273,19 +274,19 @@ done: hid_t H5Pcreate(hid_t cls_id) { - H5P_genclass_t *pclass; /* Property list class to modify */ - hid_t ret_value; /* return value */ + H5P_genclass_t *pclass; /* Property list class to modify */ + 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) @@ -429,7 +430,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some tranformation/translation of the + set for the property or may perform some transformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -610,7 +611,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some tranformation/translation of the + set for the property or may perform some transformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -847,7 +848,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. @@ -860,31 +861,31 @@ done: hid_t 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 */ + H5P_genplist_t *plist; /* Property list to query */ + H5P_genclass_t *pclass = NULL; /* Property list class */ + 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"); + 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) + if (H5I_INVALID_HID == ret_value && pclass) H5P_close_class(pclass); FUNC_LEAVE_API(ret_value) @@ -1502,7 +1503,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. @@ -1518,27 +1519,27 @@ H5Pget_class_parent(hid_t pclass_id) H5P_genclass_t *parent = NULL; /* Parent's property class */ hid_t ret_value; /* 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") + 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") + 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) + if (H5I_INVALID_HID == ret_value && parent) H5P_close_class(parent); FUNC_LEAVE_API(ret_value) @@ -1565,7 +1566,7 @@ done: herr_t H5Pclose_class(hid_t cls_id) { - hid_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", cls_id); @@ -200,21 +200,22 @@ H5PL__init_interface(void) } /* end H5PL__init_interface() */ /*------------------------------------------------------------------------- - * Function: H5PLset_loading_state + * Function: H5PLset_loading_state * - * Purpose: Control the loading of dynamic plugin types. + * Purpose: Control the loading of dynamic plugin types. * - * This function will not allow plugin types if the pathname from the HDF5_PLUGIN_PRELOAD - * environment variable is set to the special "::" string. + * This function will not allow plugin types if the pathname from the HDF5_PLUGIN_PRELOAD + * environment variable is set to the special "::" string. * - * plugin bit = 0, will prevent the use of that dynamic plugin type. - * plugin bit = 1, will allow the use of that dynamic plugin type. + * plugin bit = 0, will prevent the use of that dynamic plugin type. + * plugin bit = 1, will allow the use of that dynamic plugin type. * - * H5PL_TYPE_FILTER changes just dynamic filters - * A H5PL_ALL_PLUGIN will enable all dynamic plugin types - * A zero value will disable all dynamic plugin types + * H5PL_TYPE_FILTER changes just dynamic filters + * A H5PL_ALL_PLUGIN will enable all dynamic plugin types + * A zero value will disable all dynamic plugin types * - * Return: Non-negative or success + * Return: Success: Non-negative + * Failture: Negative * *------------------------------------------------------------------------- */ @@ -241,14 +242,17 @@ done: } /* end H5PLset_loading_state() */ /*------------------------------------------------------------------------- - * Function: H5PLget_loading_state + * Function: H5PLget_loading_state * - * Purpose: Query state of the loading of dynamic plugin types. + * Purpose: Query state of the loading of dynamic plugin types. * - * This function will return the state of the global flag. + * This function will return the state of the global flag. * - * Return: Zero if all plugin types are disabled, negative if all - * plugin types are enabled, positive if one or more of the plugin types are enabled. + * Zero if all plugin types are disabled, negative if all + * plugin types are enabled, positive if one or more of the plugin types are enabled. + * + * Return: Success: Non-negative + * Failture: Negative * *------------------------------------------------------------------------- */ @@ -389,11 +393,12 @@ done: } /* end H5PL_load() */ /*------------------------------------------------------------------------- - * Function: H5PLappend + * Function: H5PLappend * - * Purpose: Insert a plugin path at the end of the list. + * Purpose: Insert a plugin search path at the end of the list. * - * Return: Non-negative or success. + * Return: Success: Non-negative + * Failture: Negative * *------------------------------------------------------------------------- */ @@ -422,11 +427,12 @@ done: } /* end H5PLappend() */ /*------------------------------------------------------------------------- - * Function: H5PLprepend + * Function: H5PLprepend * - * Purpose: Insert a plugin path at the beginning of the list. + * Purpose: Insert a plugin search path at the beginning of the list. * - * Return: Non-negative or success. + * Return: Success: Non-negative + * Failture: Negative * *------------------------------------------------------------------------- */ @@ -458,11 +464,12 @@ done: } /* end H5PLprepend() */ /*------------------------------------------------------------------------- - * Function: H5PLreplace + * Function: H5PLreplace * - * Purpose: Replace the path at the specified index. + * Purpose: Replace the path at the specified index. The path at the + * index must exist. * - * Return: Non-negative or success. + * Return: Non-negative or success. * *------------------------------------------------------------------------- */ @@ -492,11 +499,13 @@ done: } /* end H5PLreplace() */ /*------------------------------------------------------------------------- - * Function: H5PLinsert + * Function: H5PLinsert * - * Purpose: Insert a plugin path at the specified index, moving other paths after the index. + * Purpose: Insert a plugin search path at the specified index, moving + * other paths after the index. * - * Return: Non-negative or success. + * Return: Success: Non-negative + * Failture: Negative * *------------------------------------------------------------------------- */ @@ -530,11 +539,13 @@ done: } /* end H5PLinsert() */ /*------------------------------------------------------------------------- - * Function: H5PLremove + * Function: H5PLremove * - * Purpose: Remove the plugin path at the specifed index and compacting the list. + * Purpose: Remove the plugin path at the specifed index and compact + * the list. * - * Return: Non-negative or success. + * Return: Success: Non-negative + * Failture: Negative * *------------------------------------------------------------------------- */ @@ -564,20 +575,26 @@ done: } /* end H5PLremove() */ /*------------------------------------------------------------------------- - * Function: H5PLget + * Function: H5PLget + * + * Purpose: Query the plugin path at a specified index. + * + * If 'path_buf' is non-NULL then up to 'buf_size' bytes will be written into + * that buffer and the length of the path name will be returned. + * + * If 'path_buf' is NULL, this function will simply return the number of + * characters required to store the path name, ignoring 'path_buf' and + * 'buf_size' * - * Purpose: Query the plugin path at the specified index. + * If an error occurs then the buffer pointed to by 'path_buf' + * (NULL or non-NULL) will be unchanged and the function will return a + * negative value. * - * Return: Success: The length of path. + * If a zero is returned for the name's length, then there is no path name + * associated with the index and the 'path_buf' buffer will be unchanged. * - * If `pathname' is non-NULL then write up to `size' bytes into that - * buffer and always return the length of the pathname. - * Otherwise `size' is ignored and the function does not store the pathname, - * just returning the number of characters required to store the pathname. - * If an error occurs then the buffer pointed to by `pathname' (NULL or non-NULL) - * is unchanged and the function returns a negative value. - * If a zero is returned for the name's length, then there is no pathname - * associated with the index. + * Return: Success: The length of path + * Failure: A negative value * *------------------------------------------------------------------------- */ @@ -611,11 +628,11 @@ done: } /* end H5PLget() */ /*------------------------------------------------------------------------- - * Function: H5PLsize + * Function: H5PLsize * - * Purpose: Query the size of the current list of plugin paths. + * Purpose: Query the size of the current list of plugin paths. * - * Return: Plugin path size + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ diff --git a/src/H5PLextern.h b/src/H5PLextern.h index e00721f..2385d54 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -11,9 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu <songyulu@hdfgroup.org> - * 13 February 2013 + * Purpose: Header file for writing external HDF5 plugins. */ + #ifndef _H5PLextern_H #define _H5PLextern_H diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 59516d9..6b3294d 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Raymond Lu <songyulu@hdfgroup.org> - * 13 February 2013 +/* + * This file contains private information about the H5PL module */ #ifndef _H5PLprivate_H diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index ded2362..97f4e15 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Raymond Lu <songyulu@hdfgroup.org> - * 13 February 2013 +/* + * This file contains public declarations for the H5PL module. */ #ifndef _H5PLpublic_H @@ -26,9 +26,9 @@ /* Plugin type used by the plugin library */ typedef enum H5PL_type_t { - H5PL_TYPE_ERROR = -1, /*error */ - H5PL_TYPE_FILTER = 0, /*filter */ - H5PL_TYPE_NONE = 1 /*this must be last! */ + H5PL_TYPE_ERROR = -1, /* Error */ + H5PL_TYPE_FILTER = 0, /* Filter */ + H5PL_TYPE_NONE = 1 /* This must be last! */ } H5PL_type_t; /* Common dynamic plugin type flags used by the set/get_loading_state functions */ diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 2c94a70..93f04f8 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pacpl.c - * January 2 2006 - * James Laird <jlaird@ncsa.uiuc.edu> + * Created: H5Pacpl.c * - * Purpose: Attribute creation property list class routines + * Purpose: Attribute creation property list class routines * *------------------------------------------------------------------------- */ @@ -56,21 +54,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 */ + "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 */ + &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 */ + 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 72afaad..787491c 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Pdapl.c + * Created: H5Pdapl.c * October 27, 2008 - * Neil Fortner <nfortne2@hdfgroup.org> + * Neil Fortner * - * Purpose: Dataset access property list class routines + * Purpose: Dataset access property list class routines * *------------------------------------------------------------------------- */ @@ -127,9 +127,6 @@ static const char *H5D_def_efile_prefix_g = * properties * * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * October 27, 2008 *------------------------------------------------------------------------- */ static herr_t @@ -175,7 +172,6 @@ done: * for a property list * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -200,7 +196,6 @@ H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * from a property list * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -224,7 +219,6 @@ H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Purpose: Frees memory used to store the external file prefix string * * Return: SUCCEED (Can't fail) - * *------------------------------------------------------------------------- */ static herr_t @@ -246,7 +240,6 @@ H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Purpose: Creates a copy of the external file prefix string * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -269,7 +262,6 @@ H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED * compared. * * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. - * *------------------------------------------------------------------------- */ static int @@ -298,7 +290,6 @@ done: * Purpose: Frees memory used to store the external file prefix string * * Return: SUCCEED/FAIL - * *------------------------------------------------------------------------- */ static herr_t @@ -314,33 +305,27 @@ H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE } /* end H5P__dapl_efile_pref_close() */ /*------------------------------------------------------------------------- - * Function: H5Pset_chunk_cache - * - * Purpose: Set the number of objects in the meta data cache and the - * maximum number of chunks and bytes in the raw data chunk cache. - * Once set, these values will override the values in the file access - * property list. Each of thhese values can be individually unset - * (or not set at all) by passing the macros: - * H5D_CHUNK_CACHE_NCHUNKS_DEFAULT, - * H5D_CHUNK_CACHE_NSLOTS_DEFAULT, and/or - * H5D_CHUNK_CACHE_W0_DEFAULT - * as appropriate. - * - * The RDCC_W0 value should be between 0 and 1 inclusive and - * indicates how much chunks that have been fully read or fully - * written are favored for preemption. A value of zero means - * fully read or written chunks are treated no differently than - * other chunks (the preemption is strictly LRU) while a value - * of one means fully read chunks are always preempted before - * other chunks. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Monday, October 27, 2008 - * - * Modifications: - * + * Function: H5Pset_chunk_cache + * + * Purpose: Set the number of objects in the meta data cache and the + * maximum number of chunks and bytes in the raw data chunk cache. + * Once set, these values will override the values in the file access + * property list. Each of thhese values can be individually unset + * (or not set at all) by passing the macros: + * H5D_CHUNK_CACHE_NCHUNKS_DEFAULT, + * H5D_CHUNK_CACHE_NSLOTS_DEFAULT, and/or + * H5D_CHUNK_CACHE_W0_DEFAULT + * as appropriate. + * + * The RDCC_W0 value should be between 0 and 1 inclusive and + * indicates how much chunks that have been fully read or fully + * written are favored for preemption. A value of zero means + * fully read or written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) while a value + * of one means fully read chunks are always preempted before + * other chunks. + * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -376,23 +361,17 @@ done: } /* end H5Pset_chunk_cache() */ /*------------------------------------------------------------------------- - * Function: H5Pget_chunk_cache - * - * Purpose: Retrieves the maximum possible number of elements in the meta - * data cache and the maximum possible number of elements and - * bytes and the RDCC_W0 value in the raw data chunk cache. Any - * (or all) arguments may be null pointers in which case the - * corresponding datum is not returned. If these properties have - * not been set on this property list, the default values for a - * file access property list are returned. - * - * Return: Non-negative on success/Negative on failure + * Function: H5Pget_chunk_cache * - * Programmer: Neil Fortner - * Monday, October 27, 2008 - * - * Modifications: + * Purpose: Retrieves the maximum possible number of elements in the meta + * data cache and the maximum possible number of elements and + * bytes and the RDCC_W0 value in the raw data chunk cache. Any + * (or all) arguments may be null pointers in which case the + * corresponding datum is not returned. If these properties have + * not been set on this property list, the default values for a + * file access property list are returned. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -455,8 +434,7 @@ done: * This property can be overwritten by the environment variable * HDF5_EXTFILE_PREFIX. * - * Return: Non-negative on success/Negative on failure - * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -481,15 +459,13 @@ done: } /* end H5Pset_efile_prefix() */ /*------------------------------------------------------------------------- - * Function: H5Pget_efile_prefix - * - * Purpose: Gets the prefix to be used for any external files. - * - * If the pointer is not NULL, it points to a user-allocated - * buffer. + * Function: H5Pget_efile_prefix * - * Return: Non-negative on success/Negative on failure + * Purpose: Gets the prefix to be used for any external files. + * If the pointer is not NULL, it points to a user-allocated + * buffer. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ ssize_t diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index e1b6b88..29588a7 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pdcpl.c - * February 26 1998 - * Robb Matzke <matzke@llnl.gov> + * Created: H5Pdcpl.c * - * Purpose: Dataset creation property list class routines + * Purpose: Dataset creation property list class routines * *------------------------------------------------------------------------- */ @@ -783,13 +781,6 @@ H5P__init_def_layout(void) * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -859,13 +850,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and get property for - * generic property list. - * *------------------------------------------------------------------------- */ H5D_layout_t @@ -908,13 +892,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -989,13 +966,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ int @@ -1127,13 +1097,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ int @@ -1183,13 +1146,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and get property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -1309,8 +1265,6 @@ done: * Programmer: Kent Yang * Wednesday, November 13, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1353,9 +1307,6 @@ done: * Programmer: Xiaowen Wu * Wednesday, December 22, 2004 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -1414,9 +1365,6 @@ done: * Programmer: Xiaowen Wu * Thursday, April 14, 2005 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -1470,7 +1418,7 @@ done: * Function: H5Pset_fill_value * * Purpose: Set the fill value for a dataset creation property list. The - * VALUE is interpretted as being of type TYPE, which need not + * VALUE is interpreted as being of type TYPE, which need not * be the same type as the dataset but the library must be able * to convert VALUE to the dataset type when the dataset is * created. If VALUE is NULL, it will be interpreted as @@ -1481,13 +1429,6 @@ done: * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -1822,9 +1763,6 @@ done: * Programmer: Raymond Lu * Wednesday, January 16, 2002 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -1998,9 +1936,6 @@ done: * Programmer: Raymond Lu * Wednesday, January 16, 2002 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 8f3d80a..b045df4 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Pdeprec.c * October 11 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Deprecated functions from the H5P interface. These * functions are here for compatibility purposes and may be @@ -239,7 +239,7 @@ H5P__term_deprec_interface(void) GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some tranformation/translation of the + set for the property or may perform some transformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -420,7 +420,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some tranformation/translation of the + set for the property or may perform some transformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 76c933f..756a6fa 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -15,7 +15,7 @@ * * Created: H5Pdxpl.c * March 16 1998 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Data transfer property list class routines * @@ -441,7 +441,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -473,7 +473,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -487,8 +487,10 @@ H5P__dxfr_xform_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); + /* Make copy of data transform */ if (H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error copying the data transform info") @@ -562,7 +564,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -632,10 +634,9 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression") done: - if (ret_value < 0) { + if (ret_value < 0) if (data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0) HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Pset_data_transform() */ @@ -688,6 +689,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) if (NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop))) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression") + /* Copy into application buffer */ len = HDstrlen(pexp); if (expression) { HDstrncpy(expression, pexp, MIN(len + 1, size)); @@ -713,7 +715,7 @@ done: * for the type conversion buffer and background buffer and * optionally supply pointers to application-allocated buffers. * If the buffer size is smaller than the entire amount of data - * being transfered between application and file, and a type + * being transferred between application and file, and a type * conversion buffer or background buffer is required then * strip mining will be used. * @@ -969,8 +971,6 @@ done: * Programmer: Raymond Lu * Jan 14, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1010,8 +1010,6 @@ done: * Programmer: Raymond Lu * April 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1051,8 +1049,6 @@ done: * Programmer: Raymond Lu * April 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1492,5 +1488,4 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_mpio_no_collective_cause() */ - #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 35ebffe..3cc6ed6 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pfapl.c - * February 26 1998 - * Robb Matzke <matzke@llnl.gov> + * Created: H5Pfapl.c * - * Purpose: File access property list class routines + * Purpose: File access property list class routines * *------------------------------------------------------------------------- */ @@ -40,11 +38,11 @@ #include "H5MMprivate.h" /* Memory Management */ #include "H5Ppkg.h" /* Property lists */ -/* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +/* Includes needed to set default file driver */ +#include "H5FDsec2.h" /* POSIX unbuffered I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif /****************/ @@ -505,33 +503,27 @@ done: } /* end H5P_facc_close() */ /*------------------------------------------------------------------------- - * Function: H5Pset_alignment - * - * Purpose: Sets the alignment properties of a file access property list - * so that any file object >= THRESHOLD bytes will be aligned on - * an address which is a multiple of ALIGNMENT. The addresses - * are relative to the end of the user block; the alignment is - * calculated by subtracting the user block size from the - * absolute file address and then adjusting the address to be a - * multiple of ALIGNMENT. - * - * Default values for THRESHOLD and ALIGNMENT are one, implying - * no alignment. Generally the default values will result in - * the best performance for single-process access to the file. - * For MPI-IO and other parallel systems, choose an alignment - * which is a multiple of the disk block size. + * Function: H5Pset_alignment * - * Return: Non-negative on success/Negative on failure + * Purpose: Sets the alignment properties of a file access property list + * so that any file object >= THRESHOLD bytes will be aligned on + * an address which is a multiple of ALIGNMENT. The addresses + * are relative to the end of the user block; the alignment is + * calculated by subtracting the user block size from the + * absolute file address and then adjusting the address to be a + * multiple of ALIGNMENT. * - * Programmer: Robb Matzke - * Tuesday, June 9, 1998 + * Default values for THRESHOLD and ALIGNMENT are one, implying + * no alignment. Generally the default values will result in + * the best performance for single-process access to the file. + * For MPI-IO and other parallel systems, choose an alignment + * which is a multiple of the disk block size. * - * Modifications: + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Tuesday, June 9, 1998 * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed file access property list mechanism to the new - * generic property list. *------------------------------------------------------------------------- */ herr_t @@ -562,15 +554,15 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Pget_alignment + * Function: H5Pget_alignment * - * Purpose: Returns the current settings for alignment properties from a - * file access property list. The THRESHOLD and/or ALIGNMENT - * pointers may be null pointers. + * Purpose: Returns the current settings for alignment properties from a + * file access property list. The THRESHOLD and/or ALIGNMENT + * pointers may be null pointers. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * *------------------------------------------------------------------------- @@ -601,20 +593,20 @@ done: } /* end H5Pget_alignment() */ /*------------------------------------------------------------------------- - * Function: H5P_set_driver + * Function: H5P_set_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -654,20 +646,20 @@ done: } /* end H5P_set_driver() */ /*------------------------------------------------------------------------- - * Function: H5Pset_driver + * Function: H5Pset_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -698,18 +690,18 @@ done: /*------------------------------------------------------------------------- * Function: H5P_get_driver * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -736,20 +728,22 @@ done: } /* end H5P_get_driver() */ /*------------------------------------------------------------------------- - * Function: H5Pget_driver + * Function: H5Pget_driver + * + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Note: The ID returned should not be closed. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -776,18 +770,18 @@ done: /*------------------------------------------------------------------------- * Function: H5P_get_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -812,20 +806,20 @@ done: } /* end H5P_get_driver_info() */ /*------------------------------------------------------------------------- - * Function: H5Pget_driver_info + * Function: H5Pget_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -1007,23 +1001,23 @@ done: } /* end H5Pget_multi_type() */ /*------------------------------------------------------------------------- - * Function: H5Pset_cache + * Function: H5Pset_cache * - * Purpose: Set the number of objects in the meta data cache and the - * maximum number of chunks and bytes in the raw data chunk - * cache. + * Purpose: Set the number of objects in the meta data cache and the + * maximum number of chunks and bytes in the raw data chunk + * cache. * - * The RDCC_W0 value should be between 0 and 1 inclusive and - * indicates how much chunks that have been fully read or fully - * written are favored for preemption. A value of zero means - * fully read or written chunks are treated no differently than - * other chunks (the preemption is strictly LRU) while a value - * of one means fully read chunks are always preempted before - * other chunks. + * The RDCC_W0 value should be between 0 and 1 inclusive and + * indicates how much chunks that have been fully read or fully + * written are favored for preemption. A value of zero means + * fully read or written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) while a value + * of one means fully read chunks are always preempted before + * other chunks. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- @@ -1060,17 +1054,17 @@ done: } /* end H5Pset_cache() */ /*------------------------------------------------------------------------- - * Function: H5Pget_cache + * Function: H5Pget_cache * - * Purpose: Retrieves the maximum possible number of elements in the meta - * data cache and the maximum possible number of elements and - * bytes and the RDCC_W0 value in the raw data chunk cache. Any - * (or all) arguments may be null pointers in which case the - * corresponding datum is not returned. + * Purpose: Retrieves the maximum possible number of elements in the meta + * data cache and the maximum possible number of elements and + * bytes and the RDCC_W0 value in the raw data chunk cache. Any + * (or all) arguments may be null pointers in which case the + * corresponding datum is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- @@ -1152,18 +1146,18 @@ done: } /* H5Pset_mdc_config() */ /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_config + * Function: H5Pget_mdc_config * - * Purpose: Retrieve the metadata cache initial resize configuration - * from the target FAPL. + * Purpose: Retrieve the metadata cache initial resize configuration + * from the target FAPL. * - * Observe that the function will fail if config_ptr is - * NULL, or if config_ptr->version specifies an unknown - * version of H5AC_cache_config_t. + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_config_t. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, April 7, 2005 * *------------------------------------------------------------------------- @@ -1189,7 +1183,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") /* If we ever support multiple versions of H5AC_cache_config_t, we - * will have to get the cannonical version here, and then translate + * will have to get the canonical version here, and then translate * to the version of the structure supplied. */ @@ -1202,33 +1196,26 @@ done: } /* H5Pget_mdc_config() */ /*------------------------------------------------------------------------- - * Function: H5Pset_gc_references - * - * Purpose: Sets the flag for garbage collecting references for the file. - * Dataset region references (and other reference types - * probably) use space in the file heap. If garbage collection - * is on and the user passes in an uninitialized value in a - * reference structure, the heap might get corrupted. When - * garbage collection is off however and the user re-uses a - * reference, the previous heap block will be orphaned and not - * returned to the free heap space. When garbage collection is - * on, the user must initialize the reference structures to 0 or - * risk heap corruption. - * - * Default value for garbage collecting references is off, just - * to be on the safe side. + * Function: H5Pset_gc_references * - * Return: Non-negative on success/Negative on failure + * Purpose: Sets the flag for garbage collecting references for the file. + * Dataset region references (and other reference types + * probably) use space in the file heap. If garbage collection + * is on and the user passes in an uninitialized value in a + * reference structure, the heap might get corrupted. When + * garbage collection is off however and the user re-uses a + * reference, the previous heap block will be orphaned and not + * returned to the free heap space. When garbage collection is + * on, the user must initialize the reference structures to 0 or + * risk heap corruption. * - * Programmer: Quincey Koziol - * June, 1999 + * Default value for garbage collecting references is off, just + * to be on the safe side. * - * Modifications: + * Return: Non-negative on success/Negative on failure * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Programmer: Quincey Koziol + * June, 1999 * *------------------------------------------------------------------------- */ @@ -1254,23 +1241,16 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Pget_gc_references + * Function: H5Pget_gc_references * - * Purpose: Returns the current setting for the garbage collection - * references property from a file access property list. + * Purpose: Returns the current setting for the garbage collection + * references property 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 + * Programmer: Quincey Koziol * June, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -1305,8 +1285,6 @@ done: * Programmer: Raymond Lu * November, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1340,8 +1318,6 @@ done: * Programmer: Raymond Lu * November, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1365,32 +1341,25 @@ done: } /* end H5Pget_fclose_degree() */ /*------------------------------------------------------------------------- - * Function: H5Pset_meta_block_size + * Function: H5Pset_meta_block_size * - * Purpose: Sets the minimum size of metadata block allocations when + * Purpose: Sets the minimum size of metadata block allocations when * the H5FD_FEAT_AGGREGATE_METADATA is set by a VFL driver. * Each "raw" metadata block is allocated to be this size and then * specific pieces of metadata (object headers, local heaps, B-trees, etc) * are sub-allocated from this block. * - * The default value is set to 2048 (bytes), indicating that metadata + * The default value is set to 2048 (bytes), indicating that metadata * will be attempted to be bunched together in (at least) 2K blocks in * the file. Setting the value to 0 with this API function will * turn off the metadata aggregation, even if the VFL driver attempts to * use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -1415,23 +1384,16 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Pget_meta_block_size + * Function: H5Pget_meta_block_size * - * Purpose: Returns the current settings for the metadata block allocation + * Purpose: Returns the current settings for the metadata block allocation * property 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 + * Programmer: Quincey Koziol * Friday, August 29, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -1458,32 +1420,25 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Pset_sieve_buf_size + * Function: H5Pset_sieve_buf_size * - * Purpose: Sets the maximum size of the data seive buffer used for file + * Purpose: Sets the maximum size of the data seive buffer used for file * drivers which are capable of using data sieving. The data sieve * buffer is used when performing I/O on datasets in the file. Using a * buffer which is large anough to hold several pieces of the dataset * being read in for hyperslab selections boosts performance by quite a * bit. * - * The default value is set to 64KB, indicating that file I/O for raw data + * The default value is set to 64KB, indicating that file I/O for raw data * reads and writes will occur in at least 64KB blocks. * Setting the value to 0 with this API function will turn off the * data sieving, even if the VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -1508,23 +1463,16 @@ done: } /* end H5Pset_sieve_buf_size() */ /*------------------------------------------------------------------------- - * Function: H5Pget_sieve_buf_size + * Function: H5Pget_sieve_buf_size * - * Purpose: Returns the current settings for the data sieve buffer size + * Purpose: Returns the current settings for the data sieve buffer size * property 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 + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -1550,27 +1498,25 @@ done: } /* end H5Pget_sieve_buf_size() */ /*------------------------------------------------------------------------- - * Function: H5Pset_small_data_block_size + * Function: H5Pset_small_data_block_size * - * Purpose: Sets the minimum size of "small" raw data block allocations + * Purpose: Sets the minimum size of "small" raw data block allocations * when the H5FD_FEAT_AGGREGATE_SMALLDATA is set by a VFL driver. * Each "small" raw data block is allocated to be this size and then * pieces of raw data which are small enough to fit are sub-allocated from * this block. * - * The default value is set to 2048 (bytes), indicating that raw data + * The default value is set to 2048 (bytes), indicating that raw data * smaller than this value will be attempted to be bunched together in (at * least) 2K blocks in the file. Setting the value to 0 with this API * function will turn off the "small" raw data aggregation, even if the * VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1595,18 +1541,16 @@ done: } /* end H5Pset_small_data_block_size() */ /*------------------------------------------------------------------------- - * Function: H5Pget_small_data_block_size + * Function: H5Pget_small_data_block_size * - * Purpose: Returns the current settings for the "small" raw data block + * Purpose: Returns the current settings for the "small" raw data block * allocation property 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 + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1633,9 +1577,9 @@ done: } /* end H5Pget_small_data_block_size() */ /*------------------------------------------------------------------------- - * Function: H5Pset_libver_bounds + * Function: H5Pset_libver_bounds * - * Purpose: Indicates which versions of the file format the library should + * Purpose: Indicates which versions of the file format the library should * use when creating objects. LOW is the earliest version of the HDF5 * library that is guaranteed to be able to access the objects created * (the format of some objects in an HDF5 file may not have changed between @@ -1692,7 +1636,7 @@ done: * necessary to represent features used. * (This is the "make certain to take advantage of <new feature> * in the file format" use case (maybe <new feature> is smaller - * or scales better than an ealier version, which would otherwise + * or scales better than an earlier version, which would otherwise * be used)) * * LOW = H5F_FORMAT_1_2_0, HIGH = H5F_FORMAT_1_6_0 => creates objects @@ -1749,14 +1693,14 @@ done: } /* end H5Pset_libver_bounds() */ /*------------------------------------------------------------------------- - * Function: H5Pget_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 + * Programmer: Quincey Koziol * Thursday, January 3, 2008 * *------------------------------------------------------------------------- @@ -1890,7 +1834,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) /* validate parameters */ if (!(((buf_ptr == NULL) && (buf_len == 0)) || ((buf_ptr != NULL) && (buf_len > 0)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistant buf_ptr and buf_len") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistent buf_ptr and buf_len") /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -1950,23 +1894,23 @@ done: * Function: H5Pget_file_image * * Purpose: If the file image exists and buf_ptr_ptr is not NULL, - * allocate a buffer of the correct size, copy the image into - * the new buffer, and return the buffer to the caller in - * *buf_ptr_ptr. Do this using the file image callbacks - * if defined. + * allocate a buffer of the correct size, copy the image into + * the new buffer, and return the buffer to the caller in + * *buf_ptr_ptr. Do this using the file image callbacks + * if defined. * - * NB: It is the responsibility of the caller to free the - * buffer whose address is returned in *buf_ptr_ptr. Do - * this using free if the file image callbacks are not - * defined, or with whatever method is appropriate if - * the callbacks are defined. + * NB: It is the responsibility of the caller to free the + * buffer whose address is returned in *buf_ptr_ptr. Do + * this using free if the file image callbacks are not + * defined, or with whatever method is appropriate if + * the callbacks are defined. * * If buf_ptr_ptr is not NULL, and no image exists, set - * *buf_ptr_ptr to NULL. + * *buf_ptr_ptr to NULL. * - * If buf_len_ptr is not NULL, set *buf_len_ptr equal - * to the length of the file image if it exists, and - * to 0 if it does not. + * If buf_len_ptr is not NULL, set *buf_len_ptr equal + * to the length of the file image if it exists, and + * to 0 if it does not. * * Return: Non-negative on success/Negative on failure * @@ -1993,7 +1937,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) if (H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") - /* verify file image field consistancy */ + /* verify file image field consistency */ HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || ((image_info.buffer == NULL) && (image_info.size == 0))); @@ -2068,7 +2012,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback if (H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") - /* verify file image field consistancy */ + /* verify file image field consistency */ HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* Make sure a file image hasn't already been set */ @@ -2144,7 +2088,7 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback if (H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") - /* verify file image field consistancy */ + /* verify file image field consistency */ HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* verify that callbacks_ptr is not NULL */ @@ -2246,7 +2190,7 @@ H5P_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED info = (H5FD_file_image_info_t *)value; - /* verify file image field consistancy */ + /* verify file image field consistency */ HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); @@ -2382,12 +2326,15 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Pget_core_write_tracking + * Function: H5Pget_core_write_tracking * - * Purpose: Gets information about core VFD write tracking and page + * Purpose: Gets information about core VFD write tracking and page * aggregation size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure + * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 * *------------------------------------------------------------------------- */ diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 957393c..1719360 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pfcpl.c * January 6 1998 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: File creation property list class routines * @@ -319,11 +319,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -474,11 +469,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -501,7 +491,7 @@ H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value exceeds maximum B-tree entries"); if (H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes"); btree_k[H5B_SNODE_ID] = ik; if (H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes"); @@ -527,11 +517,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -574,11 +559,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -604,10 +584,10 @@ H5Pset_istore_k(hid_t plist_id, unsigned ik) /* Set value */ if (H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes"); btree_k[H5B_CHUNK_ID] = ik; if (H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree interanl nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree internal nodes"); done: FUNC_LEAVE_API(ret_value) @@ -627,11 +607,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -651,7 +626,7 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */) /* Get value */ if (ik) { if (H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes"); *ik = btree_k[H5B_CHUNK_ID]; } /* end if */ @@ -941,15 +916,13 @@ H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *mi if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - /* Get value */ - if (max_list) { + /* Get value(s) */ + if (max_list) if (H5P_get(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, max_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get list maximum"); - } - if (min_btree) { + if (min_btree) if (H5P_get(plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, min_btree) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM information"); - } done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index a6f1734..df78bec 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -15,7 +15,7 @@ * * Created: H5Pmtpl.c * November 1 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: File mount property list class routines * diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 0cb665e..614b360 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pgcpl.c * August 29 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Quincey Koziol * * Purpose: Group creation property list class routines * @@ -30,12 +30,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 */ /****************/ /* Local Macros */ diff --git a/src/H5Pint.c b/src/H5Pint.c index ede19be..b0c10ee 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ @@ -91,59 +91,59 @@ static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop * Predefined property list classes. These are initialized at runtime by * H5P_init_interface() in this source file. */ -hid_t H5P_CLS_ROOT_ID_g = FAIL; +hid_t H5P_CLS_ROOT_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ROOT_g = NULL; -hid_t H5P_CLS_OBJECT_CREATE_ID_g = FAIL; +hid_t H5P_CLS_OBJECT_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_OBJECT_CREATE_g = NULL; -hid_t H5P_CLS_FILE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_FILE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_CREATE_g = NULL; -hid_t H5P_CLS_FILE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_FILE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_ACCESS_g = NULL; -hid_t H5P_CLS_DATASET_CREATE_ID_g = FAIL; +hid_t H5P_CLS_DATASET_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_CREATE_g = NULL; -hid_t H5P_CLS_DATASET_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_DATASET_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_ACCESS_g = NULL; -hid_t H5P_CLS_DATASET_XFER_ID_g = FAIL; +hid_t H5P_CLS_DATASET_XFER_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_XFER_g = NULL; -hid_t H5P_CLS_FILE_MOUNT_ID_g = FAIL; +hid_t H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_MOUNT_g = NULL; -hid_t H5P_CLS_GROUP_CREATE_ID_g = FAIL; +hid_t H5P_CLS_GROUP_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_GROUP_CREATE_g = NULL; -hid_t H5P_CLS_GROUP_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_GROUP_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g = NULL; -hid_t H5P_CLS_DATATYPE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g = NULL; -hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; -hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; -hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL; +hid_t H5P_CLS_OBJECT_COPY_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL; -hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL; +hid_t H5P_CLS_LINK_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_LINK_CREATE_g = NULL; -hid_t H5P_CLS_LINK_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_LINK_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_LINK_ACCESS_g = NULL; -hid_t H5P_CLS_STRING_CREATE_ID_g = FAIL; +hid_t H5P_CLS_STRING_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_STRING_CREATE_g = NULL; /* * Predefined property lists for each predefined class. These are initialized * at runtime by H5P_init_interface() in this source file. */ -hid_t H5P_LST_FILE_CREATE_ID_g = FAIL; -hid_t H5P_LST_FILE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATASET_CREATE_ID_g = FAIL; -hid_t H5P_LST_DATASET_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATASET_XFER_ID_g = FAIL; -hid_t H5P_LST_FILE_MOUNT_ID_g = FAIL; -hid_t H5P_LST_GROUP_CREATE_ID_g = FAIL; -hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL; -hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL; -hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL; -hid_t H5P_LST_LINK_CREATE_ID_g = FAIL; -hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL; +hid_t H5P_LST_FILE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_FILE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_XFER_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_GROUP_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_GROUP_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_OBJECT_COPY_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_LINK_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_LINK_ACCESS_ID_g = H5I_INVALID_HID; /* Root property list class library initialization object */ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ @@ -374,14 +374,11 @@ done: * Purpose: Initialize the interface from some other layer. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Saturday, March 4, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -424,8 +421,8 @@ H5P_init_interface(void) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") /* Repeatedly pass over the list of property list classes for the library, - * initializing each class if it's parent class is initialized, until no - * more progress is made. + * initializing each class if its parent class is initialized, until no + * more progress is made. */ tot_init = 0; do { @@ -665,7 +662,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 @@ -688,9 +685,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); @@ -700,7 +697,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; @@ -709,11 +706,13 @@ 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 @@ -721,7 +720,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) * already been seen) */ if ((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for seen properties") nseen = 0; /* Cycle through the deleted properties & copy them into the new list's deleted section */ @@ -732,15 +731,17 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Duplicate string for insertion into new deleted property skip list */ if ((new_name = H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Insert property name into deleted list */ if (H5SL_insert(new_plist->del, new_name, new_name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, 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 */ @@ -757,25 +758,26 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Make a copy of the list's property */ if (NULL == (new_prop = H5P_dup_prop(tmp, H5P_PROP_WITHIN_LIST))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") /* Call property copy callback, if it exists */ if (new_prop->copy) { if ((new_prop->copy)(new_prop->name, new_prop->size, new_prop->value) < 0) { H5P_free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") } /* end if */ } /* end if */ /* Insert the initialized property into the property list */ if (H5P_add_prop(new_plist->props, new_prop) < 0) { H5P_free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "Can't insert property into list") } /* end if */ /* Add property name to "seen" list */ if (H5SL_insert(seen, new_prop->name, new_prop->name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, 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 */ @@ -802,17 +804,17 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Only "copy" properties we haven't seen before */ if (nseen == 0 || H5SL_search(seen, tmp->name) == NULL) { - /* Call property creation callback, if it exists */ + /* 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, + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; } /* end if */ @@ -832,11 +834,11 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Increment the number of property lists derived from class */ if (H5P_access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't increment class ref count") + 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 */ @@ -851,7 +853,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 */ @@ -870,7 +872,7 @@ done: 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) @@ -898,8 +900,8 @@ done: static H5P_genprop_t * 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; /* Return value */ + H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1009,8 +1011,8 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, const voi 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) { - H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ - H5P_genprop_t *ret_value; /* Return value */ + H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1126,7 +1128,7 @@ done: H5P_genprop_t * H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) { - H5P_genprop_t *ret_value; /* Property pointer return value */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1185,7 +1187,7 @@ done: static H5P_genprop_t * H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) { - H5P_genprop_t *ret_value; /* Property pointer return value */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1316,7 +1318,7 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * NAME H5P_access_class PURPOSE - Internal routine to increment or decrement list & class dependancies on a + Internal routine to increment or decrement list & class dependencies on a property list class USAGE herr_t H5P_access_class(pclass,mod) @@ -1325,7 +1327,7 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * RETURNS Returns non-negative on success, negative on failure. DESCRIPTION - Increment/Decrement the class or list dependancies for a given class. + Increment/Decrement the class or list dependencies for a given class. This routine is the final arbiter on decisions about actually releasing a class in memory, such action is only taken when the reference counts for both dependent classes & lists reach zero. @@ -1343,19 +1345,19 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); switch (mod) { - case H5P_MOD_INC_CLS: /* Increment the dependant class count*/ + case H5P_MOD_INC_CLS: /* Increment the dependent class count*/ pclass->classes++; break; - case H5P_MOD_DEC_CLS: /* Decrement the dependant class count*/ + case H5P_MOD_DEC_CLS: /* Decrement the dependent class count*/ pclass->classes--; break; - case H5P_MOD_INC_LST: /* Increment the dependant list count*/ + case H5P_MOD_INC_LST: /* Increment the dependent list count*/ pclass->plists++; break; - case H5P_MOD_DEC_LST: /* Decrement the dependant list count*/ + case H5P_MOD_DEC_LST: /* Decrement the dependent list count*/ pclass->plists--; break; @@ -1488,8 +1490,8 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t 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) { - H5P_genclass_t *pclass = NULL; /* Property list class created */ - H5P_genclass_t *ret_value; /* return value */ + H5P_genclass_t *pclass = NULL; /* Property list class created */ + H5P_genclass_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1501,12 +1503,12 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t /* Allocate room for the class */ if (NULL == (pclass = H5FL_CALLOC(H5P_genclass_t))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class allocation failed") /* Set class state */ pclass->parent = par_class; if (NULL == (pclass->name = H5MM_xstrdup(name))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class name allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class name allocation failed") pclass->type = type; pclass->nprops = 0; /* Classes are created without properties initially */ pclass->plists = 0; /* No properties lists of this class yet */ @@ -1581,11 +1583,11 @@ done: static H5P_genplist_t * H5P_create(H5P_genclass_t *pclass) { - H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genplist_t *plist = NULL; /* New property list created */ - H5P_genprop_t * tmp; /* Temporary pointer to parent class properties */ - H5SL_t * seen = NULL; /* Skip list to hold names of properties already seen */ - H5P_genplist_t *ret_value; /* Return value */ + H5P_genclass_t *tclass; /* Temporary class pointer */ + H5P_genplist_t *plist = NULL; /* New property list created */ + H5P_genprop_t * tmp; /* Temporary pointer to parent class properties */ + 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 @@ -1705,7 +1707,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 @@ -1721,22 +1723,22 @@ done: hid_t H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) { - H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genplist_t *plist = NULL; /* Property list created */ - hid_t plist_id = FAIL; /* Property list ID */ - hid_t ret_value; /* return value */ + H5P_genclass_t *tclass; /* Temporary class pointer */ + H5P_genplist_t *plist = NULL; /* Property list created */ + 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") + 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 */ @@ -1751,7 +1753,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 */ @@ -1766,7 +1768,7 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) 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) @@ -1910,7 +1912,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some tranformation/translation of the + set for the property or may perform some transformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -2108,7 +2110,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some tranformation/translation of the + set for the property or may perform some transformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -2315,7 +2317,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some tranformation/translation of the + set for the property or may perform some transformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -3258,7 +3260,7 @@ done: htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) { - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3309,9 +3311,9 @@ done: htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id) { - H5P_genplist_t *plist; /* Property list to query */ - H5P_genclass_t *pclass; /* Property list class */ - htri_t ret_value; /* return value */ + H5P_genplist_t *plist; /* Property list to query */ + H5P_genclass_t *pclass; /* Property list class */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3563,7 +3565,7 @@ H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, /* Check for iterating over all properties, or just non-default ones */ if (iter_all_prop) { - /* Walk up the class hiearchy */ + /* Walk up the class hierarchy */ tclass = plist->pclass; while (tclass != NULL) { /* Iterate over properties in property list class */ @@ -3933,6 +3935,7 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); HDassert(value); @@ -4082,6 +4085,7 @@ H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); @@ -4331,7 +4335,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) /* Sanity check */ HDassert(name); - /* Get propery list classes */ + /* Get property list classes */ if (NULL == (src_pclass = (H5P_genclass_t *)H5I_object(src_id))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "source property class object doesn't exist") if (NULL == (dst_pclass = (H5P_genclass_t *)H5I_object(dst_id))) @@ -4447,8 +4451,8 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The property list class 'close' callback routine is not called from - here, it must have been check for and called properly prior to this routine - being called + here, it must have been checked for and called properly prior to this routine + being called. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -4576,7 +4580,7 @@ H5P_close(void *_plist) tclass = tclass->parent; } /* end while */ - /* Decrement class's dependant property list value! */ + /* Decrement class's dependent property list value! */ if (H5P_access_class(plist->pclass, H5P_MOD_DEC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count") @@ -4624,7 +4628,7 @@ done: char * H5P_get_class_name(H5P_genclass_t *pclass) { - char *ret_value; /* return value */ + char *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -4661,7 +4665,7 @@ done: char * H5P_get_class_path(H5P_genclass_t *pclass) { - char *ret_value; /* return value */ + char *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -4721,12 +4725,12 @@ done: H5P_genclass_t * 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 */ - char * delimit; /* Pointer to path delimiter during traversal */ - H5P_genclass_t * curr_class; /* Pointer to class during path traversal */ - H5P_check_class_t check_info; /* Structure to hold the information for checking duplicate names */ - H5P_genclass_t * ret_value; /* Return value */ + char * tmp_path = NULL; /* Temporary copy of the path */ + char * curr_name; /* Pointer to current component of path name */ + char * delimit; /* Pointer to path delimiter during traversal */ + H5P_genclass_t * curr_class; /* Pointer to class during path traversal */ + 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 @@ -4861,9 +4865,9 @@ done: * H5P_genplist_t data structure) * * Return: Success: Non-negative ID of property list. - * Failure: negative. + * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * April 22, 2014 * *------------------------------------------------------------------------- @@ -4890,7 +4894,7 @@ H5P_get_plist_id(const H5P_genplist_t *plist) * Return: Success: Non-NULL class of property list. * Failure: NULL * - * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Programmer: Quincey Koziol * April 22, 2014 * *------------------------------------------------------------------------- diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 7f83c71..0a2c7af 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -15,7 +15,7 @@ * * Created: H5Plapl.c * July 14 2006 - * James Laird <jlaird@ncsa.uiuc.edu> + * James Laird * * Purpose: Link access property list class routines * @@ -139,10 +139,6 @@ const H5P_libclass_t H5P_CLS_LACC[1] = {{ * Programmer: Quincey Koziol * October 31, 2006 * - * Modifications: - * Vailin Choi, Sept. 12th 2008 - * Register the setting of file access property list for link access - * *------------------------------------------------------------------------- */ static herr_t @@ -193,13 +189,13 @@ done: /*-------------------------------------------------------------------------- * Function: H5P_lacc_elink_fapl_del * - * Purpose: Close the FAPL for link access + * Purpose: Close the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *-------------------------------------------------------------------------- */ @@ -213,11 +209,14 @@ H5P_lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(value); + /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); - if ((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) + /* Close the FAPL */ + if (l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") done: @@ -227,13 +226,13 @@ done: /*-------------------------------------------------------------------------- * Function: H5P_lacc_elink_fapl_copy * - * Purpose: Copy the FAPL for link access + * Purpose: Copy the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *-------------------------------------------------------------------------- */ @@ -246,11 +245,14 @@ H5P_lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(value); + /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); - if (l_fapl_id > H5P_DEFAULT) { + /* Duplicate the FAPL, if it's non-default */ + if (l_fapl_id != H5P_DEFAULT) { H5P_genplist_t *l_fapl_plist; if (NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) @@ -317,13 +319,13 @@ done: /*-------------------------------------------------------------------------- * Function: H5P_lacc_elink_fapl_close * - * Purpose: Close the FAPL for link access + * Purpose: Close the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *--------------------------------------------------------------------------- */ @@ -336,9 +338,13 @@ H5P_lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ HDassert(value); + /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); + + /* Close the FAPL */ if ((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") @@ -742,7 +748,7 @@ done: * external link. This should be either H5F_ACC_RDONLY or * H5F_ACC_RDWR, or H5F_ACC_DEFAULT to unset the value. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 9, 2008 @@ -780,7 +786,7 @@ done: * Purpose: Gets the file access flags to be used when traversing an * external link. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 9, 2008 @@ -816,7 +822,7 @@ done: * external link. This should be either H5F_ACC_RDONLY or * H5F_ACC_RDWR. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 15, 2008 @@ -860,7 +866,7 @@ done: * Purpose: Gets the file access flags to be used when traversing an * external link. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 15, 2008 @@ -887,7 +893,6 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data) if (func) *func = cb_info.func; - if (op_data) *op_data = cb_info.user_data; diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index f85592d..ad86f7f 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Plcpl.c - * May 8 2006 - * Peter Cao <xcao@ncsa.uiuc.edu> + * Created: H5Plcpl.c * - * Purpose: Link creation property list class routines + * Purpose: Link creation property list class routines * *------------------------------------------------------------------------- */ @@ -30,11 +28,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 */ /****************/ /* Local Macros */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 00c5811..019510e 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Pocpl.c - * Nov 28 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Pocpl.c + * Nov 28 2006 + * Quincey Koziol * - * Purpose: Object creation property list class routines + * Purpose: Object creation property list class routines * *------------------------------------------------------------------------- */ @@ -90,7 +90,7 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ &H5P_CLS_ROOT_g, /* Parent class */ &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class */ &H5P_CLS_OBJECT_CREATE_ID_g, /* Pointer to class ID */ - NULL, /* Pointer to default property list ID */ + NULL, /* Pointer to default property list ID */ H5P__ocrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ @@ -249,7 +249,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_attr_phase_change * - * Purpose: Sets the cutoff values for indexes storing attributes + * Purpose: Sets the cutoff values for indexes storing attributes * in object headers for this file. If more than max_compact * attributes are in an object header, the attributes will be * moved to a heap and indexed with a B-tree. @@ -261,10 +261,10 @@ done: * never be stored in the object header but will be always be * stored in a heap. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Programmer: Quincey Koziol + * Tuesday, November 28, 2006 * *------------------------------------------------------------------------- */ @@ -300,14 +300,14 @@ done: } /* end H5Pset_attr_phase_change */ /*------------------------------------------------------------------------- - * Function: H5Pget_attr_phase_change + * Function: H5Pget_attr_phase_change * - * Purpose: Gets the phase change values for attribute storage + * Purpose: Gets the phase change values for attribute storage * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Programmer: Quincey Koziol + * Tuesday, November 28, 2006 * *------------------------------------------------------------------------- */ @@ -535,37 +535,37 @@ done: } /* end H5Pget_obj_track_times() */ /*------------------------------------------------------------------------- - * Function: H5P_modify_filter - * - * Purpose: Modifies the specified FILTER in the - * transient or permanent output filter pipeline - * depending on whether PLIST is a dataset creation or dataset - * transfer property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. + * Function: H5P_modify_filter + * + * Purpose: Modifies the specified FILTER in the + * transient or permanent output filter pipeline + * depending on whether PLIST is a dataset creation or dataset + * transfer property list. The FLAGS argument specifies certain + * general properties of the filter and is documented below. + * The CD_VALUES is an array of CD_NELMTS integers which are + * auxiliary data for the filter. The integer vlues will be + * stored in the dataset object header as part of the filter + * information. + * + * The FLAGS argument is a bit vector of the following fields: + * + * H5Z_FLAG_OPTIONAL(0x0001) + * If this bit is set then the filter is optional. If the + * filter fails during an H5Dwrite() operation then the filter + * is just excluded from the pipeline for the chunk for which it + * failed; the filter will not participate in the pipeline + * during an H5Dread() of the chunk. If this bit is clear and + * the filter fails then the entire I/O operation fails. * If this bit is set but encoding is disabled for a filter, * attempting to write will generate an error. * - * Note: This function currently supports only the permanent filter - * pipeline. That is, PLIST_ID must be a dataset creation - * property list. + * Note: This function currently supports only the permanent filter + * pipeline. That is, PLIST_ID must be a dataset creation + * property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, October 17, 2007 * *------------------------------------------------------------------------- @@ -629,13 +629,6 @@ done: * Programmer: Quincey Koziol * Friday, April 5, 2003 * - * Modifications: - * - * Neil Fortner - * Thursday, March 26, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -669,47 +662,35 @@ done: } /* end H5Pmodify_filter() */ /*------------------------------------------------------------------------- - * Function: H5Pset_filter - * - * Purpose: Adds the specified FILTER and corresponding properties to the - * end of the data or link output filter pipeline - * depending on whether PLIST is a dataset creation or group - * creation property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. + * Function: H5Pset_filter + * + * Purpose: Adds the specified FILTER and corresponding properties to the + * end of the data or link output filter pipeline + * depending on whether PLIST is a dataset creation or group + * creation property list. The FLAGS argument specifies certain + * general properties of the filter and is documented below. + * The CD_VALUES is an array of CD_NELMTS integers which are + * auxiliary data for the filter. The integer vlues will be + * stored in the dataset object header as part of the filter + * information. + * + * The FLAGS argument is a bit vector of the following fields: + * + * H5Z_FLAG_OPTIONAL(0x0001) + * If this bit is set then the filter is optional. If the + * filter fails during an H5Dwrite() operation then the filter + * is just excluded from the pipeline for the chunk for which it + * failed; the filter will not participate in the pipeline + * during an H5Dread() of the chunk. If this bit is clear and + * the filter fails then the entire I/O operation fails. * If this bit is set but encoding is disabled for a filter, * attempting to write will generate an error. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * - * Neil Fortner - * Wednesday, May 20, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -743,36 +724,36 @@ done: } /* end H5Pset_filter() */ /*------------------------------------------------------------------------- - * Function: H5P__set_filter - * - * Purpose: Adds the specified FILTER and corresponding properties to the - * end of the data or link output filter pipeline - * depending on whether PLIST is a dataset creation or group - * creation property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. - * If this bit is set but encoding is disabled for a filter, - * attempting to write will generate an error. + * Function: H5P__set_filter + * + * Purpose: Adds the specified FILTER and corresponding properties to the + * end of the data or link output filter pipeline + * depending on whether PLIST is a dataset creation or group + * creation property list. The FLAGS argument specifies certain + * general properties of the filter and is documented below. + * The CD_VALUES is an array of CD_NELMTS integers which are + * auxiliary data for the filter. The integer vlues will be + * stored in the dataset object header as part of the filter + * information. + * + * The FLAGS argument is a bit vector of the following fields: + * + * H5Z_FLAG_OPTIONAL(0x0001) + * If this bit is set then the filter is optional. If the + * filter fails during an H5Dwrite() operation then the filter + * is just excluded from the pipeline for the chunk for which it + * failed; the filter will not participate in the pipeline + * during an H5Dread() of the chunk. If this bit is clear and + * the filter fails then the entire I/O operation fails. + * If this bit is set but encoding is disabled for a filter, + * attempting to write will generate an error. * * If the filter is not registered, this function tries to load * it dynamically during run time. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -808,30 +789,23 @@ done: } /* end H5P__set_filter() */ /*------------------------------------------------------------------------- - * Function: H5Pget_nfilters + * Function: H5Pget_nfilters * - * Purpose: Returns the number of filters in the data or link - * pipeline depending on whether PLIST_ID is a dataset creation - * or group creation property list. In each pipeline the - * filters are numbered from zero through N-1 where N is the - * value returned by this function. During output to the file - * the filters of a pipeline are applied in increasing order - * (the inverse is true for input). + * Purpose: Returns the number of filters in the data or link + * pipeline depending on whether PLIST_ID is a dataset creation + * or group creation property list. In each pipeline the + * filters are numbered from zero through N-1 where N is the + * value returned by this function. During output to the file + * the filters of a pipeline are applied in increasing order + * (the inverse is true for input). * - * Return: Success: Number of filters or zero if there are none. + * Return: Success: Number of filters or zero if there are none. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 4, 1998 * - * Modifications: - * - * Neil Fortner - * Wednesday, May 20, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ int @@ -860,34 +834,27 @@ done: } /* end H5Pget_nfilters */ /*------------------------------------------------------------------------- - * Function: H5Pget_filter2 - * - * Purpose: This is the query counterpart of H5Pset_filter() and returns - * information about a particular filter number in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit + * Function: H5Pget_filter2 + * + * Purpose: This is the query counterpart of H5Pset_filter() and returns + * information about a particular filter number in a permanent + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. FILTER_CONFIG is a bit * field contaning encode/decode flags from H5Zpublic.h. The IDX * should be a value between zero and N-1 as described for * H5Pget_nfilters() and the function will return failure if the * filter number is out of range. * - * Return: Success: Filter identification number. + * Return: Success: Filter identification number. * - * Failure: H5Z_FILTER_ERROR (Negative) + * Failure: H5Z_FILTER_ERROR (Negative) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * - * Neil Fortner - * Wednesday, May 20, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ H5Z_filter_t @@ -952,23 +919,23 @@ done: } /* end H5Pget_filter2() */ /*------------------------------------------------------------------------- - * Function: H5P_get_filter_by_id + * Function: H5P_get_filter_by_id * - * Purpose: This is an additional query counterpart of H5Pset_filter() and + * Purpose: This is an additional query counterpart of H5Pset_filter() and * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. FILTER_CONFIG is a bit * field contaning encode/decode flags from H5Zpublic.h. The ID * should be the filter ID to retrieve the parameters for. If the * filter is not set for the property list, an error will be returned. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, October 17, 2007 * *------------------------------------------------------------------------- @@ -1001,32 +968,25 @@ done: } /* end H5P_get_filter_by_id() */ /*------------------------------------------------------------------------- - * Function: H5Pget_filter_by_id2 + * Function: H5Pget_filter_by_id2 * - * Purpose: This is an additional query counterpart of H5Pset_filter() and + * Purpose: This is an additional query counterpart of H5Pset_filter() and * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. FILTER_CONFIG is a bit * field contaning encode/decode flags from H5Zpublic.h. The ID * should be the filter ID to retrieve the parameters for. If the * filter is not set for the property list, an error will be returned. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, April 5, 2003 * - * Modifications: - * - * Neil Fortner - * Thursday, May 21, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -1076,25 +1036,18 @@ done: } /* end H5Pget_filter_by_id2() */ /*------------------------------------------------------------------------- - * Function: H5Pall_filters_avail + * Function: H5Pall_filters_avail * - * Purpose: This is a query routine to verify that all the filters set + * Purpose: This is a query routine to verify that all the filters set * in the dataset creation property list are available currently. * - * Return: Success: TRUE if all filters available, FALSE if one or + * Return: Success: TRUE if all filters available, FALSE if one or * more filters not currently available. - * Failure: FAIL on error + * Failure: FAIL on error * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 8, 2003 * - * Modifications: - * - * Neil Fortner - * Thursday, May 21, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ htri_t @@ -1124,17 +1077,17 @@ done: } /* end H5Pall_filters_avail() */ /*------------------------------------------------------------------------- - * Function: H5P_filter_in_pline + * Function: H5P_filter_in_pline * - * Purpose: Check whether the filter is in the pipeline of the object + * Purpose: Check whether the filter is in the pipeline of the object * creation property list. * - * Return: TRUE: found - * FALSE: not found - * FAIL: error + * Return: TRUE: found + * FALSE: not found + * FAIL: error * - * Programmer: Raymond Lu - * 14 May 2013 + * Programmer: Raymond Lu + * 26 April 2013 * *------------------------------------------------------------------------- */ @@ -1169,13 +1122,6 @@ done: * Programmer: Pedro Vicente * January 26, 2004 * - * Modifications: - * - * Neil Fortner - * Thursday, May 21, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -1224,21 +1170,9 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * - * Neil Fortner - * Thursday, March 26, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -1283,16 +1217,9 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Dec 19, 2002 * - * Modifications: - * - * Neil Fortner - * Wednesday, May 6, 2009 - * Overloaded to accept gcpl's as well as dcpl's and moved to - * H5Pocpl.c - * *------------------------------------------------------------------------- */ herr_t @@ -1326,13 +1253,13 @@ done: } /* end H5Pset_fletcher32() */ /*------------------------------------------------------------------------- - * Function: H5P_get_filter + * Function: H5P__get_filter * - * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id + * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, October 23, 2006 * *------------------------------------------------------------------------- @@ -1499,24 +1426,24 @@ done: #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Pget_filter1 - * - * Purpose: This is the query counterpart of H5Pset_filter() and returns - * information about a particular filter number in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. The IDX + * Function: H5Pget_filter1 + * + * Purpose: This is the query counterpart of H5Pset_filter() and returns + * information about a particular filter number in a permanent + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. The IDX * should be a value between zero and N-1 as described for * H5Pget_nfilters() and the function will return failure if the * filter number is out of range. * - * Return: Success: Filter identification number. + * Return: Success: Filter identification number. * - * Failure: H5Z_FILTER_ERROR (Negative) + * Failure: H5Z_FILTER_ERROR (Negative) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -1582,22 +1509,22 @@ done: } /* end H5Pget_filter1() */ /*------------------------------------------------------------------------- - * Function: H5Pget_filter_by_id1 + * Function: H5Pget_filter_by_id1 * - * Purpose: This is an additional query counterpart of H5Pset_filter() and + * Purpose: This is an additional query counterpart of H5Pset_filter() and * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. The ID + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. The ID * should be the filter ID to retrieve the parameters for. If the * filter is not set for the property list, an error will be returned. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, April 5, 2003 * *------------------------------------------------------------------------- diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 8dfa786..86d01fc 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -15,7 +15,7 @@ * * Created: H5Pocpypl.c * Mar 13 2006 - * Peter Cao <xcao@ncsa.uiuc.edu> + * Peter Cao * * Purpose: Object copying property list class routines * @@ -170,6 +170,7 @@ done: * * Programmer: Neil Fortner * October 27, 2011 + * *------------------------------------------------------------------------- */ static H5O_copy_dtype_merge_list_t * @@ -182,8 +183,10 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) /* Free the list */ while (dt_list) { tmp_node = dt_list->next; + (void)H5MM_xfree(dt_list->path); (void)H5FL_FREE(H5O_copy_dtype_merge_list_t, dt_list); + dt_list = tmp_node; } /* end while */ @@ -193,13 +196,13 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) /*-------------------------------------------------------------------------- * Function: H5P__ocpy_merge_comm_dt_list_copy * - * Purpose: Copy the merge committed datatype list + * Purpose: Copy a merge committed datatype list * * Return: Success: Non-negative * Failure: Negative * * Programmer: Quincey Koziol - * Friday, August 31, 2012 + * Wednesday, September 2, 2015 * *-------------------------------------------------------------------------- */ @@ -215,6 +218,7 @@ H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATT FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); /* Make copy of merge committed dtype list */ diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 0b264eb..7c27eee 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Friday, November 16, 2001 * * Purpose: This file contains declarations which are visible only within @@ -50,10 +50,10 @@ typedef enum { /* Define enum for modifications to class */ typedef enum { H5P_MOD_ERR = (-1), /* Indicate an error */ - H5P_MOD_INC_CLS, /* Increment the dependant class count*/ - H5P_MOD_DEC_CLS, /* Decrement the dependant class count*/ - H5P_MOD_INC_LST, /* Increment the dependant list count*/ - H5P_MOD_DEC_LST, /* Decrement the dependant list count*/ + H5P_MOD_INC_CLS, /* Increment the dependent class count*/ + H5P_MOD_DEC_CLS, /* Decrement the dependent class count*/ + H5P_MOD_INC_LST, /* Increment the dependent list count*/ + H5P_MOD_DEC_LST, /* Decrement the dependent list count*/ H5P_MOD_INC_REF, /* Increment the ID reference count*/ H5P_MOD_DEC_REF, /* Decrement the ID reference count*/ H5P_MOD_MAX /* Upper limit on class modifications */ @@ -87,7 +87,7 @@ struct H5P_genclass_t { unsigned plists; /* Number of property lists that have been created since the last modification to the class */ unsigned classes; /* Number of classes that have been derived since the last modification to the class */ - unsigned ref_count; /* Number of oustanding ID's open on this class object */ + unsigned ref_count; /* Number of outstanding ID's open on this class object */ hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */ unsigned revision; /* Revision number of a particular class (global) */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 817e829..be42d55 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -132,7 +132,7 @@ typedef enum H5D_mpio_actual_chunk_opt_mode_t { typedef enum H5D_mpio_actual_io_mode_t { /* The following four values are conveniently defined as a bit field so that - * we can switch from the default to indpendent or collective and then to + * we can switch from the default to independent or collective and then to * mixed without having to check the original value. * * NO_COLLECTIVE means that either collective I/O wasn't requested or that diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index bc3b614..1778939 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pstrcpl.c * October 26 2005 - * James Laird <jlaird@ncsa.uiuc.edu> + * James Laird * * Purpose: String creation property list class routines * diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 79e4dc8..814fef7 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Saturday May 31, 2003 * * Purpose: Generic Property Testing Functions @@ -56,8 +56,8 @@ char * H5P_get_class_path_test(hid_t pclass_id) { - H5P_genclass_t *pclass; /* Property class to query */ - char * ret_value; /* return value */ + H5P_genclass_t *pclass; /* Property class to query */ + char * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -83,7 +83,7 @@ done: 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. @@ -96,25 +96,25 @@ done: hid_t H5P_open_class_path_test(const char *path) { - H5P_genclass_t *pclass = NULL; /* Property class to query */ - hid_t ret_value; /* Return value */ + H5P_genclass_t *pclass = NULL; /* Property class to query */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments. */ if (NULL == path || *path == '\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid class path"); + 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"); + 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"); + 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) @@ -550,9 +550,9 @@ done: hid_t H5Rdereference(hid_t id, H5R_type_t ref_type, const void *_ref) { - H5G_loc_t loc; /* Group location */ - H5F_t * file = NULL; /* File object */ - hid_t ret_value; + H5G_loc_t loc; /* Group location */ + H5F_t * file = NULL; /* File object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "iRt*x", id, ref_type, _ref); @@ -665,7 +665,7 @@ done: void *ref; IN: Reference to open. RETURNS - Valid ID on success, Negative on failure + Valid ID on success, H5I_INVALID_HID on failure DESCRIPTION Given a reference to some object, creates a copy of the dataset pointed to's dataspace and defines a selection in the copy which is the region @@ -678,28 +678,28 @@ done: hid_t H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) { - H5G_loc_t loc; /* Object's group location */ - H5S_t * space = NULL; /* Dataspace object */ - hid_t ret_value; + H5G_loc_t loc; /* Object's group location */ + H5S_t * space = NULL; /* Dataspace object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iRt*x", id, ref_type, ref); /* Check args */ if (H5G_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 (ref_type != H5R_DATASET_REGION) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") if (ref == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Get the dataspace with the correct region selected */ if ((space = H5R_get_region(loc.oloc->file, H5AC_ind_dxpl_id, ref)) == NULL) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create dataspace") /* Atomize */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index eaa1618..a6a24dc 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Rdeprec.c - * September 13 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Rdeprec.c * - * Purpose: Deprecated functions from the H5R interface. These + * Purpose: Deprecated functions from the H5R interface. These * functions are here for compatibility purposes and may be * removed in the future. Applications should switch to the * newer APIs. diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 08ce908..ee849de 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> - * Thursday, September 13, 2007 - * - * Purpose: This file contains declarations which are visible +/* Purpose: This file contains declarations which are visible * only within the H5R package. Source files outside the * H5R package should include H5Rprivate.h instead. */ diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index ceb38cb..62c0d10 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * This file contains public declarations for the H5S module. + * This file contains public declarations for the H5R module. */ #ifndef _H5Rpublic_H #define _H5Rpublic_H @@ -34,8 +34,8 @@ typedef enum { /* Note! Be careful with the sizes of the references because they should really * depend on the run-time values in the file. Unfortunately, the arrays need - * to be defined at compile-time, so we have to go with the worst case sizes for - * them. -QAK + * to be defined at compile-time, so we have to go with the worst case sizes + * for them. -QAK */ #define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t) /* Object reference structure for user's code */ @@ -71,10 +71,6 @@ H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, c */ #ifndef H5_NO_DEPRECATED_SYMBOLS -/* Macros */ - -/* Typedefs */ - /* Function prototypes */ H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *_ref); @@ -27,16 +27,16 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Spkg.h" /* Dataspaces */ /****************/ /* Local Macros */ /****************/ -/* Version of datatype encoding */ +/* Version of dataspace encoding */ #define H5S_ENCODE_VERSION 0 /******************/ @@ -55,14 +55,6 @@ static H5S_t *H5S_decode(const unsigned char *buf); /* Package Variables */ /*********************/ -/*****************************/ -/* Library Private Variables */ -/*****************************/ - -/*******************/ -/* Local Variables */ -/*******************/ - /* Declare a free list to manage the H5S_extent_t struct */ H5FL_DEFINE(H5S_extent_t); @@ -72,6 +64,10 @@ H5FL_DEFINE(H5S_t); /* Declare a free list to manage the array's of hsize_t's */ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK); +/*******************/ +/* Local Variables */ +/*******************/ + /* Dataspace ID class */ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ H5I_DATASPACE, /* ID class value */ @@ -90,7 +86,6 @@ RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. - --------------------------------------------------------------------------*/ static herr_t H5S_init_interface(void) @@ -99,7 +94,7 @@ H5S_init_interface(void) FUNC_ENTER_NOAPI_NOINIT - /* Initialize the atom group for the file IDs */ + /* Initialize the atom group for the dataspace IDs */ if (H5I_register_type(H5I_DATASPACE_CLS) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface") @@ -170,8 +165,8 @@ H5S_term_interface(void) H5S_t * H5S_create(H5S_class_t type) { - H5S_t *new_ds = NULL; /* New dataspace created */ - H5S_t *ret_value; /* Return value */ + H5S_t *new_ds = NULL; /* New dataspace created */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -219,10 +214,9 @@ H5S_create(H5S_class_t type) ret_value = new_ds; done: - if (ret_value == NULL) { + if (ret_value == NULL) if (new_ds && H5S_close(new_ds) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_create() */ @@ -266,25 +260,22 @@ H5Screate(H5S_class_t type) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") done: - if (ret_value < 0) { + if (ret_value < 0) if (new_ds && H5S_close(new_ds) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Screate() */ /*------------------------------------------------------------------------- - * Function: H5S_extent_release + * Function: H5S_extent_release * - * Purpose: Releases all memory associated with a dataspace extent. + * Purpose: Releases all memory associated with a dataspace extent. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 - * - * Modifications: + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ @@ -310,14 +301,14 @@ done: } /* end H5S_extent_release() */ /*------------------------------------------------------------------------- - * Function: H5S_close + * Function: H5S_close * - * Purpose: Releases all memory associated with a dataspace. + * Purpose: Releases all memory associated with a dataspace. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -346,18 +337,14 @@ done: } /* end H5S_close() */ /*------------------------------------------------------------------------- - * Function: H5Sclose + * Function: H5Sclose * - * Purpose: Release access to a dataspace object. + * Purpose: Release access to a dataspace object. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Errors: - * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -382,63 +369,58 @@ done: } /* end H5Sclose() */ /*------------------------------------------------------------------------- - * Function: H5Scopy + * Function: H5Scopy * - * Purpose: Copies a dataspace. + * Purpose: Copies a dataspace. * - * Return: Success: ID of the new dataspace + * Return: Success: ID of the new dataspace * - * Failure: Negative - * - * Programmer: Robb Matzke - * Friday, January 30, 1998 + * Failure: H5I_INVALID_HID * - * Modifications: + * Programmer: Robb Matzke + * Friday, January 30, 1998 * *------------------------------------------------------------------------- */ hid_t H5Scopy(hid_t space_id) { - H5S_t *src; - H5S_t *dst = NULL; - hid_t ret_value; + H5S_t *src = NULL; + H5S_t *dst = NULL; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", space_id); /* Check args */ if (NULL == (src = (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") /* Copy */ if (NULL == (dst = H5S_copy(src, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") /* Atomize */ if ((ret_value = H5I_register(H5I_DATASPACE, dst, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: - if (ret_value < 0) { + if (H5I_INVALID_HID == ret_value) if (dst && H5S_close(dst) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - } /* end if */ + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace") FUNC_LEAVE_API(ret_value) } /* end H5Scopy() */ /*------------------------------------------------------------------------- - * Function: H5Sextent_copy + * Function: H5Sextent_copy * - * Purpose: Copies a dataspace extent. + * Purpose: Copies a dataspace extent. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 - * - * Modifications: + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ @@ -447,7 +429,7 @@ H5Sextent_copy(hid_t dst_id, hid_t src_id) { H5S_t *src; H5S_t *dst; - hid_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "ii", dst_id, src_id); @@ -473,16 +455,14 @@ done: } /* end H5Sextent_copy() */ /*------------------------------------------------------------------------- - * Function: H5S_extent_copy - * - * Purpose: Copies a dataspace extent + * Function: H5S_extent_copy * - * Return: Non-negative on success/Negative on failure + * Purpose: Copies a dataspace extent * - * Programmer: Quincey Koziol - * Wednesday, June 3, 1998 + * Return: Non-negative on success/Negative on failure * - * Modifications: + * Programmer: Neil Fortner + * Monday, February 23, 2015 * *------------------------------------------------------------------------- */ @@ -543,31 +523,29 @@ done: } /* end H5S_extent_copy() */ /*------------------------------------------------------------------------- - * Function: H5S_copy + * Function: H5S_copy * - * Purpose: Copies a dataspace, by copying the extent and selection through - * H5S_extent_copy and H5S_select_copy. If the SHARE_SELECTION flag - * is set, then the selection can be shared between the source and - * destination dataspaces. (This should only occur in situations - * where the destination dataspace will immediately change to a new - * selection) + * Purpose: Copies a dataspace, by copying the extent and selection through + * H5S_extent_copy and H5S_select_copy. If the SHARE_SELECTION flag + * is set, then the selection can be shared between the source and + * destination dataspaces. (This should only occur in situations + * where the destination dataspace will immediately change to a new + * selection) * - * Return: Success: A pointer to a new copy of SRC + * Return: Success: A pointer to a new copy of SRC * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * - * Modifications: + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ H5S_t * H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) { - H5S_t *dst = NULL; - H5S_t *ret_value; /* Return value */ + H5S_t *dst = NULL; + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -594,30 +572,27 @@ done: } /* end H5S_copy() */ /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_npoints + * Function: H5S_get_simple_extent_npoints * - * Purpose: Determines how many data points a dataset extent has. + * Purpose: Determines how many data points a dataset extent has. * - * Return: Success: Number of data points in the dataset extent. + * Return: Success: Number of data points in the dataset extent. * - * Failure: negative + * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * Changed Name - QAK 7/7/98 - * *------------------------------------------------------------------------- */ hssize_t H5S_get_simple_extent_npoints(const H5S_t *ds) { - hssize_t ret_value; + hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(-1) @@ -632,19 +607,15 @@ done: } /* end H5S_get_simple_extent_npoints() */ /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_npoints - * - * Purpose: Determines how many data points a dataset extent has. + * Function: H5Sget_simple_extent_npoints * - * Return: Success: Number of data points in the dataset. + * Purpose: Determines how many data points a dataset extent has. * - * Failure: negative - * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Return: Success: Number of data points in the dataset. + * Failure: Negative * - * Modifications: - * Changed Name - QAK 7/7/98 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -668,31 +639,28 @@ done: } /* end H5Sget_simple_extent_npoints() */ /*------------------------------------------------------------------------- - * Function: H5S_get_npoints_max + * Function: H5S_get_npoints_max * - * Purpose: Determines the maximum number of data points a dataspace may - * have. If the `max' array is null then the maximum number of - * data points is the same as the current number of data points - * without regard to the hyperslab. If any element of the `max' - * array is zero then the maximum possible size is returned. + * Purpose: Determines the maximum number of data points a dataspace may + * have. If the `max' array is null then the maximum number of + * data points is the same as the current number of data points + * without regard to the hyperslab. If any element of the `max' + * array is zero then the maximum possible size is returned. * - * Return: Success: Maximum number of data points the dataspace - * may have. - * - * Failure: 0 - * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Return: Success: Maximum number of data points the dataspace + * may have. + * Failure: 0 * - * Modifications: + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ hsize_t H5S_get_npoints_max(const H5S_t *ds) { - hsize_t ret_value; unsigned u; + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -719,10 +687,9 @@ H5S_get_npoints_max(const H5S_t *ds) ret_value *= ds->extent.max[u]; } } - else { + else for (ret_value = 1, u = 0; u < ds->extent.rank; u++) ret_value *= ds->extent.size[u]; - } break; case H5S_NO_CLASS: @@ -733,21 +700,18 @@ H5S_get_npoints_max(const H5S_t *ds) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5S_get_npoints_max() */ /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_ndims - * - * Purpose: Determines the dimensionality of a dataspace. + * Function: H5Sget_simple_extent_ndims * - * Return: Success: The number of dimensions in a dataspace. + * Purpose: Determines the dimensionality of a dataspace. * - * Failure: Negative - * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Return: Success: The number of dimensions in a dataspace. + * Failure: Negative * - * Modifications: + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ @@ -755,14 +719,14 @@ int H5Sget_simple_extent_ndims(hid_t space_id) { H5S_t *ds; - int ret_value; + int ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", space_id); /* Check args */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace") ret_value = (int)H5S_GET_EXTENT_NDIMS(ds); @@ -771,30 +735,28 @@ done: } /* end H5Sget_simple_extent_ndims() */ /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_ndims + * Function: H5S_get_simple_extent_ndims * - * Purpose: Returns the number of dimensions in a dataspace. + * Purpose: Returns the number of dimensions in a dataspace. * - * Return: Success: Non-negative number of dimensions. Zero - * implies a scalar. + * Return: Success: Non-negative number of dimensions. + * Zero implies a scalar. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * hursday, December 11, 1997 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * *------------------------------------------------------------------------- */ int H5S_get_simple_extent_ndims(const H5S_t *ds) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -819,24 +781,18 @@ done: } /* end H5S_get_simple_extent_ndims() */ /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_dims + * Function: H5Sget_simple_extent_dims * - * Purpose: Returns the size and maximum sizes in each dimension of - * a dataspace DS through the DIMS and MAXDIMS arguments. + * Purpose: Returns the size and maximum sizes in each dimension of + * a dataspace DS through the DIMS and MAXDIMS arguments. * - * Return: Success: Number of dimensions, the same value as - * returned by H5Sget_simple_extent_ndims(). + * Return: Success: Number of dimensions, the same value as + * returned by H5Sget_simple_extent_ndims(). * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 - * - * Modifications: - * June 18, 1998 Albert Cheng - * Added maxdims argument. Removed dims argument check - * since it can still return ndims even if both dims and - * maxdims are NULLs. + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ @@ -844,40 +800,40 @@ int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[] /*out*/, hsize_t maxdims[] /*out*/) { H5S_t *ds; - int ret_value; + int ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Is", "ixx", space_id, dims, maxdims); /* Check args */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace") ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sget_simple_extent_dims() */ /*------------------------------------------------------------------------- - * Function: H5S_extent_get_dims + * Function: H5S_extent_get_dims * - * Purpose: Returns the size in each dimension of a dataspace. This - * function may not be meaningful for all types of dataspaces. + * Purpose: Returns the size in each dimension of a dataspace. This + * function may not be meaningful for all types of dataspaces. * - * Return: Success: Number of dimensions. Zero implies scalar. - * Failure: Negative + * Return: Success: Number of dimensions. Zero implies scalar. + * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, June 30, 2009 + * Programmer: Quincey Koziol + * Tuesday, June 30, 2009 * *------------------------------------------------------------------------- */ int H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]) { - int i; /* Local index variable */ - int ret_value; /* Return value */ + int i; /* Local index variable */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -915,26 +871,23 @@ done: } /* end H5S_extent_get_dims() */ /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_dims + * Function: H5S_get_simple_extent_dims * - * Purpose: Returns the size in each dimension of a dataspace. This - * function may not be meaningful for all types of dataspaces. + * Purpose: Returns the size in each dimension of a dataspace. This + * function may not be meaningful for all types of dataspaces. * - * Return: Success: Number of dimensions. Zero implies scalar. + * Return: Success: Number of dimensions. Zero implies scalar. + * Failure: Negative * - * Failure: Negative - * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 - * - * Modifications: + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -950,15 +903,15 @@ done: } /* end H5S_get_simple_extent_dims() */ /*------------------------------------------------------------------------- - * Function: H5S_write + * Function: H5S_write * - * Purpose: Updates a dataspace by writing a message to an object - * header. + * Purpose: Updates a dataspace by writing a message to an object + * header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -983,22 +936,14 @@ done: } /* end H5S_write() */ /*------------------------------------------------------------------------- - * Function: H5S_append - * - * Purpose: Updates a dataspace by adding a message to an object - * header. + * Function: H5S_append * - * Return: Non-negative on success/Negative on failure + * Purpose: Updates a dataspace by adding a message to an object header. * - * Programmer: Quincey Koziol - * Tuesday, December 31, 2002 + * Return: Non-negative on success/Negative on failure * - * Modifications: - * - * John Mainzer, 6/6/05 - * Updated function to use the new dirtied parameter of - * H5AC_unprotect() instead of manipulating the is_dirty - * field of the cache info. + * Programmer: Quincey Koziol + * Tuesday, December 31, 2002 * *------------------------------------------------------------------------- */ @@ -1023,24 +968,24 @@ done: } /* end H5S_append() */ /*------------------------------------------------------------------------- - * Function: H5S_read + * Function: H5S_read * - * Purpose: Reads the dataspace from an object header. + * Purpose: Reads the dataspace from an object header. * - * Return: Success: Pointer to a new dataspace. + * Return: Success: Pointer to a new dataspace. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ H5S_t * H5S_read(const H5O_loc_t *loc, hid_t dxpl_id) { - H5S_t *ds = NULL; /* Dataspace to return */ - H5S_t *ret_value; /* Return value */ + H5S_t *ds = NULL; /* Dataspace to return */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1061,10 +1006,9 @@ H5S_read(const H5O_loc_t *loc, hid_t dxpl_id) ret_value = ds; done: - if (ret_value == NULL) { + if (ret_value == NULL) if (ds != NULL) ds = H5FL_FREE(H5S_t, ds); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_read() */ @@ -1080,13 +1024,13 @@ done: RETURNS TRUE/FALSE/FAIL DESCRIPTION - This function determines the if a dataspace is "simple". ie. if it + This function determines the if a dataspace is "simple". ie. if it has orthogonal, evenly spaced dimensions. --------------------------------------------------------------------------*/ static htri_t H5S_is_simple(const H5S_t *sdim) { - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1107,18 +1051,18 @@ H5S_is_simple(const H5S_t *sdim) Check if a dataspace is simple USAGE htri_t H5Sis_simple(space_id) - hid_t space_id; IN: ID of dataspace object to query + hid_t space_id; IN: ID of dataspace object to query RETURNS TRUE/FALSE/FAIL DESCRIPTION - This function determines the if a dataspace is "simple". ie. if it + This function determines the if a dataspace is "simple". ie. if it has orthogonal, evenly spaced dimensions. --------------------------------------------------------------------------*/ htri_t H5Sis_simple(hid_t space_id) { - H5S_t *space; /* dataspace to modify */ - htri_t ret_value; + H5S_t *space; /* Dataspace to check */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "i", space_id); @@ -1140,11 +1084,11 @@ done: Sets the size of a simple dataspace USAGE herr_t H5Sset_extent_simple(space_id, rank, dims, max) - hid_t space_id; IN: Dataspace object to query - int rank; IN: # of dimensions for the dataspace - const size_t *dims; IN: Size of each dimension for the dataspace - const size_t *max; IN: Maximum size of each dimension for the - dataspace + hid_t space_id; IN: Dataspace object to query + int rank; IN: # of dimensions for the dataspace + const size_t *dims; IN: Size of each dimension for the dataspace + const size_t *max; IN: Maximum size of each dimension for the + dataspace RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -1158,21 +1102,12 @@ done: Currently, only the first dimension in the array (the slowest) may be unlimited in size. - MODIFICATION - A null dataspace cannot be created from simple space with this function. - - Christian Chilan 01/17/2007 - Verifies that each element of DIMS is not equal to H5S_UNLIMITED. - - Raymond Lu 03/30/2011 - We allow 0 dimension size for non-unlimited dimension starting from 1.8.7 - release. --------------------------------------------------------------------------*/ herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], const hsize_t max[/*rank*/]) { - H5S_t *space; /* dataspace to modify */ - int u; /* local counting variable */ + H5S_t *space; /* Dataspace to modify */ + int u; /* Local counting variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1185,21 +1120,18 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") if (rank < 0 || rank > H5S_MAX_RANK) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank") - if (dims) { - for (u = 0; u < rank; u++) { + if (dims) + for (u = 0; u < rank; u++) if (H5S_UNLIMITED == dims[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED") - } - } if (max != NULL) { if (dims == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maximum dimension specified, but no current dimensions specified") - for (u = 0; u < rank; u++) { + for (u = 0; u < rank; u++) if (max[u] != H5S_UNLIMITED && max[u] < dims[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size") - } } /* Do it */ @@ -1208,21 +1140,18 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sset_extent_simple() */ /*------------------------------------------------------------------------- - * Function: H5S_set_extent_simple + * Function: H5S_set_extent_simple * - * Purpose: This is where the real work happens for - * H5Sset_extent_simple(). + * Purpose: This is where the real work happens for H5Sset_extent_simple(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke (copied from H5Sset_extent_simple) + * Programmer: Robb Matzke * Wednesday, July 8, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1287,31 +1216,26 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hs done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_set_extent_simple() */ +} /* end H5S_set_extent_simple() */ /*------------------------------------------------------------------------- - * Function: H5Screate_simple + * Function: H5Screate_simple * - * Purpose: Creates a new simple dataspace object and opens it for - * access. The DIMS argument is the size of the simple dataset - * and the MAXDIMS argument is the upper limit on the size of - * the dataset. MAXDIMS may be the null pointer in which case - * the upper limit is the same as DIMS. If an element of - * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is - * unlimited, otherwise no element of MAXDIMS should be smaller - * than the corresponding element of DIMS. + * Purpose: Creates a new simple dataspace object and opens it for + * access. The DIMS argument is the size of the simple dataset + * and the MAXDIMS argument is the upper limit on the size of + * the dataset. MAXDIMS may be the null pointer in which case + * the upper limit is the same as DIMS. If an element of + * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is + * unlimited, otherwise no element of MAXDIMS should be smaller + * than the corresponding element of DIMS. * - * Return: Success: The ID for the new simple dataspace object. - * - * Failure: Negative + * Return: Success: The ID for the new simple dataspace object. * - * Programmer: Quincey Koziol - * Tuesday, January 27, 1998 + * Failure: H5I_INVALID_HID * - * Modification: - * Raymond Lu 03/30/2011 - * We allow 0-dimension for non-unlimited dimension starting - * from 1.8.7 release. + * Programmer: Quincey Koziol + * Tuesday, January 27, 1998 * *------------------------------------------------------------------------- */ @@ -1320,72 +1244,65 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/ { H5S_t *space = NULL; int i; - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims); /* Check arguments */ if (rank < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality cannot be negative") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality cannot be negative") if (rank > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality is too large") /* We allow users to use this function to create scalar or null dataspace. * Check DIMS isn't set when the RANK is 0. */ if (!dims && rank != 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace information") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dataspace information") /* Check whether the current dimensions are valid */ for (i = 0; i < rank; i++) { if (H5S_UNLIMITED == dims[i]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "current dimension must have a specific size, not H5S_UNLIMITED") if (maxdims && H5S_UNLIMITED != maxdims[i] && maxdims[i] < dims[i]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maxdims is smaller than dims") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "maxdims is smaller than dims") } /* end for */ /* Create the space and set the extent */ if (NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace") /* Atomize */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") done: - if (ret_value < 0) { + if (ret_value < 0) if (space && H5S_close(space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - } /* end if */ + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace") FUNC_LEAVE_API(ret_value) } /* end H5Screate_simple() */ /*------------------------------------------------------------------------- - * Function: H5S_create_simple + * Function: H5S_create_simple * - * Purpose: Internal function to create simple dataspace + * Purpose: Internal function to create simple dataspace * - * Return: Success: The ID for the new simple dataspace object. - * Failure: Negative + * Return: Success: A pointer to a dataspace object + * Failure: NULL * - * Errors: - * - * Programmer: Quincey Koziol - * Thursday, April 3, 2003 - * - * Modifications: - * Extracted from H5Screate_simple - * Quincey Koziol, Thursday, April 3, 2003 + * Programmer: Quincey Koziol + * Thursday, April 3, 2003 * *------------------------------------------------------------------------- */ H5S_t * H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]) { - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1403,21 +1320,17 @@ done: } /* end H5S_create_simple() */ /*------------------------------------------------------------------------- - * Function: H5Sencode + * Function: H5Sencode * - * Purpose: Given a dataspace ID, converts the object description + * Purpose: Given a dataspace ID, converts the object description * (including selection) into binary in a buffer. * - * Return: Success: non-negative + * Return: Success: Non-negative + * Failure: Negative * - * Failure: negative - * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu + * Programmer: Raymond Lu * July 14, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1438,20 +1351,18 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sencode() */ /*------------------------------------------------------------------------- - * Function: H5S_encode + * Function: H5S_encode * - * Purpose: Private function for H5Sencode. Converts an object + * Purpose: Private function for H5Sencode. Converts an object * description for dataspace and its selection into binary * in a buffer. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu + * Programmer: Raymond Lu * July 14, 2004 * *------------------------------------------------------------------------- @@ -1459,11 +1370,11 @@ done: static herr_t H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) { - size_t extent_size; /* Size of serialized dataspace extent */ - hssize_t sselect_size; /* Signed size of serialized dataspace selection */ - size_t select_size; /* Size of serialized dataspace selection */ - H5F_t * f = NULL; /* Fake file structure*/ - herr_t ret_value = SUCCEED; + H5F_t * f = NULL; /* Fake file structure*/ + size_t extent_size; /* Size of serialized dataspace extent */ + hssize_t sselect_size; /* Signed size of serialized dataspace selection */ + size_t select_size; /* Size of serialized dataspace selection */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1516,17 +1427,16 @@ done: } /* end H5S_encode() */ /*------------------------------------------------------------------------- - * Function: H5Sdecode + * Function: H5Sdecode * - * Purpose: Decode a binary object description of dataspace and + * Purpose: Decode a binary object description of dataspace and * return a new object handle. * - * Return: Success: dataspace ID(non-negative) + * Return: Success: dataspace ID(non-negative) * - * Failure: negative + * Failure: H5I_INVALID_HID * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu + * Programmer: Raymond Lu * July 14, 2004 * *------------------------------------------------------------------------- @@ -1537,35 +1447,34 @@ H5Sdecode(const void *buf) H5S_t *ds; hid_t ret_value; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", buf); if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "empty buffer") if ((ds = H5S_decode((const unsigned char *)buf)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, H5I_INVALID_HID, "can't decode object") /* Register the type and return the ID */ if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace") done: FUNC_LEAVE_API(ret_value) } /* end H5Sdecode() */ /*------------------------------------------------------------------------- - * Function: H5S_decode + * Function: H5S_decode * - * Purpose: Private function for H5Sdecode. Reconstructs a binary + * Purpose: Private function for H5Sdecode. Reconstructs a binary * description of dataspace and returns a new object handle. * - * Return: Success: dataspace ID(non-negative) + * Return: Success: Pointer to a dataspace buffer * - * Failure: negative + * Failure: NULL * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu + * Programmer: Raymond Lu * July 14, 2004 * *------------------------------------------------------------------------- @@ -1573,12 +1482,12 @@ done: static H5S_t * H5S_decode(const unsigned char *buf) { - H5S_t * ds; - H5S_extent_t *extent; - size_t extent_size; /* size of the extent message*/ - H5F_t * f = NULL; /* Fake file structure*/ - uint8_t sizeof_size; /* 'Size of sizes' for file */ - H5S_t * ret_value; + H5F_t * f = NULL; /* Fake file structure*/ + H5S_t * ds; /* Decoded dataspace */ + H5S_extent_t *extent; /* Entent of decoded dataspace */ + size_t extent_size; /* size of the extent message*/ + uint8_t sizeof_size; /* 'Size of sizes' for file */ + H5S_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1637,31 +1546,27 @@ done: } /* end H5S_decode() */ /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_type - * - * Purpose: Internal function for retrieving the type of extent for a dataspace object + * Function: H5S_get_simple_extent_type * - * Return: Success: The class of the dataspace object + * Purpose: Internal function for retrieving the type of extent for a dataspace object * - * Failure: N5S_NO_CLASS + * Return: Success: The class of the dataspace object * - * Errors: + * Failure: N5S_NO_CLASS * - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * *------------------------------------------------------------------------- */ H5S_class_t H5S_get_simple_extent_type(const H5S_t *space) { - H5S_class_t ret_value; + H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */ FUNC_ENTER_NOAPI(H5S_NO_CLASS) @@ -1671,23 +1576,19 @@ H5S_get_simple_extent_type(const H5S_t *space) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5S_get_simple_extent_type() */ /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_type - * - * Purpose: Retrieves the type of extent for a dataspace object - * - * Return: Success: The class of the dataspace object + * Function: H5Sget_simple_extent_type * - * Failure: N5S_NO_CLASS + * Purpose: Retrieves the type of extent for a dataspace object * - * Errors: + * Return: Success: The class of the dataspace object * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 + * Failure: N5S_NO_CLASS * - * Modifications: + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ @@ -1695,7 +1596,7 @@ H5S_class_t H5Sget_simple_extent_type(hid_t sid) { H5S_t * space; - H5S_class_t ret_value; + H5S_class_t ret_value; /* Return value */ FUNC_ENTER_API(H5S_NO_CLASS) H5TRACE1("Sc", "i", sid); @@ -1708,7 +1609,7 @@ H5Sget_simple_extent_type(hid_t sid) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sget_simple_extent_type() */ /*-------------------------------------------------------------------------- NAME @@ -1717,17 +1618,17 @@ done: Resets the extent of a dataspace back to "none" USAGE herr_t H5Sset_extent_none(space_id) - hid_t space_id; IN: Dataspace object to reset + hid_t space_id; IN: Dataspace object to reset RETURNS Non-negative on success/Negative on failure DESCRIPTION - This function resets the type of a dataspace back to "none" with no + This function resets the type of a dataspace to H5S_NULL with no extent information stored for the dataspace. --------------------------------------------------------------------------*/ herr_t H5Sset_extent_none(hid_t space_id) { - H5S_t *space; /* dataspace to modify */ + H5S_t *space; /* Dataspace to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1792,12 +1693,11 @@ 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 + * Return: TRUE/FALSE/FAIL * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * March 13, 2002 * *------------------------------------------------------------------------- @@ -1815,7 +1715,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) HDassert(size); /* Verify that the dimensions being changed are allowed to change */ - for (u = 0; u < space->extent.rank; u++) { + for (u = 0; u < space->extent.rank; u++) if (space->extent.size[u] != size[u]) { /* Check for invalid dimension size modification */ if (space->extent.max && H5S_UNLIMITED != space->extent.max[u] && space->extent.max[u] < size[u]) @@ -1826,7 +1726,6 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) /* Indicate that dimension size can be modified */ ret_value = TRUE; } /* end if */ - } /* end for */ /* Update dimension size(s) */ if (ret_value) @@ -1855,7 +1754,7 @@ done: hbool_t H5S_has_extent(const H5S_t *ds) { - hbool_t ret_value; + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1872,12 +1771,12 @@ 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 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * March 13, 2002 * *------------------------------------------------------------------------- @@ -1916,23 +1815,24 @@ done: } /* end H5S_set_extent_real() */ /*------------------------------------------------------------------------- - * Function: H5Sextent_equal + * Function: H5Sextent_equal * - * Purpose: Determines if two dataspace extents are equal. + * Purpose: Determines if two dataspace extents are equal. * - * Return: Success: TRUE if equal, FALSE if unequal + * Return: Success: TRUE if equal, FALSE if unequal * - * Failure: Negative + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, October 24, 2005 + * Programmer: Quincey Koziol + * Monday, October 24, 2005 * *------------------------------------------------------------------------- */ htri_t H5Sextent_equal(hid_t space1_id, hid_t space2_id) { - const H5S_t *ds1, *ds2; /* Dataspaces to compare */ + const H5S_t *ds1; /* Dataspaces to compare */ + const H5S_t *ds2; htri_t ret_value; FUNC_ENTER_API(FAIL) @@ -1958,11 +1858,11 @@ done: Check if two dataspaces have equal extents USAGE htri_t H5S_extent_equal(ds1, ds2) - H5S_t *ds1, *ds2; IN: Dataspace objects to compare + H5S_t *ds1, *ds2; IN: Dataspace objects to compare RETURNS TRUE if equal, FALSE if unequal on succeess/Negative on failure DESCRIPTION - Compare two dataspaces if their extents are identical. + Compare two dataspaces if their extents are identical. --------------------------------------------------------------------------*/ htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2) @@ -2011,15 +1911,15 @@ done: } /* end H5S_extent_equal() */ /*------------------------------------------------------------------------- - * Function: H5S_extent_nelem + * Function: H5S_extent_nelem * - * Purpose: Determines how many elements a dataset extent describes. + * Purpose: Determines how many elements a dataset extent describes. * - * Return: Success: Number of data points in the dataset extent. - * Failure: negative + * Return: Success: Number of data points in the dataset extent. + * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, November 30, 2006 + * Programmer: Quincey Koziol + * Thursday, November 30, 2006 * *------------------------------------------------------------------------- */ @@ -2040,7 +1940,7 @@ H5S_extent_nelem(const H5S_extent_t *ext) * * Purpose: Set the encoding for a dataspace to the latest version. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Tuesday, July 24, 2007 @@ -64,8 +64,8 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5SLprivate.h" /* Skip list routines */ #include "H5MMprivate.h" /* Memory management */ +#include "H5SLprivate.h" /* Skip list routines */ /* Local Macros */ @@ -640,7 +640,7 @@ H5SL_init_interface(void) static H5SL_node_t * H5SL_new_node(void *item, const void *key, uint32_t hashval) { - H5SL_node_t *ret_value; /* New skip list node */ + H5SL_node_t *ret_value = NULL; /* New skip list node */ FUNC_ENTER_NOAPI_NOINIT @@ -926,7 +926,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp) { H5SL_t * new_slist = NULL; /* Pointer to new skip list object created */ H5SL_node_t *header; /* Pointer to skip list header node */ - H5SL_t * ret_value; /* Return value */ + H5SL_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1082,7 +1082,7 @@ done: H5SL_node_t * H5SL_add(H5SL_t *slist, void *item, const void *key) { - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1408,9 +1408,9 @@ done: void * H5SL_less(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - void * ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1516,9 +1516,9 @@ done: void * H5SL_greater(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - void * ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1706,9 +1706,9 @@ done: H5SL_node_t * H5SL_below(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1811,9 +1811,9 @@ done: H5SL_node_t * H5SL_above(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -855,7 +855,7 @@ done: static htri_t H5SM_can_share_common(const H5F_t *f, unsigned type_id, const void *mesg) { - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1651,7 +1651,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -2241,10 +2240,6 @@ done: * Programmer: James Laird * Wednesday, February 21, 2006 * - * Modifications: - * Vailin Choi; September 2011 - * Change "oh_modified" from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 473f62d..7576aa8 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -89,9 +89,9 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); static void * H5SM_bt2_crt_context(void *_f) { - H5F_t * f = (H5F_t *)_f; /* User data for building callback context */ - H5SM_bt2_ctx_t *ctx; /* Callback context structure */ - void * ret_value; /* Return value */ + H5F_t * f = (H5F_t *)_f; /* User data for building callback context */ + H5SM_bt2_ctx_t *ctx; /* Callback context structure */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 3197e36..d685154 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -11,6 +11,17 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5SMcache.c + * Nov 13 2006 + * James Laird <jlaird@hdfgroup.org> + * + * Purpose: Implement shared message metadata cache methods. + * + *------------------------------------------------------------------------- + */ + /****************/ /* Module Setup */ /****************/ @@ -62,6 +73,7 @@ static herr_t H5SM_list_size(const H5F_t *f, const H5SM_list_t H5_ATTR_UNUSED *l /*********************/ /* Package Variables */ /*********************/ + /* H5SM inherits cache-like properties from H5AC */ const H5AC_class_t H5AC_SOHM_TABLE[1] = {{ H5AC_SOHM_TABLE_ID, diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index b143c6a..872c444 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -109,10 +109,6 @@ H5SM_compare_cb(const void *obj, size_t obj_len, void *_udata) * Programmer: James Laird * Wednesday, February 7, 2007 * - * Modifications: - * Vailin Choi; September 2011 - * Change "oh_modified" from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index a0aa3e7..ec68525 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird <jlaird@ncsa.uiuc.edu> + * Programmer: James Laird * Thursday, March 30, 2006 * * Purpose: This file contains declarations which are visible only within @@ -93,7 +93,7 @@ #define H5SM_B2_SPLIT_PERCENT 100 #define H5SM_B2_MERGE_PERCENT 40 -#define H5SM_LIST_VERSION 0 /* Verion of Shared Object Header Message List Indexes */ +#define H5SM_LIST_VERSION 0 /* Version of Shared Object Header Message List Indexes */ /****************************/ /* Package Typedefs */ diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h index 8f694b6..708ca7c 100644 --- a/src/H5SMprivate.h +++ b/src/H5SMprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird <jlaird@ncsa.uiuc.edu> + * Programmer: James Laird * Thursday, March 2, 2006 * * Purpose: This file contains private declarations for the H5SM @@ -725,19 +725,19 @@ H5ST_dump_internal(H5ST_ptr_t p) FUNC_ENTER_NOAPI_NOINIT_NOERR if (p) { - printf("p=%p\n", p); - printf("\tp->up=%p\n", p->up); - printf("\tp->parent=%p\n", p->parent); - printf("\tp->lokid=%p\n", p->lokid); - printf("\tp->hikid=%p\n", p->hikid); - printf("\tp->eqkid=%p\n", p->eqkid); - printf("\tp->splitchar=%c\n", p->splitchar); + HDprintf("p=%p\n", (void *)p); + HDprintf("\tp->up=%p\n", (void *)p->up); + HDprintf("\tp->parent=%p\n", (void *)p->parent); + HDprintf("\tp->lokid=%p\n", (void *)p->lokid); + HDprintf("\tp->hikid=%p\n", (void *)p->hikid); + HDprintf("\tp->eqkid=%p\n", (void *)p->eqkid); + HDprintf("\tp->splitchar=%c\n", p->splitchar); H5ST_dump_internal(p->lokid); if (p->splitchar) H5ST_dump_internal(p->eqkid); else - printf("%s\n", (char *)p->eqkid); + HDprintf("%s\n", (char *)p->eqkid); H5ST_dump_internal(p->hikid); } /* end if */ diff --git a/src/H5Sall.c b/src/H5Sall.c index d071a88..f34520d 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Purpose: "All" selection data space I/O functions. + * Purpose: "All" selection dataspace I/O functions. */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ @@ -98,13 +98,11 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{ * * Purpose: Initializes iteration information for "all" selection. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -135,13 +133,11 @@ H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -169,13 +165,11 @@ done: * Purpose: Retrieve the current block of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Monday, June 2, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -208,13 +202,11 @@ H5S_all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) * * Purpose: Return number of elements left to process in iterator * - * Return: non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t @@ -423,7 +415,7 @@ H5S_all_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSED TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offet fits within the + Determines if the current selection at the current offset fits within the extent for the dataspace. Offset is irrelevant for this type of selection. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -787,7 +779,7 @@ H5S_all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) * Purpose: Projects an 'all' selection onto/into a simple dataspace * of a different rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -885,7 +877,7 @@ H5Sselect_all(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Call internal routine to do the work */ if (H5S_select_all(space, TRUE) < 0) diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index 25badbb..cea0e5a 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -13,11 +13,12 @@ /*------------------------------------------------------------------------- * - * Created: H5Sdbg.c - * Jul 24 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Sdbg.c + * Quincey Koziol + * Jul 24 2007 * - * Purpose: Dump debugging information about a dataspace + * + * Purpose: Dump debugging information about a dataspace * *------------------------------------------------------------------------- */ @@ -31,9 +32,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Spkg.h" /* Dataspaces */ /****************/ /* Local Macros */ @@ -51,26 +52,26 @@ /* Local Prototypes */ /********************/ -/*********************/ -/* Package Variables */ -/*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ +/*********************/ +/* Package Variables */ +/*********************/ + /*******************/ /* Local Variables */ /*******************/ /*------------------------------------------------------------------------- - * Function: H5S_debug + * Function: H5S_debug * - * Purpose: Prints debugging information about a data space. + * Purpose: Prints debugging information about a dataspace. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * *------------------------------------------------------------------------- diff --git a/src/H5Shyper.c b/src/H5Shyper.c index da2a380..203b14f 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, June 18, 1998 * - * Purpose: Hyperslab selection data space I/O functions. + * Purpose: Hyperslab selection dataspace I/O functions. */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index bef70d6..40a63ce 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -16,8 +16,6 @@ * * Purpose: Functions to read/write directly between app buffer and file. * - * Beware of the ifdef'ed print statements. - * I didn't make them portable. */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ @@ -60,7 +58,7 @@ static herr_t H5S_obtain_datatype(const hsize_t down[], H5S_hyper_span_t *span, * * Purpose: Translate an HDF5 "all" selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -106,7 +104,7 @@ done: * * Purpose: Translate an HDF5 "none" selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -135,7 +133,7 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) * * Purpose: Create a derived datatype for point selections. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * @@ -192,7 +190,7 @@ done: * Purpose: Translate an HDF5 "point" selection into an MPI type. * Create a permutation array to handle out-of-order point selections. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -328,7 +326,7 @@ done: * Note: This routine is called from H5S_mpio_space_type(), which is * called first for the file dataspace and creates * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -457,9 +455,9 @@ done: /*------------------------------------------------------------------------- * Function: H5S_mpio_hyper_type * - * Purpose: Translate an HDF5 hyperslab selection into an MPI type. + * Purpose: Translate a regular HDF5 hyperslab selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -512,7 +510,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type diminfo = sel_iter.u.hyp.diminfo; HDassert(diminfo); - /* make a local copy of the dimension info so we can operate with them */ + /* Make a local copy of the dimension info so we can operate with them */ /* Check if this is a "flattened" regular hyperslab selection */ if (sel_iter.u.hyp.iter_rank != 0 && sel_iter.u.hyp.iter_rank < space->extent.rank) { @@ -530,6 +528,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type d[u].block = diminfo[u].block; d[u].count = diminfo[u].count; d[u].xtent = sel_iter.u.hyp.size[u]; + #ifdef H5S_DEBUG if (H5DEBUG(S)) { HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", FUNC, @@ -565,6 +564,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type d[u].block = diminfo[u].block; d[u].count = diminfo[u].count; d[u].xtent = space->extent.size[u]; + #ifdef H5S_DEBUG if (H5DEBUG(S)) { HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", FUNC, @@ -608,7 +608,8 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type /* Create a type covering the selected hyperslab. * Multidimensional dataspaces are stored in row-major order. * The type is built from the inside out, going from the - * fastest-changing (i.e., inner) dimension * to the slowest (outer). */ + * fastest-changing (i.e., inner) dimension * to the slowest (outer). + */ /******************************************************* * Construct contig type for inner contig dims: @@ -641,7 +642,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC, i); #endif /**************************************** - * Build vector type of the selection. + * Build vector type of the selection. ****************************************/ mpi_code = MPI_Type_vector((int)(d[i].count), /* count */ (int)(d[i].block), /* blocklength */ @@ -686,10 +687,9 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type else inner_type = outer_type; } /* end for */ - /*************************** - * End of loop, walking - * thru dimensions. - ***************************/ + /****************************************** + * End of loop, walking through dimensions. + *******************************************/ /* At this point inner_type is actually the outermost type, even for 0-trip loop */ *new_type = inner_type; @@ -726,7 +726,7 @@ done: * Purpose: Translate an HDF5 irregular hyperslab selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -792,7 +792,7 @@ done: * Purpose: Obtain an MPI derived datatype based on span-tree * implementation * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *span_type the MPI type corresponding to the selection * @@ -804,8 +804,8 @@ static herr_t H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size) { - size_t alloc_count; /* Number of span tree nodes allocated at this level */ - size_t outercount; /* Number of span tree nodes at this level */ + size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */ + size_t outercount = 0; /* Number of span tree nodes at this level */ MPI_Datatype * inner_type = NULL; hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */ hbool_t span_type_valid = FALSE; /* Whether the span_type MPI datatypes is valid */ @@ -974,7 +974,7 @@ done: * Purpose: Translate an HDF5 dataspace selection into an MPI type. * Currently handle only hyperslab and "all" selections. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -1087,4 +1087,5 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_mpio_space_type() */ + #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 354a9e3..31cf8c5 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Tuesday, November 10, 1998 * - * Purpose: "None" selection data space I/O functions. + * Purpose: "None" selection dataspace I/O functions. */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ @@ -95,17 +95,15 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{ }}; /*------------------------------------------------------------------------- - * Function: H5S_none_iter_init + * Function: H5S_none_iter_init * - * Purpose: Initializes iteration information for "none" selection. + * Purpose: Initializes iteration information for "none" selection. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -124,18 +122,16 @@ H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space) } /* H5S_none_iter_init() */ /*------------------------------------------------------------------------- - * Function: H5S_none_iter_coords + * Function: H5S_none_iter_coords * - * Purpose: Retrieve the current coordinates of iterator for current + * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -151,18 +147,16 @@ H5S_none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_ } /* H5S_none_iter_coords() */ /*------------------------------------------------------------------------- - * Function: H5S_none_iter_block + * Function: H5S_none_iter_block * - * Purpose: Retrieve the current block of iterator for current + * Purpose: Retrieve the current block of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, June 2, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -180,17 +174,15 @@ H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_U } /* H5S_none_iter_block() */ /*------------------------------------------------------------------------- - * Function: H5S_none_iter_nelmts + * Function: H5S_none_iter_nelmts * - * Purpose: Return number of elements left to process in iterator + * Purpose: Return number of elements left to process in iterator * - * Return: non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t @@ -392,7 +384,7 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offet fits within the + Determines if the current selection at the current offset fits within the extent for the dataspace. Offset is irrelevant for this type of selection. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -708,11 +700,11 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off } /* H5S_none_adjust_u() */ /*------------------------------------------------------------------------- - * Function: H5S_none_project_scalar + * Function: H5S_none_project_scalar * - * Purpose: Projects a 'none' selection into a scalar dataspace + * Purpose: Projects a 'none' selection into a scalar dataspace * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -732,14 +724,14 @@ H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSE } /* H5S_none_project_scalar() */ /*------------------------------------------------------------------------- - * Function: H5S_none_project_simple + * Function: H5S_none_project_simple * - * Purpose: Projects an 'none' selection onto/into a simple dataspace + * Purpose: Projects an 'none' selection onto/into a simple dataspace * of a different rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -833,7 +825,7 @@ H5Sselect_none(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Change to "none" selection */ if (H5S_select_none(space) < 0) diff --git a/src/H5Spkg.h b/src/H5Spkg.h index c5785f5..ab5238b 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: This file contains declarations which are visible only within @@ -26,6 +26,7 @@ #ifndef _H5Spkg_H #define _H5Spkg_H +/* Get package's private header */ #include "H5Sprivate.h" /* Flags to indicate special dataspace features are active */ @@ -38,7 +39,7 @@ /* Version for point selection info */ #define H5S_POINT_VERSION_1 1 -#define H5S_POINT_VERSION_LATEST H5S_HYPER_VERSION_1 +#define H5S_POINT_VERSION_LATEST H5S_POINT_VERSION_1 /* Versions for H5S_SEL_NONE selection info */ #define H5S_NONE_VERSION_1 1 @@ -84,6 +85,7 @@ struct H5S_extent_t { /* * Dataspace selection information */ + /* Node in point selection list (typedef'd in H5Sprivate.h) */ struct H5S_pnt_node_t { hsize_t * pnt; /* Pointer to a selected point */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 8364bde..96e5940 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Purpose: Point selection data space I/O functions. + * Purpose: Point selection dataspace I/O functions. */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ @@ -103,17 +103,15 @@ H5FL_DEFINE_STATIC(H5S_pnt_node_t); H5FL_DEFINE_STATIC(H5S_pnt_list_t); /*------------------------------------------------------------------------- - * Function: H5S_point_iter_init + * Function: H5S_point_iter_init * - * Purpose: Initializes iteration information for point selection. + * Purpose: Initializes iteration information for point selection. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -138,18 +136,16 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) } /* H5S_point_iter_init() */ /*------------------------------------------------------------------------- - * Function: H5S_point_iter_coords + * Function: H5S_point_iter_coords * - * Purpose: Retrieve the current coordinates of iterator for current + * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -168,18 +164,16 @@ H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) } /* H5S_point_iter_coords() */ /*------------------------------------------------------------------------- - * Function: H5S_point_iter_block + * Function: H5S_point_iter_block * - * Purpose: Retrieve the current block of iterator for current + * Purpose: Retrieve the current block of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, June 2, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -200,17 +194,15 @@ H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) } /* H5S_point_iter_block() */ /*------------------------------------------------------------------------- - * Function: H5S_point_iter_nelmts + * Function: H5S_point_iter_nelmts * - * Purpose: Return number of elements left to process in iterator + * Purpose: Return number of elements left to process in iterator * - * Return: non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t @@ -535,7 +527,7 @@ H5S_point_release(H5S_t *space) herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) { - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -657,7 +649,7 @@ done: TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offet fits within the + Determines if the current selection at the current offset fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -722,7 +714,7 @@ H5Sget_select_elem_npoints(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection") @@ -1037,7 +1029,7 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoint if (NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer") if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection") @@ -1203,7 +1195,7 @@ done: static htri_t H5S_point_is_contiguous(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1240,7 +1232,7 @@ H5S_point_is_contiguous(const H5S_t *space) static htri_t H5S_point_is_single(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1347,14 +1339,14 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) } /* H5S_point_adjust_u() */ /*------------------------------------------------------------------------- - * Function: H5S_point_project_scalar + * Function: H5S_point_project_scalar * - * Purpose: Projects a single element point selection into a scalar + * Purpose: Projects a single element point selection into a scalar * dataspace * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -1387,14 +1379,14 @@ done: } /* H5S_point_project_scalar() */ /*------------------------------------------------------------------------- - * Function: H5S_point_project_simple + * Function: H5S_point_project_simple * - * Purpose: Projects a point selection onto/into a simple dataspace + * Purpose: Projects a point selection onto/into a simple dataspace * of a different rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 105202d..6eeb886 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -32,8 +32,8 @@ typedef enum H5S_class_t { H5S_NO_CLASS = -1, /*error */ H5S_SCALAR = 0, /*scalar variable */ - H5S_SIMPLE = 1, /*simple data space */ - H5S_NULL = 2 /*null data space */ + H5S_SIMPLE = 1, /*simple dataspace */ + H5S_NULL = 2 /*null dataspace */ } H5S_class_t; /* Different ways of combining selections */ @@ -79,8 +79,8 @@ typedef enum H5S_seloper_t { typedef enum { H5S_SEL_ERROR = -1, /* Error */ H5S_SEL_NONE = 0, /* Nothing selected */ - H5S_SEL_POINTS = 1, /* Sequence of points selected */ - H5S_SEL_HYPERSLABS = 2, /* "New-style" hyperslab selection defined */ + H5S_SEL_POINTS = 1, /* Points / elements selected */ + H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */ H5S_SEL_ALL = 3, /* Entire extent selected */ H5S_SEL_N /*THIS MUST BE LAST */ } H5S_sel_type; diff --git a/src/H5Sselect.c b/src/H5Sselect.c index d13fce9..845bf61 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -11,22 +11,22 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.ued> +/* Programmer: Quincey Koziol * Friday, May 29, 1998 * - * Purpose: Dataspace selection functions. + * Purpose: Dataspace selection functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#define H5S_PACKAGE /*suppress error about including H5Spkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Spkg.h" /* Dataspaces */ -#include "H5VMprivate.h" /* Vector and array functions */ +#include "H5Spkg.h" /* Dataspaces */ +#include "H5VMprivate.h" /* Vector and array functions */ #include "H5WBprivate.h" /* Wrapped Buffers */ /* Local functions */ @@ -43,7 +43,7 @@ static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter); Set the selection offset for a datapace USAGE herr_t H5S_select_offset(space, offset) - H5S_t *space; IN/OUT: Dataspace object to set selection offset + H5S_t *space; IN/OUT: Dataspace object to set selection offset const hssize_t *offset; IN: Offset to position the selection at RETURNS Non-negative on success/Negative on failure @@ -101,7 +101,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -121,21 +121,19 @@ done: } /* H5S_select_copy() */ /*------------------------------------------------------------------------- - * Function: H5S_select_release + * Function: H5S_select_release * - * Purpose: Releases all memory associated with a dataspace selection. + * Purpose: Releases all memory associated with a dataspace selection. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, May 30, 2003 + * Programmer: Quincey Koziol + * Friday, May 30, 2003 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -154,15 +152,15 @@ H5S_select_release(H5S_t *ds) } /* end H5S_select_release() */ /*------------------------------------------------------------------------- - * Function: H5S_select_get_seq_list + * Function: H5S_select_get_seq_list * - * Purpose: Retrieves the next sequence of offset/length pairs for an + * Purpose: Retrieves the next sequence of offset/length pairs for an * iterator on a dataspace * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, May 18, 2004 + * Programmer: Quincey Koziol + * Tuesday, May 18, 2004 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro @@ -190,28 +188,26 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter } /* end H5S_select_get_seq_list() */ /*------------------------------------------------------------------------- - * Function: H5S_select_serial_size + * Function: H5S_select_serial_size * - * Purpose: Determines the number of bytes required to store the current + * Purpose: Determines the number of bytes required to store the current * selection * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, May 18, 2004 + * Programmer: Quincey Koziol + * Tuesday, May 18, 2004 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * *------------------------------------------------------------------------- */ hssize_t H5S_select_serial_size(const H5S_t *space) { - hssize_t ret_value; /* Return value */ + hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -341,14 +337,12 @@ H5S_get_select_npoints(const H5S_t *space) TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offet fits within the + Determines if the current selection at the current offset fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG - Christian Chilan 01/17/2007 - Changed the error return value from 0 to FAIL. --------------------------------------------------------------------------*/ htri_t H5Sselect_valid(hid_t spaceid) @@ -382,7 +376,7 @@ done: TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offet fits within the + Determines if the current selection at the current offset fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -395,7 +389,7 @@ done: htri_t H5S_select_valid(const H5S_t *space) { - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -461,6 +455,7 @@ H5S_select_deserialize(H5S_t *space, const uint8_t *buf) default: break; } + if (ret_value < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection") @@ -549,7 +544,7 @@ done: herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -589,7 +584,7 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -626,7 +621,7 @@ H5S_get_select_offset(const H5S_t *space, hsize_t *offset) htri_t H5S_select_is_contiguous(const H5S_t *space) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -662,7 +657,7 @@ H5S_select_is_contiguous(const H5S_t *space) htri_t H5S_select_is_single(const H5S_t *space) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -698,7 +693,7 @@ H5S_select_is_single(const H5S_t *space) htri_t H5S_select_is_regular(const H5S_t *space) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -734,13 +729,14 @@ H5S_select_is_regular(const H5S_t *space) herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) { - herr_t ret_value; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(space); + /* Perform operation */ ret_value = (*space->select.type->adjust_u)(space, offset); FUNC_LEAVE_NOAPI(ret_value) @@ -771,7 +767,7 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -810,7 +806,7 @@ H5S_select_project_scalar(const H5S_t *space, hsize_t *offset) herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -844,7 +840,7 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset) herr_t H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_size) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -898,7 +894,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -979,7 +975,7 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter) { - hsize_t ret_value; /* return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1057,7 +1053,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) herr_t H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1139,7 +1135,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter) herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1274,10 +1270,12 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space, const H5S_s /* Make the application callback */ user_ret = (op->u.app_op.op)(loc, op->u.app_op.type_id, ndims, coords, op_data); break; + case H5S_SEL_ITER_OP_LIB: /* Call the library's callback */ user_ret = (op->u.lib_op)(loc, type, ndims, coords, op_data); break; + default: HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type") } /* end switch */ @@ -1312,7 +1310,7 @@ done: Retrieve the type of selection in a dataspace USAGE H5S_sel_type H5Sget_select_type(space_id) - hid_t space_id; IN: Dataspace object to query + hid_t space_id; IN: Dataspace object to query RETURNS Non-negative on success/Negative on failure. Return value is from the set of values in the H5S_sel_type enumerated type. @@ -1347,7 +1345,7 @@ done: Retrieve the type of selection in a dataspace USAGE H5S_sel_type H5Sget_select_type(space) - const H5S_t *space; IN: Dataspace object to query + const H5S_t *space; IN: Dataspace object to query RETURNS Non-negative on success/Negative on failure. Return value is from the set of values in the H5S_sel_type enumerated type. @@ -1362,7 +1360,7 @@ done: H5S_sel_type H5S_get_select_type(const H5S_t *space) { - H5S_sel_type ret_value; /* Return value */ + H5S_sel_type ret_value = H5S_SEL_ERROR; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1389,23 +1387,22 @@ H5S_get_select_type(const H5S_t *space) DESCRIPTION Checks to see if the current selection in the dataspaces are the same dimensionality and shape. + This is primarily used for reading the entire selection in one swoop. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Assumes that there is only a single "block" for hyperslab selections. EXAMPLES REVISION LOG - Modified function to view identical shapes with different dimensions - as being the same under some circumstances. --------------------------------------------------------------------------*/ htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) { - H5S_sel_iter_t iter_a; /* Selection a iteration info */ - H5S_sel_iter_t iter_b; /* Selection b iteration info */ - hbool_t iter_a_init = 0; /* Selection a iteration info has been initialized */ - hbool_t iter_b_init = 0; /* Selection b iteration info has been initialized */ - htri_t ret_value = TRUE; /* Return value */ + H5S_sel_iter_t iter_a; /* Selection a iteration info */ + H5S_sel_iter_t iter_b; /* Selection b iteration info */ + hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */ + hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1425,7 +1422,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) unsigned space_a_rank; /* Number of dimensions of dataspace A */ unsigned space_b_rank; /* Number of dimensions of dataspace B */ - /* need to be able to handle spaces of different rank: + /* Need to be able to handle spaces of different rank: * * To simplify logic, let space_a point to the element of the set * {space1, space2} with the largest rank or space1 if the ranks @@ -1436,9 +1433,8 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) * * Let: space_a_rank be the rank of space_a, * space_b_rank be the rank of space_b, - * delta_rank = space_a_rank - space_b_rank. * - * Set all this up below. + * Set all this up here. */ if (space1->extent.rank >= space2->extent.rank) { space_a = space1; @@ -1475,12 +1471,6 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) space_a_dim = (int)space_a_rank - 1; space_b_dim = (int)space_b_rank - 1; - - /* recall that space_a_rank >= space_b_rank. - * - * In the following while loop, we test to see if space_a and space_b - * have identical size in all dimensions they have in common. - */ while (space_b_dim >= 0) { if (dims1[space_a_dim] != dims2[space_b_dim]) HGOTO_DONE(FALSE) @@ -1615,7 +1605,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) } /* end if */ /* Check over the blocks for each selection */ else { - /* for dimensions that space_a and space_b have in common: */ + /* For dimensions that space_a and space_b have in common: */ while (space_b_dim >= 0) { /* Check if the blocks are in the same relative location */ if ((start_a[space_a_dim] - off_a[space_a_dim]) != @@ -1665,7 +1655,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) } /* end else */ } /* end while */ } /* end else */ - } /* end else */ + } /* end if */ done: if (iter_a_init) @@ -1688,7 +1678,7 @@ done: topologically identical to that in b (as verified by H5S_select_shape_same(). - This function exists, as some I/O code chokes of topologically + This function exists, as some I/O code chokes on topologically identical selections with different ranks. At least to begin with, we will deal with the issue by constructing projections of the memory dataspace with ranks equaling those of the file @@ -1709,7 +1699,7 @@ done: const H5S_t *base_space; IN: Ptr to Dataspace to project H5S_t ** new_space_ptr; OUT: Ptr to location in which to return the address of the projected space - int new_space_rank; IN: Rank of the projected space. + int new_space_rank; IN: Rank of the projected space. const void * buf; IN: Base address of the buffer associated with the base space. May be NULL. @@ -1944,13 +1934,12 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, done: /* Cleanup on error */ - if (ret_value < 0) { + if (ret_value < 0) if (new_space && H5S_close(new_space) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_construct_projection() */ +} /* end H5S_select_construct_projection() */ /*-------------------------------------------------------------------------- NAME @@ -1980,7 +1969,7 @@ herr_t H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf) { H5S_sel_iter_t iter; /* Selection iteration info */ - hbool_t iter_init = 0; /* Selection iteration info has been initialized */ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ hssize_t nelmts; /* Number of elements in selection */ size_t max_elem; /* Total number of elements in selection */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Stest.c b/src/H5Stest.c index 860534c..cf7cf22 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> +/* Programmer: Quincey Koziol * Saturday, May 31, 2003 * * Purpose: Dataspace selection testing functions. @@ -336,7 +336,7 @@ static herr_t H5T_set_size(H5T_t *dt, size_t size); /* Library Private Variables */ /*****************************/ -/* The native endianess of the platform */ +/* The native endianness of the platform */ H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR; /*********************/ @@ -1786,42 +1786,36 @@ 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(). + * 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. + * Return: Success: The ID of a new datatype * - * Failure: Negative - * - * 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; /* Pointer to the new datatype */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type_id); switch (H5I_get_type(type_id)) { case H5I_DATATYPE: /* The argument is a datatype handle */ if (NULL == (dt = (H5T_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") break; case H5I_DATASET: { @@ -1829,9 +1823,11 @@ H5Tcopy(hid_t type_id) /* The argument is a dataset handle */ if (NULL == (dset = (H5D_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") + + /* Get the datatype from the dataset */ if (NULL == (dt = H5D_typeof(dset))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get the dataset datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the dataset datatype") } break; case H5I_UNINIT: @@ -1849,21 +1845,22 @@ H5Tcopy(hid_t type_id) case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype or dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset") } /* end switch */ /* Copy datatype */ if (NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy"); /* Atomize result */ if ((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") done: - if (ret_value < 0) + /* Close the new datatype on errors */ + if (H5I_INVALID_HID == ret_value) if (new_dt && H5T_close(new_dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release datatype info") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info") FUNC_LEAVE_API(ret_value) } /* end H5Tcopy() */ @@ -1941,8 +1938,8 @@ done: /*------------------------------------------------------------------------- * Function: H5Tlock * - * Purpose: Locks a type, making it read only and non-destructable. This - * is normally done by the library for predefined datatypes so + * Purpose: Locks a type, making it read only and non-destructable. + * This is normally done by the library for predefined datatypes so * the application doesn't inadvertently change or delete a * predefined type. * @@ -1954,12 +1951,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * - * Robb Matzke, 1 Jun 1998 - * It is illegal to lock a named datatype since we must allow named - * types to be closed (to release file resources) but locking a type - * prevents that. *------------------------------------------------------------------------- */ herr_t @@ -2030,9 +2021,6 @@ done: * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * Broke out from H5Tget_class - QAK - 6/4/99 - * *------------------------------------------------------------------------- */ H5T_class_t @@ -2105,15 +2093,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 @@ -2340,24 +2319,25 @@ done: hid_t H5Tget_super(hid_t type) { - H5T_t *dt; /* Datatype to query */ - H5T_t *super = NULL; /* Supertype */ - hid_t ret_value; /* Return value */ + H5T_t *dt; /* Datatype to query */ + H5T_t *super = NULL; /* Supertype */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type); if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") if (NULL == (super = H5T_get_super(dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "not a datatype") if ((ret_value = H5I_register(H5I_DATATYPE, super, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register parent datatype") + 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(super) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release super datatype info") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, + "unable to release super datatype info") FUNC_LEAVE_API(ret_value) } /* end H5Tget_super() */ @@ -2370,11 +2350,11 @@ done: * the return value is an integer type. * * Return: Success: Data type for base data type. - * * Failure: NULL * * Programmer: Raymond Lu - * October 9, 2002 + * October 9, 2002 + * *------------------------------------------------------------------------- */ H5T_t * @@ -2393,7 +2373,7 @@ H5T_get_super(const H5T_t *dt) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_get_super() */ /*------------------------------------------------------------------------- * Function: H5T_register @@ -2441,8 +2421,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv if (NULL == (new_path = H5T_path_find(src, dst, name, func, dxpl_id, api_call))) 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 @@ -2618,15 +2597,11 @@ done: * The special no-op path cannot be removed. * * Return: Succeess: non-negative - * * Failure: negative * * Programmer: Robb Matzke * Tuesday, January 13, 1998 * - * Modifications: - * Adapted to non-API function - QAK, 11/17/99 - * *------------------------------------------------------------------------- */ static herr_t @@ -2937,10 +2912,6 @@ done: * Programmer: Raymond Lu * July 14, 2004 * - * Modification:Raymond Lu - * 17 February 2011 - * I changed the value for the APP_REF parameter of H5I_register - * from FALSE to TRUE. *------------------------------------------------------------------------- */ hid_t @@ -3098,10 +3069,6 @@ done: * Programmer: Robb Matzke * Friday, December 5, 1997 * - * Modifications: - * Raymond Lu - * 19 May 2011 - * We support fixed size or variable-length string now. *------------------------------------------------------------------------- */ H5T_t * @@ -3200,8 +3167,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() */ @@ -3510,13 +3477,12 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) ret_value = new_dt; done: - if (ret_value == NULL) { + if (ret_value == NULL) if (new_dt) { if (new_dt->shared) new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared); new_dt = H5FL_FREE(H5T_t, new_dt); } /* end if */ - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_copy() */ @@ -3660,9 +3626,7 @@ H5T__free(H5T_t *dt) /* Free the ID to name info */ H5G_name_free(&(dt->path)); - /* - * Don't free locked datatypes. - */ + /* Don't free locked datatypes */ if (H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype") @@ -3730,6 +3694,7 @@ H5T_close(H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(dt && dt->shared); if (dt->shared->state == H5T_STATE_OPEN) @@ -3801,10 +3766,6 @@ done: * Programmer: Robb Matzke * Tuesday, December 22, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived data types. - * *------------------------------------------------------------------------- */ static herr_t @@ -3844,9 +3805,8 @@ H5T_set_size(H5T_t *dt, size_t size) if (prec > 8 * size) prec = 8 * size; } - else { + else prec = offset = 0; - } switch (dt->shared->type) { case H5T_INTEGER: @@ -3873,21 +3833,21 @@ H5T_set_size(H5T_t *dt, size_t size) if (memb_offset > max_offset) { max_offset = memb_offset; max_index = i; - } - } + } /* end if */ + } /* end for */ max_size = H5T__get_member_size(dt, max_index); if (size < (max_offset + max_size)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member "); - } + } /* end if */ /* Compound must not have been packed previously */ /* We will check if resizing changed the packed state of * this type at the end of this function */ HDassert(!dt->shared->u.compnd.packed); - } + } /* end if */ break; @@ -3927,7 +3887,7 @@ H5T_set_size(H5T_t *dt, size_t size) /* Set up VL information */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); - } + } /* end if */ else { prec = 8 * size; offset = 0; @@ -3953,14 +3913,16 @@ H5T_set_size(H5T_t *dt, size_t size) case H5T_REFERENCE: HDassert("can't happen" && 0); break; + case H5T_NO_CLASS: case H5T_NCLASSES: HDassert("invalid type" && 0); break; + default: HDassert("not implemented yet" && 0); break; - } + } /* end switch */ /* Commit (if we didn't convert this type to a VL string) */ if (dt->shared->type != H5T_VLEN) { @@ -3974,11 +3936,11 @@ H5T_set_size(H5T_t *dt, size_t size) /* Check if the new compound type is packed */ if (dt->shared->type == H5T_COMPOUND) H5T__update_packed(dt); - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_set_size() */ /*------------------------------------------------------------------------- * Function: H5T_get_size @@ -4005,7 +3967,7 @@ H5T_get_size(const H5T_t *dt) HDassert(dt); FUNC_LEAVE_NOAPI(dt->shared->size) -} +} /* end H5T_get_size() */ /*------------------------------------------------------------------------- * Function: H5T_cmp @@ -4507,24 +4469,13 @@ done: * first path in the path table. * * Return: Success: Pointer to the path, valid until the path - * database is modified. + * database is modified. * * Failure: NULL if the path does not exist and no - * function can be found to apply to the new - * path. - * - * Programmer: Robb Matzke - * Tuesday, January 13, 1998 + * function can be found to apply to the new path. * - * Modifications: - * Added a parameter IS_API to indicate whether to an API - * function issued a call to this function. If a API - * function like H5Tregister() is calling this function to - * register a new hard conversion function, IS_API is TRUE - * and the old path is replaced. If a private function like - * H5T_init_interface() is trying to register hard conversions, - * IS_API is FALSE and the old hard path is not replaced. - * Tuesday, Sept 13, 2005 + * Programmer: Robb Matzke + * Tuesday, January 13, 1998 * *------------------------------------------------------------------------- */ @@ -4574,8 +4525,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_t f 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. * @@ -4615,8 +4565,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_t f */ 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. @@ -4638,8 +4587,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_t f 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. @@ -4747,7 +4695,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_t f table = H5FL_FREE(H5T_path_t, table); table = path; H5T_g.path[md] = path; - } + } /* end if */ else if (path != table) { HDassert(cmp); if ((size_t)H5T_g.npaths >= H5T_g.apaths) { @@ -4836,11 +4784,6 @@ H5T_path_noop(const H5T_path_t *p) * Programmer: Raymond Lu * 8 June 2007 * - * Modifications: Neil Fortner - * 19 September 2008 - * Changed return value to H5T_subset_info_t - * (to allow it to return copy_size) - * *------------------------------------------------------------------------- */ H5T_subset_info_t * @@ -4910,7 +4853,7 @@ H5T_compiler_conv(H5T_t *src, H5T_t *dst) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_compiler_conv() */ /*------------------------------------------------------------------------- * Function: H5T_convert @@ -4925,32 +4868,6 @@ done: * Programmer: Robb Matzke * Tuesday, December 15, 1998 * - * Modifications: - * Robb Matzke, 1999-06-16 - * The timers are updated only if H5T debugging is enabled at - * runtime in addition to compile time. - * - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. - * - * Quincey Koziol, 1999-07-01 - * Added dataset transfer properties, to allow custom VL - * datatype allocation function to be passed down to VL - * conversion routine. - * - * Robb Matzke, 2000-05-17 - * Added the BKG_STRIDE argument which gets passed to all the - * conversion functions. If BUF_STRIDE is non-zero then each - * data element is at a multiple of BUF_STRIDE bytes in BUF - * (on both input and output). If BKG_STRIDE is also set then - * the BKG buffer is used in such a way that temporary space - * for each element is aligned on a BKG_STRIDE byte boundary. - * If either BUF_STRIDE or BKG_STRIDE are zero then the BKG - * buffer will be accessed as though it were a packed array - * of destination datatype. *------------------------------------------------------------------------- */ herr_t @@ -4958,7 +4875,7 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist) { #ifdef H5T_DEBUG - H5_timer_t timer; + H5_timer_t timer; /* Timer for conversion */ #endif herr_t ret_value = SUCCEED; /* Return value */ @@ -4977,12 +4894,12 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t H5_timer_end(&(tpath->stats.timer), &timer); tpath->stats.ncalls++; tpath->stats.nelmts += nelmts; - } + } /* end if */ #endif done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_convert() */ /*------------------------------------------------------------------------- * Function: H5T_oloc @@ -5095,14 +5012,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 @@ -5158,7 +5071,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) @@ -5618,8 +5531,8 @@ done: /*------------------------------------------------------------------------- * Function: H5T_patch_vlen_file * - * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.f) - * to point to f. This is possible because + * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.file) + * to point to file. This is possible because * the top-level file pointer can be closed out from under * dt while dt is contained in the shared file's cache. * @@ -5628,17 +5541,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_patch_vlen_file(H5T_t *dt, H5F_t *f) +H5T_patch_vlen_file(H5T_t *dt, H5F_t *file) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(dt); HDassert(dt->shared); - HDassert(f); + HDassert(file); - if ((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.f != f) - dt->shared->u.vlen.f = f; + if ((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.f != file) + dt->shared->u.vlen.f = file; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T_patch_vlen_file() */ @@ -34,8 +34,34 @@ H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT; #endif /* H5_HAVE_WIN_THREADS */ H5TS_key_t H5TS_errstk_key_g; H5TS_key_t H5TS_funcstk_key_g; +H5TS_key_t H5TS_apictx_key_g; H5TS_key_t H5TS_cancel_key_g; +#ifndef H5_HAVE_WIN_THREADS + +/* An H5TS_tid_t is a record of a thread identifier that is + * available for reuse. + */ +struct _tid; +typedef struct _tid H5TS_tid_t; + +struct _tid { + H5TS_tid_t *next; + uint64_t id; +}; + +/* Pointer to first free thread ID record or NULL. */ +static H5TS_tid_t *H5TS_tid_next_free = NULL; +static uint64_t H5TS_tid_next_id = 0; + +/* Mutual exclusion for access to H5TS_tid_next_free and H5TS_tid_next_id. */ +static pthread_mutex_t H5TS_tid_mtx; + +/* Key for thread-local storage of the thread ID. */ +static H5TS_key_t H5TS_tid_key; + +#endif /* H5_HAVE_WIN_THREADS */ + /*-------------------------------------------------------------------------- * NAME * H5TS_key_destructor @@ -67,6 +93,127 @@ H5TS_key_destructor(void *key_val) /*-------------------------------------------------------------------------- * NAME + * H5TS_tid_destructor + * + * USAGE + * H5TS_tid_destructor() + * + * RETURNS + * + * DESCRIPTION + * When a thread shuts down, put its ID record on the free list. + * + *-------------------------------------------------------------------------- + */ +static void +H5TS_tid_destructor(void *_v) +{ + H5TS_tid_t *tid = _v; + + if (tid == NULL) + return; + + /* TBD use an atomic CAS */ + pthread_mutex_lock(&H5TS_tid_mtx); + tid->next = H5TS_tid_next_free; + H5TS_tid_next_free = tid; + pthread_mutex_unlock(&H5TS_tid_mtx); +} + +/*-------------------------------------------------------------------------- + * NAME + * H5TS_tid_init + * + * USAGE + * H5TS_tid_init() + * + * RETURNS + * + * DESCRIPTION + * Initialize for integer thread identifiers. + * + *-------------------------------------------------------------------------- + */ +static void +H5TS_tid_init(void) +{ + pthread_mutex_init(&H5TS_tid_mtx, NULL); + pthread_key_create(&H5TS_tid_key, H5TS_tid_destructor); +} + +/*-------------------------------------------------------------------------- + * NAME + * H5TS_thread_id + * + * USAGE + * uint64_t id = H5TS_thread_id() + * + * RETURNS + * Return an integer identifier, ID, for the current thread. + * + * DESCRIPTION + * The ID satisfies the following properties: + * + * 1 1 <= ID <= UINT64_MAX + * 2 ID is constant over the thread's lifetime. + * 3 No two threads share an ID during their lifetimes. + * 4 A thread's ID is available for reuse as soon as it is joined. + * + * ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not + * built with thread safety or if an error prevents it from assigning an + * ID. + * + *-------------------------------------------------------------------------- + */ +uint64_t +H5TS_thread_id(void) +{ + H5TS_tid_t *tid = pthread_getspecific(H5TS_tid_key); + H5TS_tid_t proto_tid; + + /* An ID is already assigned. */ + if (tid != NULL) + return tid->id; + + /* An ID is *not* already assigned: reuse an ID that's on the + * free list, or else generate a new ID. + * + * Allocating memory while holding a mutex is bad form, so + * point `tid` at `proto_tid` if we need to allocate some + * memory. + */ + pthread_mutex_lock(&H5TS_tid_mtx); + if ((tid = H5TS_tid_next_free) != NULL) + H5TS_tid_next_free = tid->next; + else if (H5TS_tid_next_id != UINT64_MAX) { + tid = &proto_tid; + tid->id = ++H5TS_tid_next_id; + } + pthread_mutex_unlock(&H5TS_tid_mtx); + + /* If a prototype ID record was established, copy it to the heap. */ + if (tid == &proto_tid) { + if ((tid = HDmalloc(sizeof(*tid))) != NULL) + *tid = proto_tid; + } + + if (tid == NULL) + return 0; + + /* Finish initializing the ID record and set a thread-local pointer + * to it. + */ + tid->next = NULL; + if (pthread_setspecific(H5TS_tid_key, tid) != 0) { + H5TS_tid_destructor(tid); + return 0; + } + + return tid->id; +} + +/*-------------------------------------------------------------------------- + * NAME * H5TS_pthread_first_thread_init * * USAGE @@ -87,7 +234,7 @@ H5TS_key_destructor(void *key_val) void H5TS_pthread_first_thread_init(void) { - H5_g.H5_libinit_g = FALSE; + H5_g.H5_libinit_g = FALSE; /* Library hasn't been initialized */ #ifdef H5_HAVE_WIN32_API #ifdef PTW32_STATIC_LIB @@ -100,12 +247,18 @@ H5TS_pthread_first_thread_init(void) pthread_cond_init(&H5_g.init_lock.cond_var, NULL); H5_g.init_lock.lock_count = 0; + /* Initialize integer thread identifiers. */ + H5TS_tid_init(); + /* initialize key for thread-specific error stacks */ pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor); /* initialize key for thread-specific function stacks */ pthread_key_create(&H5TS_funcstk_key_g, H5TS_key_destructor); + /* initialize key for thread-specific API contexts */ + pthread_key_create(&H5TS_apictx_key_g, H5TS_key_destructor); + /* initialize key for thread cancellability mechanism */ pthread_key_create(&H5TS_cancel_key_g, H5TS_key_destructor); } @@ -143,7 +296,7 @@ H5TS_mutex_lock(H5TS_mutex_t *mutex) if (ret_value) return ret_value; - if (mutex->lock_count && pthread_equal(HDpthread_self(), mutex->owner_thread)) { + if (mutex->lock_count && pthread_equal(pthread_self(), mutex->owner_thread)) { /* already owned by self - increment count */ mutex->lock_count++; } @@ -153,7 +306,7 @@ H5TS_mutex_lock(H5TS_mutex_t *mutex) pthread_cond_wait(&mutex->cond_var, &mutex->atomic_lock); /* After we've received the signal, take ownership of the mutex */ - mutex->owner_thread = HDpthread_self(); + mutex->owner_thread = pthread_self(); mutex->lock_count = 1; } @@ -249,13 +402,15 @@ H5TS_cancel_count_inc(void) if (!cancel_counter) { /* * First time thread calls library - create new counter and associate - * with key + * with key. + * + * Don't use H5MM calls here since the destructor has to use HDfree in + * order to avoid codestack calls. */ - cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t)); + cancel_counter = (H5TS_cancel_t *)HDcalloc(1, sizeof(H5TS_cancel_t)); if (!cancel_counter) { - H5E_push_stack(NULL, "H5TS_cancel_count_inc", __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, - H5E_NOSPACE, "memory allocation failed"); + HERROR(H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); return FAIL; } @@ -345,6 +500,9 @@ H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex) ret_value = FALSE; #endif /* H5_HAVE_CODESTACK */ + if (TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc())) + ret_value = FALSE; + return ret_value; } /* H5TS_win32_process_enter() */ #endif /* H5_HAVE_WIN_THREADS */ @@ -408,10 +566,10 @@ 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 */ + TlsFree(H5TS_apictx_key_g); return; } /* H5TS_win32_process_exit() */ @@ -455,6 +613,10 @@ H5TS_win32_thread_exit(void) LocalFree((HLOCAL)lpvData); #endif /* H5_HAVE_CODESTACK */ + lpvData = TlsGetValue(H5TS_apictx_key_g); + if (lpvData) + LocalFree((HLOCAL)lpvData); + return ret_value; } /* H5TS_win32_thread_exit() */ #endif /* H5_HAVE_WIN_THREADS */ diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index ea03828..700d879 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -19,13 +19,12 @@ * * Purpose: Private non-prototype header. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef H5TSprivate_H_ #define H5TSprivate_H_ +#ifdef H5_HAVE_THREADSAFE /* Public headers needed by this file */ #ifdef LATER #include "H5TSpublic.h" /*Public API prototypes */ @@ -68,6 +67,8 @@ H5_DLL void H5TS_win32_process_exit(void); H5_DLL herr_t H5TS_win32_thread_enter(void); H5_DLL herr_t H5TS_win32_thread_exit(void); +#define H5TS_thread_id() ((uint64_t)GetCurrentThreadId()) + #else /* H5_HAVE_WIN_THREADS */ /* Library level data structures */ @@ -100,6 +101,7 @@ typedef pthread_once_t H5TS_once_t; #define H5TS_mutex_init(mutex) pthread_mutex_init(mutex, NULL) #define H5TS_mutex_lock_simple(mutex) pthread_mutex_lock(mutex) #define H5TS_mutex_unlock_simple(mutex) pthread_mutex_unlock(mutex) +H5_DLL uint64_t H5TS_thread_id(void); #endif /* H5_HAVE_WIN_THREADS */ @@ -107,6 +109,7 @@ typedef pthread_once_t H5TS_once_t; extern H5TS_once_t H5TS_first_init_g; extern H5TS_key_t H5TS_errstk_key_g; extern H5TS_key_t H5TS_funcstk_key_g; +extern H5TS_key_t H5TS_apictx_key_g; #if defined c_plusplus || defined __cplusplus extern "C" { @@ -123,4 +126,10 @@ H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr } #endif /* c_plusplus || __cplusplus */ +#else /* H5_HAVE_THREADSAFE */ + +#define H5TS_thread_id() ((uint64_t)0) + +#endif /* H5_HAVE_THREADSAFE */ + #endif /* H5TSprivate_H_ */ diff --git a/src/H5Tarray.c b/src/H5Tarray.c index f9a8da0..6678b58 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -113,33 +113,32 @@ H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */]) unsigned u; /* local index variable */ hid_t ret_value; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iIu*h", base_id, ndims, dim); /* Check args */ if (ndims < 1 || ndims > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dimensionality") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dimensionality") if (!dim) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no dimensions specified") for (u = 0; u < ndims; u++) if (!(dim[u] > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero-sized dimension specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "zero-sized dimension specified") if (NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an valid base datatype") /* Create the array datatype */ if (NULL == (dt = H5T__array_create(base, ndims, dim))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to create datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype") /* Atomize the type */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") done: - if (ret_value < 0) { + if (H5I_INVALID_HID == ret_value) if (dt && H5T_close(dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype") - } /* end if */ + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "can't release datatype") FUNC_LEAVE_API(ret_value) } /* end H5Tarray_create2() */ @@ -164,8 +163,8 @@ done: H5T_t * H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]) { - H5T_t * ret_value; /* new array data type */ - unsigned u; /* local index variable */ + unsigned u; /* Local index variable */ + H5T_t * ret_value = NULL; /* New array data type */ FUNC_ENTER_PACKAGE @@ -364,33 +363,32 @@ H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], unsigned u; /* local index variable */ hid_t ret_value; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "iIs*h*Is", base_id, ndims, dim, perm); /* Check args */ if (ndims < 1 || ndims > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dimensionality") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dimensionality") if (!dim) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no dimensions specified") for (u = 0; u < (unsigned)ndims; u++) if (!(dim[u] > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero-sized dimension specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "zero-sized dimension specified") if (NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an valid base datatype") /* Create the array datatype */ if (NULL == (dt = H5T__array_create(base, (unsigned)ndims, dim))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to create datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype") /* Atomize the type */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") done: - if (ret_value < 0) { + if (H5I_INVALID_HID == ret_value) if (dt && H5T_close(dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype") - } /* end if */ + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "can't release datatype") FUNC_LEAVE_API(ret_value) } /* end H5Tarray_create1() */ diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 178e0bf..506cf9a 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -11,10 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Module Info: Operations on bit vectors. A bit vector is an array of bytes - * with the least-significant bits in the first byte. That is, - * the bytes are in little-endian order. +/* Module Info: Operations on bit vectors. A bit vector is an array of bytes + * with the least-significant bits in the first byte. That is, + * the bytes are in little-endian order. */ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ @@ -26,14 +25,11 @@ #include "H5WBprivate.h" /* Wrapped Buffers */ /*------------------------------------------------------------------------- - * Function: H5T__bit_copy + * Function: H5T__bit_copy * - * Purpose: Copies bits from one vector to another. + * Purpose: Copies bits from one vector to another. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 + * Return: void * *------------------------------------------------------------------------- */ @@ -46,8 +42,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_of FUNC_ENTER_PACKAGE_NOERR - /* - * Normalize the offset to be a byte number and a bit offset within that + /* Normalize the offset to be a byte number and a bit offset within that * byte. */ s_idx = src_offset / 8; @@ -55,8 +50,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_of src_offset %= 8; dst_offset %= 8; - /* - * Get things rolling. This means copying bits until we're aligned on a + /* Get things rolling. This means copying bits until we're aligned on a * source byte. This the following example, five bits are copied to the * destination. * @@ -82,19 +76,18 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_of if (src_offset >= 8) { s_idx++; src_offset %= 8; - } /* end if */ + } dst_offset += nbits; if (dst_offset >= 8) { d_idx++; dst_offset %= 8; - } /* end if */ + } size -= nbits; - } /* end while */ + } - /* - * The middle bits. We are aligned on a source byte which needs to be + /* The middle bits. We are aligned on a source byte which needs to be * copied to two (or one in the degenerate case) destination bytes. * * src[s_idx] @@ -124,10 +117,10 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_of dst[d_idx + 0] |= (uint8_t)((src[s_idx] & mask_lo) << shift); dst[d_idx + 1] &= (uint8_t)(~(mask_hi >> (8 - shift))); dst[d_idx + 1] |= (uint8_t)((src[s_idx] & mask_hi) >> (8 - shift)); - } /* end if */ + } else dst[d_idx] = src[s_idx]; - } /* end for */ + } /* Finish up */ while (size > 0) { @@ -141,24 +134,24 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_of if (src_offset >= 8) { s_idx++; src_offset %= 8; - } /* end if */ + } dst_offset += nbits; if (dst_offset >= 8) { d_idx++; dst_offset %= 8; - } /* end if */ + } size -= nbits; - } /* end while */ + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_copy() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_shift + * Function: H5T__bit_shift * - * Purpose: Simulation of hardware shifting. Shifts a bit vector + * Purpose: Simulation of hardware shifting. Shifts a bit vector * in a way similar to shifting a variable value, like * value <<= 3, or value >>= 16. SHIFT_DIST is positive for * left shift, negative for right shift. The bit vector starts @@ -168,10 +161,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_of * For example, if we have a bit sequence 00011100, offset=2, * size=3, shift_dist=2, the result will be 00010000. * - * Return: void - * - * Programmer: Raymond Lu - * Monday, April 12, 2004 + * Return: void * *------------------------------------------------------------------------- */ @@ -215,14 +205,14 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) /* Zero-set the left part*/ H5T__bit_set(buf, offset, abs_shift_dist, 0); - } /* end if */ + } else { /* right shift */ H5T__bit_copy(shift_buf, (size_t)0, buf, offset + abs_shift_dist, size - abs_shift_dist); H5T__bit_copy(buf, offset, shift_buf, (size_t)0, size - abs_shift_dist); H5T__bit_set(buf, offset + size - abs_shift_dist, abs_shift_dist, 0); - } /* end else */ - } /* end else */ - } /* end if */ + } + } /* end else */ + } /* end if */ done: /* Release resources */ @@ -233,18 +223,15 @@ done: } /* end H5T__bit_shift() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_get_d + * Function: H5T__bit_get_d * - * Purpose: Return a small bit sequence as a number. Bit vector starts + * Purpose: Return a small bit sequence as a number. Bit vector starts * at OFFSET and is SIZE bits long. * - * Return: Success: The bit sequence interpretted as an unsigned - * integer. + * Return: Success: The bit sequence interpretted as an unsigned + * integer. * - * Failure: 0 - * - * Programmer: Robb Matzke - * Tuesday, June 23, 1998 + * Failure: 0 * *------------------------------------------------------------------------- */ @@ -253,7 +240,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) { uint64_t val = 0; size_t i, hs; - uint64_t ret_value; /* Return value */ + uint64_t ret_value = 0; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -269,7 +256,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) uint8_t tmp = ((uint8_t *)&val)[i]; ((uint8_t *)&val)[i] = ((uint8_t *)&val)[sizeof(val) - (i + 1)]; ((uint8_t *)&val)[sizeof(val) - (i + 1)] = tmp; - } /* end for */ + } break; case H5T_ORDER_ERROR: @@ -279,7 +266,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) default: /* Unknown endianness. Bail out. */ HGOTO_DONE(UFAIL) - } /* end switch */ + } /* Set return value */ ret_value = val; @@ -289,14 +276,11 @@ done: } /* end H5T__bit_get_d() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_set_d + * Function: H5T__bit_set_d * - * Purpose: Sets part of a bit vector to the specified unsigned value. + * Purpose: Sets part of a bit vector to the specified unsigned value. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 24, 1998 + * Return: void * *------------------------------------------------------------------------- */ @@ -318,7 +302,7 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) uint8_t tmp = ((uint8_t *)&val)[i]; ((uint8_t *)&val)[i] = ((uint8_t *)&val)[sizeof(val) - (i + 1)]; ((uint8_t *)&val)[sizeof(val) - (i + 1)] = tmp; - } /* end for */ + } break; case H5T_ORDER_ERROR: @@ -327,7 +311,7 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) case H5T_ORDER_MIXED: default: HDabort(); - } /* end switch */ + } H5T__bit_copy(buf, offset, (uint8_t *)&val, (size_t)0, size); @@ -335,17 +319,12 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) } /* end H5T__bit_set_d() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_set - * - * Purpose: Sets or clears bits in a contiguous region of a vector - * beginning at bit OFFSET and continuing for SIZE bits. + * Function: H5T__bit_set * - * Return: void + * Purpose: Sets or clears bits in a contiguous region of a vector + * beginning at bit OFFSET and continuing for SIZE bits. * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -370,13 +349,13 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) else buf[idx++] &= (uint8_t)(~(mask << offset)); size -= nbits; - } /* end if */ + } /* The middle bytes */ while (size >= 8) { buf[idx++] = value ? 0xff : 0x00; size -= 8; - } /* end while */ + } /* The last partial byte */ if (size) { @@ -384,28 +363,25 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) buf[idx] |= (uint8_t)(((unsigned)1 << size) - 1); else buf[idx] &= (uint8_t)(~(((unsigned)1 << size) - 1)); - } /* end if */ + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_set() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_find - * - * Purpose: Finds the first bit with the specified VALUE within a region - * of a bit vector. The region begins at OFFSET and continues - * for SIZE bits, but the region can be searched from the least - * significat end toward the most significant end(H5T_BIT_LSB - * as DIRECTION), or from the most significant end to the least - * significant end(H5T_BIT_MSB as DIRECTION). + * Function: H5T__bit_find * - * Return: Success: The position of the bit found, relative to - * the offset. + * Purpose: Finds the first bit with the specified VALUE within a region + * of a bit vector. The region begins at OFFSET and continues + * for SIZE bits, but the region can be searched from the least + * significat end toward the most significant end(H5T_BIT_LSB + * as DIRECTION), or from the most significant end to the least + * significant end(H5T_BIT_MSB as DIRECTION). * - * Failure: -1 + * Return: Success: The position of the bit found, relative to + * the offset. * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -487,7 +463,7 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hb for (iu = offset + size; iu > offset; --iu) if (value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) HGOTO_DONE(8 * idx + (ssize_t)(iu - 1) - base); - } /* end if */ + } break; default: @@ -499,18 +475,12 @@ done: } /* end H5T__bit_find() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_inc + * Function: H5T__bit_inc * - * Purpose: Increment part of a bit field by adding 1. The bit field + * Purpose: Increment part of a bit field by adding 1. The bit field * starts with bit position START and is SIZE bits long. * - * Return: Success: The carry-out value. One if overflows, - * zero otherwise. - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Friday, June 26, 1998 + * Return: The carry-out value. TRUE if overflows, FALSE otherwise. * *------------------------------------------------------------------------- */ @@ -542,7 +512,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) size -= MIN(size, 8 - start); start = 0; idx++; - } /* end if */ + } /* The middle */ while (carry && size >= 8) { @@ -552,7 +522,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) buf[idx] = acc & 0xff; idx++; size -= 8; - } /* end while */ + } /* The last bits */ if (carry && size > 0) { @@ -562,24 +532,19 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) carry = acc & ((unsigned)1 << size); buf[idx] &= (uint8_t)(~mask); buf[idx] |= (uint8_t)(acc & mask); - } /* end if */ + } FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE) } /* end H5T__bit_inc() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_dec + * Function: H5T__bit_dec * - * Purpose: decrement part of a bit field by substracting 1. The bit + * Purpose: Decrement part of a bit field by substracting 1. The bit * field starts with bit position START and is SIZE bits long. * - * Return: Success: The "borrow-in" value. It's one if underflows, - * zero otherwise. - * - * Failure: Negative - * - * Programmer: Raymond Lu - * March 17, 2004 + * Return: The "borrow-in" value. It's TRUE if underflows, FALSE + * otherwise. * *------------------------------------------------------------------------- */ @@ -618,7 +583,7 @@ H5T__bit_dec(uint8_t *buf, size_t start, size_t size) idx++; size -= 8; - } /* end while */ + } /* The last partial byte */ if (borrow && size > 0) { @@ -627,9 +592,11 @@ H5T__bit_dec(uint8_t *buf, size_t start, size_t size) buf[idx]--; if ((buf[idx] >> size) != tmp >> size) buf[idx] = (uint8_t)(buf[idx] + (1 << size)); - } /* end if */ - } /* end if */ - else { /* bit sequence ends in the same byte as starts */ + } + } + else { + /* The bit sequence ends in the same byte as starts */ + /* Example: a sequence like 11000100 and pos=3, size=3. We substract 00001000 * and get 10111100. A bit is borrowed from 6th bit(buf[idx]>>6=00000010, tmp>>6=00000011, * not equal). We need to put this bit back by increment 1000000. @@ -639,22 +606,19 @@ H5T__bit_dec(uint8_t *buf, size_t start, size_t size) if ((buf[idx] >> (pos + size)) != tmp >> (pos + size)) { buf[idx] = (uint8_t)(buf[idx] + (1 << (pos + size))); borrow = 1; - } /* end if */ - } /* end else */ + } + } FUNC_LEAVE_NOAPI(borrow ? TRUE : FALSE) } /* end H5T__bit_dec() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_neg - * - * Purpose: negate part of a bit sequence. The bit - * field starts with bit position START and is SIZE bits long. + * Function: H5T__bit_neg * - * Return: void + * Purpose: Negate part of a bit sequence. The bit field starts with + * bit position START and is SIZE bits long. * - * Programmer: Raymond Lu - * March 19, 2004 + * Return: void * *------------------------------------------------------------------------- */ @@ -685,17 +649,19 @@ H5T__bit_neg(uint8_t *buf, size_t start, size_t size) buf[idx] = (uint8_t) ~(buf[idx]); idx++; size -= 8; - } /* end while */ + } /* The last partial byte */ if (size > 0) { /* Similar to the first byte case, where sequence ends in the same byte as starts */ tmp[0] = (uint8_t)~buf[idx]; H5T__bit_copy(&(buf[idx]), (size_t)0, tmp, (size_t)0, size); - } /* end if */ - } /* end if */ - else /* bit sequence ends in the same byte as starts */ + } + } + else { + /* bit sequence ends in the same byte as starts */ H5T__bit_copy(&(buf[idx]), pos, tmp, pos, size); + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_neg() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 438637f..a0fc720 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -92,12 +92,12 @@ H5T_init_commit_interface(void) } /* H5T_init_commit_interface() */ /*------------------------------------------------------------------------- - * 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 + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * April 5, 2007 @@ -231,18 +231,18 @@ done: } /* end H5T__commit_named() */ /*------------------------------------------------------------------------- - * 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 + * Return: Non-negative on success/Negative on failure * * Programmer: Peter Cao * May 17, 2005 @@ -364,7 +364,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id) if (H5T_set_latest_version(type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype") - /* Calculate message size infomation, for creating object header */ + /* Calculate message size information, for creating object header */ dtype_size = H5O_msg_size_f(file, tcpl_id, H5O_DTYPE_ID, type, (size_t)0); HDassert(dtype_size); @@ -425,13 +425,11 @@ done: } /* H5T__commit() */ /*------------------------------------------------------------------------- - * Function: H5Tcommitted + * Function: H5Tcommitted * - * Purpose: Determines if a datatype is committed or not. + * Purpose: Determines if a datatype is committed or not. * - * Return: Success: TRUE if committed, FALSE otherwise. - * - * Failure: Negative + * Return: TRUE/FALSE/Negative * * Programmer: Robb Matzke * Thursday, June 4, 1998 @@ -488,7 +486,7 @@ H5T_committed(const H5T_t *type) * ADJUST to the link count. * * Return: Success: New link count - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -498,29 +496,30 @@ H5T_committed(const H5T_t *type) int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id) { - int ret_value; /* Return value */ + 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, dxpl_id)) < 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) } /* end H5T_link() */ /*------------------------------------------------------------------------- - * 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 + * + * Failure: H5I_INVALID_HID * * Programmer: James Laird * Thursday July 27, 2006 @@ -538,22 +537,22 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ - 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) H5TRACE3("i", "i*si", loc_id, name, tapl_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 (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Get correct property list */ if (H5P_DEFAULT == tapl_id) tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not datatype access property list") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; @@ -565,25 +564,25 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) * from it. */ if (H5G_loc_find(&loc, name, &type_loc /*out*/, tapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, H5I_INVALID_HID, "not found") obj_found = TRUE; /* Check that the object found is the correct type */ if (H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object type") if (obj_type != H5O_TYPE_NAMED_DATATYPE) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "not a named datatype") /* Open it */ if (NULL == (type = H5T_open(&type_loc, dxpl_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ if ((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: - if (ret_value < 0) { + if (H5I_INVALID_HID == ret_value) { if (type != NULL) H5T_close(type); else { @@ -596,15 +595,18 @@ done: } /* end H5Topen2() */ /*------------------------------------------------------------------------- - * Function: H5Tget_create_plist + * Function: H5Tget_create_plist * - * Purpose: Returns a copy of the datatype creation property list. + * 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(). + * + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Tuesday, November 28, 2006 @@ -614,28 +616,28 @@ done: hid_t H5Tget_create_plist(hid_t dtype_id) { - H5T_t * type; /* Datatype object for ID */ - H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */ - hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ - herr_t status; /* Generic status value */ - hid_t ret_value; /* Return value */ + H5T_t * type; /* Datatype object for ID */ + H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */ + hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ + herr_t status; /* Generic status value */ + 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") /* 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, FAIL, "can't get default creation property list") + HGOTO_ERROR(H5E_ARGS, 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") /* 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") + 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) { @@ -643,21 +645,21 @@ H5Tget_create_plist(hid_t dtype_id) /* Get property list object for new TCPL */ if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_tcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list") /* Retrieve any object creation properties */ if (H5O_get_create_plist(&type->oloc, H5AC_ind_dxpl_id, 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") } /* end if */ /* Set the return value */ ret_value = new_tcpl_id; done: - if (ret_value < 0) + if (H5I_INVALID_HID == ret_value) 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_API(ret_value) } /* end H5Tget_create_plist() */ @@ -681,7 +683,7 @@ H5T_open(const H5G_loc_t *loc, hid_t dxpl_id) { H5T_shared_t *shared_fo = NULL; H5T_t * dt = NULL; - H5T_t * ret_value; + H5T_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -795,8 +797,8 @@ done: static H5T_t * H5T_open_oid(const H5G_loc_t *loc, hid_t dxpl_id) { - H5T_t *dt = NULL; /* Datatype from the file */ - H5T_t *ret_value; /* Return value */ + H5T_t *dt = NULL; /* Datatype from the file */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index ba067be..d7a60da 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -103,8 +103,6 @@ H5T_init_compound_interface(void) * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t @@ -171,8 +169,6 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno) * Programmer: Quincey Koziol * Thursday, November 9, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_class_t @@ -210,7 +206,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 @@ -224,23 +220,27 @@ H5Tget_member_type(hid_t type_id, unsigned membno) H5T_t *memb_dt = NULL; /* Member datatype */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "iIu", type_id, 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, FAIL, "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, FAIL, "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, FAIL, "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, FAIL, "unable register datatype atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") done: - if (ret_value < 0) + if (H5I_INVALID_HID == ret_value) if (memb_dt && H5T_close(memb_dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype") FUNC_LEAVE_API(ret_value) } /* end H5Tget_member_type() */ @@ -248,8 +248,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_get_member_type * - * Purpose: Private function for H5Tget_member_type. Returns the data - * type of the specified member. + * Purpose: Returns a copy of the data type of the specified member. * * Return: Success: A copy of the member datatype; * modifying the returned datatype does not @@ -265,10 +264,11 @@ done: H5T_t * H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method) { - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) + /* Sanity checks */ HDassert(dt); HDassert(membno < dt->shared->u.compnd.nmembs); @@ -324,8 +324,6 @@ H5T__get_member_size(const H5T_t *dt, unsigned membno) * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -370,8 +368,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -577,8 +573,6 @@ done: * Programmer: Quincey Koziol * Thursday, September 11, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -595,9 +589,8 @@ H5T_is_packed(const H5T_t *dt) dt = dt->shared->parent; /* If this is a compound datatype, check if it is packed */ - if (dt->shared->type == H5T_COMPOUND) { + if (dt->shared->type == H5T_COMPOUND) ret_value = (htri_t)(dt->shared->u.compnd.packed); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_is_packed() */ @@ -615,8 +608,6 @@ H5T_is_packed(const H5T_t *dt) * Programmer: Neil Fortner * Monday, October 19, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 46bb738..c3168f4 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -109,7 +109,7 @@ * least as large as the destination. Overflows can occur when * the destination is narrower than the source. * - * xF: Integers to float-point(float or double) values where the desination + * xF: Integers to float-point(float or double) values where the destination * is at least as wide as the source. This case cannot generate * overflows. * @@ -1121,8 +1121,6 @@ done: * Programmer: Robb Matzke * Friday, January 25, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1533,14 +1531,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 13, 1998 * - * Modifications: - * Robb Matzke, 1999-06-16 - * Added the `stride' argument. If its value is non-zero then we - * stride through memory converting one value at each location; - * otherwise we assume that the values should be packed. - * - * Robb Matzke, 1999-06-16 - * Added support for bitfields. *------------------------------------------------------------------------- */ herr_t @@ -1638,12 +1628,6 @@ done: * Programmer: Robb Matzke * Thursday, May 20, 1999 * - * Modifications: - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. *------------------------------------------------------------------------- */ herr_t @@ -1897,8 +1881,6 @@ done: * Programmer: Neil Fortner * Wednesday, October 1, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5T_conv_struct_t * @@ -1946,16 +1928,9 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv) * source member doesn't have a corresponding destination member * then the src2dst[i]=-1. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Monday, January 26, 1998 - * - * Modifications: - * Raymond Lu, 3 May 2007 - * Added the detection for a special optimization case when the - * source and destination members are a subset of each other, and - * the order is the same, and no conversion is needed. For example: + * Special optimization case when the source and destination + * members are a subset of each other, and the order is the same, + * and no conversion is needed. For example: * struct source { struct destination { * TYPE1 A; --> TYPE1 A; * TYPE2 B; --> TYPE2 B; @@ -1974,6 +1949,11 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv) * The optimization is simply moving data to the appropriate * places in the buffer. * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Monday, January 26, 1998 + * *------------------------------------------------------------------------- */ static herr_t @@ -2158,7 +2138,7 @@ done: H5T_subset_info_t * H5T__conv_struct_subset(const H5T_cdata_t *cdata) { - H5T_conv_struct_t *priv; + H5T_conv_struct_t *priv = NULL; FUNC_ENTER_PACKAGE_NOERR @@ -2403,37 +2383,7 @@ done: * * Copy BKG to BUF for all elements * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, January 22, 1998 - * - * Modifications: - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is - * non-zero then convert one value at each memory location - * advancing BUF_STRIDE bytes each time; otherwise assume both - * source and destination values are packed. - * - * Robb Matzke, 1999-06-16 - * If the source and destination data structs are the same size - * then we can convert on a field-by-field basis instead of an - * element by element basis. In other words, for all struct - * elements being converted by this function call, first convert - * all of the field1's, then all field2's, etc. This can - * drastically reduce the number of calls to H5T_convert() and - * thereby eliminate most of the conversion constant overhead. - * - * Robb Matzke, 2000-05-17 - * Added the BKG_STRIDE argument to fix a design bug. If - * BUF_STRIDE and BKG_STRIDE are both non-zero then each - * data element converted will be placed temporarily at a - * multiple of BKG_STRIDE in the BKG buffer; otherwise the - * BKG buffer is assumed to be a packed array of destination - * datatype. - * - * Raymond Lu, 3 May 2007 - * Optimize a special case when the source and destination members + * Special case when the source and destination members * are a subset of each other, and the order is the same, and no * conversion is needed. For example: * struct source { struct destination { @@ -2446,6 +2396,11 @@ done: * The optimization is simply moving data to the appropriate * places in the buffer. * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Thursday, January 22, 1998 + * *------------------------------------------------------------------------- */ herr_t @@ -2523,7 +2478,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm if (dst_memb->size > src->shared->size - offset) { cdata->priv = H5T_conv_struct_free(priv); HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "convertion is unsupported by this function") + "conversion is unsupported by this function") } /* end if */ } /* end if */ } /* end for */ @@ -2691,8 +2646,6 @@ done: * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -2973,7 +2926,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* Use O(log N) lookup */ unsigned lt = 0; unsigned rt = src->shared->u.enumer.nmembs; - unsigned md; + unsigned md = 0; int cmp; while (lt < rt) { @@ -3126,22 +3079,6 @@ done: * Programmer: Quincey Koziol * Wednesday, May 26, 1999 * - * Modifications: - * - * Quincey Koziol, 2 July, 1999 - * Enabled support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. - * - * Raymond Lu, 26 June, 2002 - * Background buffer is used for freeing heap objects storing - * old data. At this moment, it only frees the first level of - * VL datatype. It doesn't handle nested VL datatypes. - * - * Raymond Lu, 8 November 2011 - * I put a condition check to prevent the conversion of VL strings - * between ASCII and UTF8. *------------------------------------------------------------------------- */ herr_t @@ -3500,8 +3437,6 @@ done: * Programmer: Quincey Koziol * Monday, November 6, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3657,20 +3592,6 @@ done: * Programmer: Robb Matzke * Wednesday, June 10, 1998 * - * Modifications: - * Robb Matzke, 7 Jul 1998 - * Added overflow handling. - * - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. - * - * Raymond Lu - * Wednesday, April 21, 2004 - * There is a new design for exception handling like overflow, - * which is passed in as a transfer property. *------------------------------------------------------------------------- */ herr_t @@ -4114,23 +4035,6 @@ done: * Programmer: Robb Matzke * Tuesday, June 23, 1998 * - * Modifications: - * Robb Matzke, 7 Jul 1998 - * Added overflow handling. - * - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. - * - * Robb Matzke, 2001-02-02 - * Oops, forgot to increment the exponent when rounding the - * significand resulted in a carry. Thanks to Guillaume Colin - * de Verdiere for finding this one! - * - * Raymond Lu, 2006-03-13 - * Added support for VAX floating-point types. *------------------------------------------------------------------------- */ herr_t @@ -4721,16 +4625,6 @@ done: * Programmer: Robb Matzke * Friday, August 7, 1998 * - * Modifications: - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. - * - * Raymond Lu, 8 November 2011 - * I put a condition check to prevent the conversion of strings - * between ASCII and UTF8. *------------------------------------------------------------------------- */ herr_t @@ -4977,8 +4871,6 @@ done: * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5001,8 +4893,6 @@ H5T__conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5025,8 +4915,6 @@ H5T__conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5049,8 +4937,6 @@ H5T__conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5073,8 +4959,6 @@ H5T__conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5097,8 +4981,6 @@ H5T__conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5121,8 +5003,6 @@ H5T__conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5145,8 +5025,6 @@ H5T__conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5169,8 +5047,6 @@ H5T__conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5193,8 +5069,6 @@ H5T__conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5217,8 +5091,6 @@ H5T__conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5241,8 +5113,6 @@ H5T__conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5265,8 +5135,6 @@ H5T__conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5289,8 +5157,6 @@ H5T__conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5313,8 +5179,6 @@ H5T__conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5337,8 +5201,6 @@ H5T__conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5361,8 +5223,6 @@ H5T__conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5385,8 +5245,6 @@ H5T__conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5409,8 +5267,6 @@ H5T__conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5433,8 +5289,6 @@ H5T__conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5457,8 +5311,6 @@ H5T__conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5481,8 +5333,6 @@ H5T__conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5505,8 +5355,6 @@ H5T__conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5529,8 +5377,6 @@ H5T__conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5553,8 +5399,6 @@ H5T__conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5577,8 +5421,6 @@ H5T__conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5601,8 +5443,6 @@ H5T__conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5625,8 +5465,6 @@ H5T__conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5649,8 +5487,6 @@ H5T__conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5673,8 +5509,6 @@ H5T__conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5697,8 +5531,6 @@ H5T__conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5721,8 +5553,6 @@ H5T__conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5745,8 +5575,6 @@ H5T__conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5769,8 +5597,6 @@ H5T__conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5793,8 +5619,6 @@ H5T__conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5817,8 +5641,6 @@ H5T__conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5841,8 +5663,6 @@ H5T__conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5865,8 +5685,6 @@ H5T__conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5889,8 +5707,6 @@ H5T__conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5913,8 +5729,6 @@ H5T__conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5937,8 +5751,6 @@ H5T__conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5961,8 +5773,6 @@ H5T__conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -5985,8 +5795,6 @@ H5T__conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6009,8 +5817,6 @@ H5T__conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6033,8 +5839,6 @@ H5T__conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6057,8 +5861,6 @@ H5T__conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6081,8 +5883,6 @@ H5T__conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6105,8 +5905,6 @@ H5T__conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6129,8 +5927,6 @@ H5T__conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6153,8 +5949,6 @@ H5T__conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6177,8 +5971,6 @@ H5T__conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6201,8 +5993,6 @@ H5T__conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6225,8 +6015,6 @@ H5T__conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6249,8 +6037,6 @@ H5T__conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6273,8 +6059,6 @@ H5T__conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6297,8 +6081,6 @@ H5T__conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6321,8 +6103,6 @@ H5T__conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6345,8 +6125,6 @@ H5T__conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6369,8 +6147,6 @@ H5T__conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6393,8 +6169,6 @@ H5T__conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6417,8 +6191,6 @@ H5T__conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6441,8 +6213,6 @@ H5T__conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6465,8 +6235,6 @@ H5T__conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6489,8 +6257,6 @@ H5T__conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6513,8 +6279,6 @@ H5T__conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6537,8 +6301,6 @@ H5T__conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6561,8 +6323,6 @@ H5T__conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6585,8 +6345,6 @@ H5T__conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6609,8 +6367,6 @@ H5T__conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6633,8 +6389,6 @@ H5T__conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6657,8 +6411,6 @@ H5T__conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6681,8 +6433,6 @@ H5T__conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6705,8 +6455,6 @@ H5T__conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6729,8 +6477,6 @@ H5T__conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6753,8 +6499,6 @@ H5T__conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6777,8 +6521,6 @@ H5T__conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6801,8 +6543,6 @@ H5T__conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6825,8 +6565,6 @@ H5T__conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6849,8 +6587,6 @@ H5T__conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6873,8 +6609,6 @@ H5T__conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6897,8 +6631,6 @@ H5T__conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6921,8 +6653,6 @@ H5T__conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6945,8 +6675,6 @@ H5T__conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6969,8 +6697,6 @@ H5T__conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -6993,8 +6719,6 @@ H5T__conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7017,8 +6741,6 @@ H5T__conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7041,8 +6763,6 @@ H5T__conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7065,8 +6785,6 @@ H5T__conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Robb Matzke * Friday, November 13, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7089,8 +6807,6 @@ H5T__conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7113,8 +6829,6 @@ H5T__conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Monday, November 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7136,12 +6850,6 @@ H5T__conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Robb Matzke * Tuesday, June 23, 1998 * - * Modifications: - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. *------------------------------------------------------------------------- */ herr_t @@ -7163,8 +6871,6 @@ H5T__conv_float_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Friday, Feb 25, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ #if H5_SIZEOF_LONG_DOUBLE != 0 @@ -7188,15 +6894,6 @@ H5T__conv_float_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Robb Matzke * Tuesday, June 23, 1998 * - * Modifications: - * Robb Matzke, 7 Jul 1998 - * Added overflow handling. - * - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. *------------------------------------------------------------------------- */ herr_t @@ -7218,8 +6915,6 @@ H5T__conv_double_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Friday, Feb 25, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ #if H5_SIZEOF_LONG_DOUBLE != 0 @@ -7243,8 +6938,6 @@ H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * Programmer: Raymond Lu * Friday, Feb 25, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ #if H5_SIZEOF_LONG_DOUBLE != 0 @@ -7268,8 +6961,6 @@ H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Friday, Feb 25, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ #if H5_SIZEOF_LONG_DOUBLE != 0 @@ -7293,8 +6984,6 @@ H5T__conv_ldouble_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7316,8 +7005,6 @@ H5T__conv_schar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7339,8 +7026,6 @@ H5T__conv_schar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7362,8 +7047,6 @@ H5T__conv_schar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7385,8 +7068,6 @@ H5T__conv_uchar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7408,8 +7089,6 @@ H5T__conv_uchar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7431,8 +7110,6 @@ H5T__conv_uchar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7454,8 +7131,6 @@ H5T__conv_short_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7477,8 +7152,6 @@ H5T__conv_short_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7500,8 +7173,6 @@ H5T__conv_short_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7523,8 +7194,6 @@ H5T__conv_ushort_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7546,8 +7215,6 @@ H5T__conv_ushort_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7569,8 +7236,6 @@ H5T__conv_ushort_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7592,8 +7257,6 @@ H5T__conv_int_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7615,8 +7278,6 @@ H5T__conv_int_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7638,8 +7299,6 @@ H5T__conv_int_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7661,8 +7320,6 @@ H5T__conv_uint_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7684,8 +7341,6 @@ H5T__conv_uint_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7707,8 +7362,6 @@ H5T__conv_uint_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7730,8 +7383,6 @@ H5T__conv_long_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7753,8 +7404,6 @@ H5T__conv_long_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7776,8 +7425,6 @@ H5T__conv_long_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7799,8 +7446,6 @@ H5T__conv_ulong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7822,8 +7467,6 @@ H5T__conv_ulong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7845,8 +7488,6 @@ H5T__conv_ulong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7868,8 +7509,6 @@ H5T__conv_llong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7891,8 +7530,6 @@ H5T__conv_llong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ #if H5T_CONV_INTERNAL_LLONG_LDOUBLE @@ -7916,8 +7553,6 @@ H5T__conv_llong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7939,8 +7574,6 @@ H5T__conv_ullong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -7962,8 +7595,6 @@ H5T__conv_ullong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * Programmer: Raymond Lu * Tuesday, Febuary 1, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ #if H5T_CONV_INTERNAL_ULLONG_LDOUBLE @@ -7987,8 +7618,6 @@ H5T__conv_ullong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -8012,8 +7641,6 @@ H5T__conv_float_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -8313,8 +7940,6 @@ H5T__conv_float_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Programmer: Raymond Lu * Friday, November 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -9322,16 +8947,6 @@ done: * Programmer: Raymond Lu * Friday, Feb 6, 2004 * - * Modifications: - * - * 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 @@ -9765,11 +9380,6 @@ done: * Programmer: Raymond Lu * April 26, 2004 * - * Modifications: - * - * Raymond Lu - * March 13, 2006 - * Add support for VAX floating-point types. *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Tcset.c b/src/H5Tcset.c index f9e0540..259e7af 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -61,10 +61,6 @@ H5T_init_cset_interface(void) * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. - * *------------------------------------------------------------------------- */ H5T_cset_t @@ -107,10 +103,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived data types. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 11268c4..25fa808 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Tdbg.c - * Jul 19 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Tdbg.c + * Jul 19 2007 + * Quincey Koziol * - * Purpose: Dump debugging information about a datatype + * Purpose: Dump debugging information about a datatype * *------------------------------------------------------------------------- */ @@ -31,9 +31,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Tpkg.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ /* Local Macros */ @@ -64,28 +64,21 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5T__print_stats + * Function: H5T__print_stats * - * Purpose: Print statistics about a conversion path. Statistics are - * printed only if all the following conditions are true: + * Purpose: Print statistics about a conversion path. Statistics are + * printed only if all the following conditions are true: * - * 1. The library was compiled with H5T_DEBUG defined. - * 2. Data type debugging is turned on at run time. - * 3. The path was called at least one time. + * 1. The library was compiled with H5T_DEBUG defined. + * 2. Data type debugging is turned on at run time. + * 3. The path was called at least one time. * - * The optional NPRINT argument keeps track of the number of - * conversions paths for which statistics have been shown. If - * its value is zero then table headers are printed before the - * first line of output. + * The optional NPRINT argument keeps track of the number of + * conversions paths for which statistics have been shown. If + * its value is zero then table headers are printed before the + * first line of output. * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Robb Matzke - * Monday, December 14, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -107,7 +100,8 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i "User", "System", "Elapsed", "Bandwidth"); HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", "----------", "-----", "-----", "----", "------", "-------", "---------"); - } + } /* end if */ + if (path->src && path->dst) nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst)); else if (path->src) @@ -116,6 +110,7 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i nbytes = H5T_get_size(path->dst); else nbytes = 0; + nbytes *= path->stats.nelmts; H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", path->name, path->stats.nelmts, @@ -123,27 +118,24 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i path->stats.timer.etime, bandwidth); } #endif + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T__print_stats() */ /*------------------------------------------------------------------------- - * Function: H5T_debug - * - * Purpose: Prints information about a data type. + * Function: H5T_debug * - * Return: Non-negative on success/Negative on failure + * Purpose: Prints information about a data type. * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5T_debug(const H5T_t *dt, FILE *stream) { - const char *s1 = "", *s2 = ""; + const char *s1 = ""; + const char *s2 = ""; unsigned i; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -254,6 +246,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) HDfprintf(stream, ", offset=%lu", (unsigned long)(dt->shared->u.atomic.offset)); if (dt->shared->u.atomic.prec != 8 * dt->shared->size) HDfprintf(stream, ", prec=%lu", (unsigned long)(dt->shared->u.atomic.prec)); + switch (dt->shared->type) { case H5T_INTEGER: switch (dt->shared->u.atomic.u.i.sign) { diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 1a49fef..073753e 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Tdeprec.c * April 5 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Deprecated functions from the H5T interface. These * functions are here for compatibility purposes and may be @@ -169,7 +169,7 @@ done: * * Return: Success: Object ID of the named datatype. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Monday, June 1, 1998 @@ -187,16 +187,16 @@ H5Topen1(hid_t loc_id, const char *name) H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; - 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") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; @@ -208,25 +208,25 @@ H5Topen1(hid_t loc_id, const char *name) * from it. */ if (H5G_loc_find(&loc, name, &type_loc /*out*/, H5P_DEFAULT, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, H5I_INVALID_HID, "not found") obj_found = TRUE; /* Check that the object found is the correct type */ if (H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object type") if (obj_type != H5O_TYPE_NAMED_DATATYPE) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "not a named datatype") /* Open it */ if ((type = H5T_open(&type_loc, dxpl_id)) == NULL) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ if ((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: - if (ret_value < 0) { + if (H5I_INVALID_HID == ret_value) { if (type != NULL) H5T_close(type); else { diff --git a/src/H5Tenum.c b/src/H5Tenum.c index 115e56d..d70c004 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -65,8 +65,6 @@ H5T_init_enum_interface(void) * Programmer: Robb Matzke * Tuesday, December 22, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t @@ -76,24 +74,25 @@ H5Tenum_create(hid_t parent_id) H5T_t *dt = NULL; /*new enumeration data type */ hid_t ret_value; /*return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", parent_id); /* Check args */ if (NULL == (parent = (H5T_t *)H5I_object_verify(parent_id, H5I_DATATYPE)) || H5T_INTEGER != parent->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an integer data type") /* Build new type */ if (NULL == (dt = H5T__enum_create(parent))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot create enum type") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "cannot create enum type") + /* Atomize the type */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type atom") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tenum_create() */ /*------------------------------------------------------------------------- * Function: H5T__enum_create @@ -109,14 +108,12 @@ done: * Programmer: Raymond Lu * October 9, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_t * H5T__enum_create(const H5T_t *parent) { - H5T_t *ret_value; /*new enumeration data type */ + H5T_t *ret_value = NULL; /* New enumeration data type */ FUNC_ENTER_PACKAGE @@ -151,8 +148,6 @@ done: * Programmer: Robb Matzke * Wednesday, December 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -197,8 +192,6 @@ done: * Programmer: Robb Matzke * Wednesday, December 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -260,8 +253,6 @@ done: * Programmer: Robb Matzke * Wednesday, December 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -302,8 +293,6 @@ done: * Programmer: Raymond Lu * October 9, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -337,8 +326,6 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value /*out*/) * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -388,11 +375,6 @@ done: * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * Raymond Lu - * Wednesday, Febuary 9, 2005 - * Made a copy of original datatype and do sorting and search - * on that copy, to protect the original order of members. *------------------------------------------------------------------------- */ static char * @@ -402,7 +384,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name /*out*/, size_t s unsigned lt, md = 0, rt; /* Indices for binary search */ int cmp = (-1); /* Comparison result */ hbool_t alloc_name = FALSE; /* Whether name has been allocated */ - char * ret_value; /* Return value */ + char * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -481,11 +463,6 @@ done: * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * Raymond Lu - * Wednesday, Febuary 9, 2005 - * Made a copy of original datatype and do sorting and search - * on that copy, to protect the original order of members. *------------------------------------------------------------------------- */ herr_t @@ -529,11 +506,6 @@ done: * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * Raymond Lu - * Wednesday, Febuary 9, 2005 - * Made a copy of original datatype and do sorting and search - * on that copy, to protect the original order of members. *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Tfields.c b/src/H5Tfields.c index 2453e2a..e67c617 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -63,9 +63,6 @@ H5T_init_fields_interface(void) * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with enumeration datatypes. *------------------------------------------------------------------------- */ int @@ -104,14 +101,12 @@ done: * Programmer: Raymond Lu * October 8, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5T_get_nmembers(const H5T_t *dt) { - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -144,9 +139,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with enumeration datatypes. *------------------------------------------------------------------------- */ char * @@ -185,13 +177,12 @@ done: * Programmer: Raymond Lu * October 9, 2002 * - * Modifications: *------------------------------------------------------------------------- */ char * H5T__get_member_name(H5T_t const *dt, unsigned membno) { - char *ret_value; + char *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -243,8 +234,6 @@ done: * Programmer: Raymond Lu * Thursday, April 4, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -413,8 +402,6 @@ H5T__sort_value(const H5T_t *dt, int *map) * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c index 3d6e448..28f7616 100644 --- a/src/H5Tfixed.c +++ b/src/H5Tfixed.c @@ -59,9 +59,6 @@ H5T_init_fixed_interface(void) * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. *------------------------------------------------------------------------- */ H5T_sign_t @@ -96,8 +93,6 @@ done: * Programmer: Raymond Lu * October 8, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_sign_t @@ -134,10 +129,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c index cb470c3..1e8feae 100644 --- a/src/H5Tfloat.c +++ b/src/H5Tfloat.c @@ -211,10 +211,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 9a53557..afbb7df 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -99,32 +99,33 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction) size_t comp_size = 0; /* Compound datatype's size */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "iTd", type_id, direction); - /* check argument */ + /* Check arguments */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") - + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a data type") if (direction != H5T_DIR_DEFAULT && direction != H5T_DIR_ASCEND && direction != H5T_DIR_DESCEND) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not valid direction value") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not valid direction value") + /* Get the native type */ if ((new_dt = H5T_get_native_type(dt, direction, NULL, NULL, &comp_size)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot retrieve native type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "cannot retrieve native type") + /* Get an ID for the new type */ if ((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type") done: /* Error cleanup */ - if (ret_value < 0) { + if (H5I_INVALID_HID == ret_value) { if (new_dt) if (H5T_close(new_dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") } /* end if */ FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_native_type() */ /*------------------------------------------------------------------------- * Function: H5T_get_native_type @@ -163,7 +164,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig int snmemb; /* Number of members in compound & enum types */ unsigned nmemb = 0; /* Number of members in compound & enum types */ unsigned u; /* Local index variable */ - H5T_t * ret_value; /* Return value */ + H5T_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -945,7 +946,7 @@ H5_GCC_DIAG_ON("duplicated-branches") * * Return: Success: Non-negative value. * - * Failure: Negative value. + * Failure: Negative value. * * Programmer: Raymond Lu * December 10, 2002 diff --git a/src/H5Toffset.c b/src/H5Toffset.c index c26cf6c..4e18249 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -54,12 +54,12 @@ H5T_init_offset_interface(void) * Function: H5Tget_offset * * Purpose: Retrieves the bit offset of the first significant bit. The - * signficant bits of an atomic datum can be offset from the + * significant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be layed out in memory as (from + * the value 0x1122 then it will be laid out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little @@ -104,12 +104,12 @@ done: * Function: H5T_get_offset * * Purpose: Retrieves the bit offset of the first significant bit. The - * signficant bits of an atomic datum can be offset from the + * significant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be layed out in memory as (from + * the value 0x1122 then it will be laid out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little @@ -132,7 +132,7 @@ done: int H5T_get_offset(const H5T_t *dt) { - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(-1) @@ -153,12 +153,12 @@ done: * Function: H5Tset_offset * * Purpose: Sets the bit offset of the first significant bit. The - * signficant bits of an atomic datum can be offset from the + * significant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be layed out in memory as (from + * the value 0x1122 then it will be laid out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little @@ -182,10 +182,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Moved real work to a private function. - * *------------------------------------------------------------------------- */ herr_t @@ -222,12 +218,12 @@ done: * Function: H5T_set_offset * * Purpose: Sets the bit offset of the first significant bit. The - * signficant bits of an atomic datum can be offset from the + * significant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be layed out in memory as (from + * the value 0x1122 then it will be laid out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little @@ -251,10 +247,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Toh.c b/src/H5Toh.c index 2772c79..9096b13 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -90,7 +90,7 @@ const H5O_obj_class_t H5O_OBJ_DATATYPE[1] = {{ static htri_t H5O_dtype_isa(struct H5O_t *oh) { - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -119,8 +119,8 @@ done: static hid_t H5O_dtype_open(const H5G_loc_t *obj_loc, hid_t H5_ATTR_UNUSED lapl_id, hid_t dxpl_id, hbool_t app_ref) { - H5T_t *type = NULL; /* Datatype opened */ - hid_t ret_value; /* Return value */ + H5T_t *type = NULL; /* Datatype opened */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -158,8 +158,8 @@ done: static void * H5O_dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) { - H5T_obj_create_t *crt_info = (H5T_obj_create_t *)_crt_info; /* Named datatype creation parameters */ - void * ret_value; /* Return value */ + H5T_obj_create_t *crt_info = (H5T_obj_create_t *)_crt_info; /* Named datatype creation parameters */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -201,8 +201,8 @@ done: static H5O_loc_t * H5O_dtype_get_oloc(hid_t obj_id) { - H5T_t * type; /* Datatype opened */ - H5O_loc_t *ret_value; /* Return value */ + H5T_t * type = NULL; /* Datatype opened */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Topaque.c b/src/H5Topaque.c index 2243900..d0bb53b 100644 --- a/src/H5Topaque.c +++ b/src/H5Topaque.c @@ -58,8 +58,6 @@ H5T_init_opaque_interface(void) * Programmer: Robb Matzke * Thursday, May 20, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -104,8 +102,6 @@ done: * Programmer: Robb Matzke * Thursday, May 20, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ char * diff --git a/src/H5Torder.c b/src/H5Torder.c index bb7ff99..6a6424c 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -116,7 +116,7 @@ H5Tget_order(hid_t type_id) /* Get order */ if (H5T_ORDER_ERROR == (ret_value = H5T_get_order(dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "cant't get order for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "can't get order for specified datatype") done: FUNC_LEAVE_API(ret_value) @@ -210,7 +210,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) diff --git a/src/H5Tpad.c b/src/H5Tpad.c index 923a4ae..c592b72 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -59,10 +59,6 @@ H5T_init_pad_interface(void) * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived data types. - * *------------------------------------------------------------------------- */ herr_t @@ -102,10 +98,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived data types. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index d96d809..d170a81 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Monday, December 8, 1997 * * Purpose: This file contains declarations which are visible only within @@ -161,36 +161,36 @@ struct H5T_path_t { }; typedef struct H5T_atomic_t { - H5T_order_t order; /*byte order */ - size_t prec; /*precision in bits */ - size_t offset; /*bit position of lsb of value */ - H5T_pad_t lsb_pad; /*type of lsb padding */ - H5T_pad_t msb_pad; /*type of msb padding */ + H5T_order_t order; /* byte order */ + size_t prec; /* precision in bits */ + size_t offset; /* bit position of lsb of value */ + H5T_pad_t lsb_pad; /* type of lsb padding */ + H5T_pad_t msb_pad; /* type of msb padding */ union { struct { - H5T_sign_t sign; /*type of integer sign */ - } i; /*integer; integer types */ + H5T_sign_t sign; /* type of integer sign */ + } i; /* integer; integer types */ struct { - size_t sign; /*bit position of sign bit */ - size_t epos; /*position of lsb of exponent */ - size_t esize; /*size of exponent in bits */ - uint64_t ebias; /*exponent bias */ - size_t mpos; /*position of lsb of mantissa */ - size_t msize; /*size of mantissa */ - H5T_norm_t norm; /*normalization */ - H5T_pad_t pad; /*type of padding for internal bits */ - } f; /*floating-point types */ + size_t sign; /* bit position of sign bit */ + size_t epos; /* position of lsb of exponent */ + size_t esize; /* size of exponent in bits */ + uint64_t ebias; /* exponent bias */ + size_t mpos; /* position of lsb of mantissa */ + size_t msize; /* size of mantissa */ + H5T_norm_t norm; /* normalization */ + H5T_pad_t pad; /* type of padding for internal bits */ + } f; /* floating-point types */ struct { - H5T_cset_t cset; /*character set */ - H5T_str_t pad; /*space or null padding of extra bytes */ - } s; /*string types */ + H5T_cset_t cset; /* character set */ + H5T_str_t pad; /* space or null padding of extra bytes */ + } s; /* string types */ struct { - H5R_type_t rtype; /*type of reference stored */ - H5T_loc_t loc; /* Location of data in buffer */ - } r; /*reference types */ + H5R_type_t rtype; /* type of reference stored */ + H5T_loc_t loc; /* location of data in buffer */ + } r; /* reference types */ } u; } H5T_atomic_t; @@ -249,8 +249,8 @@ typedef enum { typedef struct H5T_vlen_t { H5T_vlen_type_t type; /* Type of VL data in buffer */ H5T_loc_t loc; /* Location of VL data in buffer */ - H5T_cset_t cset; /* For VL string. character set */ - H5T_str_t pad; /* For VL string. space or null padding of + H5T_cset_t cset; /* For VL string: character set */ + H5T_str_t pad; /* For VL string: space or null padding of * extra bytes */ H5F_t * f; /* File ID (if VL data is on disk) */ H5T_vlen_getptrfunc_t getptr; /* Function to get VL sequence pointer */ diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index 2319d83..c960696 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -66,10 +66,6 @@ H5T_init_precis_interface(void) * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ size_t @@ -113,7 +109,7 @@ done: size_t H5T_get_precision(const H5T_t *dt) { - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -153,10 +149,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Moved real work to a private function. - * *------------------------------------------------------------------------- */ herr_t @@ -213,10 +205,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index a996169..7e807a4 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -24,9 +24,9 @@ #include "H5MMpublic.h" /* Memory management */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Rprivate.h" /* References */ +#include "H5private.h" /* Generic Functions */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Rprivate.h" /* References */ /* Macro for size of temporary buffers to contain a single element */ #define H5T_ELEM_BUF_SIZE 256 @@ -94,7 +94,7 @@ typedef struct H5T_subset_info_t { /* Forward declarations for prototype arguments */ struct H5O_t; -/* The native endianess of the platform */ +/* The native endianness of the platform */ H5_DLLVAR H5T_order_t H5T_native_order_g; /* Private functions */ diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c index 119e390..efbf6ee 100644 --- a/src/H5Tstrpad.c +++ b/src/H5Tstrpad.c @@ -62,10 +62,6 @@ H5T_init_strpad_interface(void) * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ H5T_str_t @@ -118,10 +114,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tvisit.c b/src/H5Tvisit.c index 2a130df..9ff2cb3 100644 --- a/src/H5Tvisit.c +++ b/src/H5Tvisit.c @@ -22,7 +22,7 @@ * * Created: H5Tvisit.c * Jul 19 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Visit all the components of a datatype * diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 5c08130..50f721a 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -140,8 +140,8 @@ done: H5T_t * H5T__vlen_create(const H5T_t *base) { - H5T_t *dt = NULL; /*new VL datatype */ - H5T_t *ret_value; /*return value */ + H5T_t *dt = NULL; /* New VL datatype */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -219,7 +219,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.vlen.loc = H5T_LOC_MEMORY; if (dt->shared->u.vlen.type == H5T_VLEN_SEQUENCE) { - /* size in memory, disk size is different */ + /* Size in memory, disk size is different */ dt->shared->size = sizeof(hvl_t); /* Set up the function pointers to access the VL sequence in memory */ @@ -229,9 +229,9 @@ 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 */ + /* Size in memory, disk size is different */ dt->shared->size = sizeof(char *); /* Set up the function pointers to access the VL string in memory */ @@ -241,12 +241,11 @@ 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; - } - else { + } /* end else-if */ + else HDassert(0 && "Invalid VL type"); - } - /* Reset file ID (since this VL is in memory) */ + /* Reset file pointer (since this VL is in memory) */ dt->shared->u.vlen.f = NULL; break; @@ -317,7 +316,7 @@ H5T_vlen_seq_mem_getlen(const void *_vl) FUNC_ENTER_NOAPI_NOINIT_NOERR - /* check parameters, return result */ + /* Check parameters, return result */ #ifdef H5_NO_ALIGNMENT_RESTRICTIONS HDassert(vl); @@ -378,7 +377,6 @@ H5T_vlen_seq_mem_getptr(void *_vl) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static htri_t H5T_vlen_seq_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) { @@ -415,7 +413,6 @@ H5T_vlen_seq_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_seq_mem_read(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, void *_vl, void *buf, size_t len) { @@ -456,7 +453,6 @@ H5T_vlen_seq_mem_read(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, voi * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, @@ -514,7 +510,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_seq_mem_setnull(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, void *_vl, void H5_ATTR_UNUSED *_bg) @@ -616,7 +611,6 @@ H5T_vlen_str_mem_getptr(void *_vl) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static htri_t H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) { @@ -647,7 +641,6 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, void *_vl, void *buf, size_t len) { @@ -687,7 +680,6 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, voi * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, @@ -712,6 +704,7 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end else */ + /* 'write' the string into the buffer, with memcpy() */ len = (seq_len * base_size); HDmemcpy(t, buf, len); t[len] = '\0'; @@ -735,7 +728,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, void *_vl, void H5_ATTR_UNUSED *_bg) @@ -747,7 +739,7 @@ H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, /* Set pointer in user's buffer with memcpy, to avoid alignment issues */ HDmemcpy(_vl, &t, sizeof(char *)); - FUNC_LEAVE_NOAPI(SUCCEED) /*lint !e429 The pointer in 't' has been copied */ + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T_vlen_str_mem_setnull() */ /*------------------------------------------------------------------------- @@ -765,12 +757,12 @@ H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, static ssize_t H5T_vlen_disk_getlen(const void *_vl) { - const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the disk VL information */ - size_t seq_len; /* Sequence length */ + const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the disk VL information */ + size_t seq_len = 0; /* Sequence length */ FUNC_ENTER_NOAPI_NOINIT_NOERR - /* check parameters */ + /* Check parameters */ HDassert(vl); UINT32DECODE(vl, seq_len); @@ -790,13 +782,12 @@ H5T_vlen_disk_getlen(const void *_vl) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static void * H5T_vlen_disk_getptr(void H5_ATTR_UNUSED *vl) { FUNC_ENTER_NOAPI_NOINIT_NOERR - /* check parameters */ + /* Check parameters */ HDassert(vl); FUNC_LEAVE_NOAPI(NULL) @@ -846,7 +837,6 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl) * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) { @@ -856,7 +846,7 @@ H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t H5_ATTR FUNC_ENTER_NOAPI_NOINIT - /* check parameters */ + /* Check parameters */ HDassert(vl); HDassert(buf); HDassert(f); @@ -869,11 +859,10 @@ H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t H5_ATTR 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 (H5HG_read(f, dxpl_id, &hobjid, buf, NULL) == NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information") - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -891,7 +880,6 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size) @@ -921,12 +909,11 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t H5_ATTR 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, dxpl_id, &bg_hobjid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") - } /* end if */ - } /* end if */ + } /* end if */ /* Set the length of the sequence */ UINT32ENCODE(vl, seq_len); @@ -966,7 +953,7 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg) FUNC_ENTER_NOAPI_NOINIT - /* check parameters */ + /* Check parameters */ HDassert(f); HDassert(vl); @@ -1043,7 +1030,7 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi for (u = 0; u < dt->shared->u.array.nelem; u++) { off = ((uint8_t *)elem) + u * (dt->shared->parent->shared->size); if (H5T_vlen_reclaim_recurse(off, dt->shared->parent, free_func, free_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free array element") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free array element") } /* end for */ } /* end if */ break; @@ -1059,7 +1046,7 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi off = ((uint8_t *)elem) + dt->shared->u.compnd.memb[u].offset; if (H5T_vlen_reclaim_recurse(off, dt->shared->u.compnd.memb[u].type, free_func, free_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free compound field") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free compound field") } /* end if */ } /* end for */ break; @@ -1079,7 +1066,7 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi while (vl->len > 0) { off = ((uint8_t *)vl->p) + (vl->len - 1) * dt->shared->parent->shared->size; if (H5T_vlen_reclaim_recurse(off, dt->shared->parent, free_func, free_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free VL element") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free VL element") vl->len--; } /* end while */ } /* end if */ @@ -1105,6 +1092,7 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi default: break; + } /* end switch */ /*lint !e788 All appropriate cases are covered */ done: @@ -1135,7 +1123,6 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -/* ARGSUSED */ herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, void *op_data) @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Friday, October 10, 1997 */ @@ -57,8 +57,6 @@ static void H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -101,11 +99,6 @@ H5VM_stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, co * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * *------------------------------------------------------------------------- */ static void @@ -236,11 +229,6 @@ H5VM_stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, co * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * *------------------------------------------------------------------------- */ hsize_t @@ -337,8 +325,6 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co * Programmer: Robb Matzke * Friday, October 17, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -435,8 +421,6 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -507,11 +491,6 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * *------------------------------------------------------------------------- */ herr_t @@ -673,8 +652,6 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -732,8 +709,6 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -800,8 +775,6 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -866,8 +839,6 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -939,8 +910,6 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, * Programmer: Quincey Koziol * Thursday, June 18, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -994,8 +963,6 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) * Programmer: Quincey Koziol * Monday, April 28, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1036,11 +1003,6 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) * Programmer: Quincey Koziol * Tuesday, June 22, 1999 * - * Modifications: - * Use precomputed accumulator array - * Quincey Koziol - * Saturday, April 26, 2003 - * *------------------------------------------------------------------------- */ hsize_t @@ -1078,8 +1040,6 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) * Programmer: Quincey Koziol * Tuesday, June 22, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hsize_t @@ -1159,8 +1119,6 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co * Programmer: Quincey Koziol * Wednesday, April 16, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1221,13 +1179,11 @@ done: * The chunk index is placed in the CHUNK_IDX location for return * from this function * - * Return: Non-negative on success/Negative on failure + * Return: Chunk index on success (can't fail) * * Programmer: Quincey Koziol * Monday, April 21, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1464,7 +1420,7 @@ done: * * Purpose: Given source and destination buffers in memory (SRC & DST) * copy sequences of from the source buffer into the destination - * buffer. Each set of sequnces has an array of lengths, an + * buffer. Each set of sequences has an array of lengths, an * array of offsets, the maximum number of sequences and the * current sequence to start at in the sequence. * diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 48422b3..ab3bd21 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -92,6 +92,10 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s * elements in an array and array dimensions are always of type * size_t. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: Product of elements * * Failure: 1 if N is zero @@ -99,8 +103,6 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE hsize_t H5_ATTR_UNUSED @@ -125,6 +127,10 @@ done: * * Purpose: Determines if all elements of a vector are zero. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: TRUE if all elements are zero, * FALSE otherwise * @@ -133,8 +139,6 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE htri_t H5_ATTR_UNUSED @@ -160,6 +164,10 @@ done: * * Purpose: Determines if all elements of a vector are zero. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: TRUE if all elements are zero, * FALSE otherwise * @@ -168,8 +176,6 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE htri_t H5_ATTR_UNUSED @@ -196,6 +202,10 @@ done: * Purpose: Compares two vectors of the same size and determines if V1 is * lexicographically less than, equal, or greater than V2. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: -1 if V1 is less than V2 * 0 if they are equal * 1 if V1 is greater than V2 @@ -205,8 +215,6 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE int H5_ATTR_UNUSED @@ -242,6 +250,10 @@ done: * Purpose: Compares two vectors of the same size and determines if V1 is * lexicographically less than, equal, or greater than V2. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: -1 if V1 is less than V2 * 0 if they are equal * 1 if V1 is greater than V2 @@ -251,8 +263,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 8, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE int H5_ATTR_UNUSED @@ -287,13 +297,15 @@ done: * * Purpose: Increments V1 by V2 * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: void * * Programmer: Robb Matzke * Monday, October 13, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE void H5_ATTR_UNUSED @@ -329,6 +341,10 @@ static const unsigned char LogTable256[] = { * The version on the web-site is for 32-bit quantities and this * version has been extended for 64-bit quantities. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: log2(n) (always - no failure condition) * * Programmer: Quincey Koziol @@ -374,6 +390,10 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14, * This is from the "Bit Twiddling Hacks" at: * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: log2(n) (always - no failure condition) * * Programmer: Quincey Koziol @@ -396,6 +416,10 @@ H5VM_log2_of2(uint32_t n) * Purpose: Determine the # of bytes needed to encode values within a * range from 0 to a given limit * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Number of bytes needed * * Programmer: Quincey Koziol @@ -417,13 +441,17 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, * * Purpose: Determine the value of the n'th bit in a buffer. * - * Note: No range checking on <offset> is performed! + * Note: No range checking on <offset> is performed! * - * Note #2: Bits are sequentially stored in the buffer, starting with bit + * Note #2: Bits are sequentially stored in the buffer, starting with bit * offset 0 in the first byte's high-bit position, proceeding down * to bit offset 7 in the first byte's low-bit position, then to * bit offset 8 in the second byte's high-bit position, etc. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: TRUE/FALSE * * Programmer: Quincey Koziol @@ -443,13 +471,17 @@ H5VM_bit_get(const unsigned char *buf, size_t offset) * * Purpose: Set/reset the n'th bit in a buffer. * - * Note: No range checking on <offset> is performed! + * Note: No range checking on <offset> is performed! * - * Note #2: Bits are sequentially stored in the buffer, starting with bit + * Note #2: Bits are sequentially stored in the buffer, starting with bit * offset 0 in the first byte's high-bit position, proceeding down * to bit offset 7 in the first byte's low-bit position, then to * bit offset 8 in the second byte's high-bit position, etc. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: None * * Programmer: Quincey Koziol @@ -15,7 +15,7 @@ * * Created: H5WB.c * Jun 26 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Implements the "wrapped buffer" code for wrapping * an existing [staticly sized] buffer, in order to @@ -88,7 +88,6 @@ H5FL_BLK_DEFINE_STATIC(extra_buf); * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- @@ -141,7 +140,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- @@ -208,7 +206,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- @@ -245,7 +242,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- diff --git a/src/H5WBprivate.h b/src/H5WBprivate.h index 34077a6..6ab07f7 100644 --- a/src/H5WBprivate.h +++ b/src/H5WBprivate.h @@ -15,7 +15,7 @@ * * Created: H5WBprivate.h * Jun 26 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: Private header for library accessible wrapped buffer routines. * @@ -16,17 +16,17 @@ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5Z_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5PLprivate.h" /* Plugins */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5PLprivate.h" /* Plugins */ #include "H5Sprivate.h" /* Dataspace functions */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5Zpkg.h" /* Data filters */ #ifdef H5_HAVE_SZLIB_H #include "szlib.h" @@ -143,7 +143,7 @@ H5Z_term_interface(void) "Errors", "User", "System", "Elapsed", "Bandwidth"); HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----", "------", "----", "------", "-------", "---------"); - } + } /* end if */ /* Truncate the comment to fit in the field */ HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); @@ -257,7 +257,7 @@ done: * Function: H5Z_register * * Purpose: Same as the public version except this one allows filters - * to be set for predefined method numbers <H5Z_FILTER_RESERVED + * to be set for predefined method numbers < H5Z_FILTER_RESERVED * * Return: Non-negative on success * Negative on failure @@ -316,12 +316,12 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Zunregister + * Function: H5Zunregister * - * Purpose: This function unregisters a filter. + * Purpose: This function unregisters a filter. * - * Return: Non-negative on success - * Negative on failure + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -347,20 +347,20 @@ done: } /* end H5Zunregister() */ /*------------------------------------------------------------------------- - * Function: H5Z_unregister + * Function: H5Z_unregister * - * Purpose: Same as the public version except this one allows filters - * to be unset for predefined method numbers <H5Z_FILTER_RESERVED + * Purpose: Same as the public version except this one allows filters + * to be unset for predefined method numbers <H5Z_FILTER_RESERVED + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t H5Z_unregister(H5Z_filter_t filter_id) { - size_t filter_index; /* Local index variable for filter */ - H5Z_object_t object; + size_t filter_index; /* Local index variable for filter */ + H5Z_object_t object; /* Object to pass to callbacks */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -415,12 +415,14 @@ done: } /* end H5Z_unregister() */ /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister + * Function: H5Z__check_unregister + * + * Purpose: Check if an object uses the filter to be unregistered. * - * Purpose: Check if an object uses the filter to be unregistered. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE if not, NEGATIVE on error. *------------------------------------------------------------------------- */ static htri_t @@ -444,18 +446,16 @@ done: } /* end H5Z__check_unregister() */ /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_group_cb + * Function: H5Z__check_unregister_group_cb * - * Purpose: The callback function for H5Z_unregister. It iterates + * 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 otherwise. - * - * Programmer: Raymond Lu - * 6 May 2013 + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * *------------------------------------------------------------------------- */ @@ -485,7 +485,7 @@ H5Z__check_unregister_group_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) @@ -496,18 +496,16 @@ done: } /* end H5Z__check_unregister_group_cb() */ /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_dset_cb + * Function: H5Z__check_unregister_dset_cb * - * Purpose: The callback function for H5Z_unregister. It iterates + * 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 otherwise. - * - * Programmer: Raymond Lu - * 6 May 2013 + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * *------------------------------------------------------------------------- */ @@ -537,7 +535,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) @@ -548,17 +546,13 @@ done: } /* end H5Z__check_unregister_dset_cb() */ /*------------------------------------------------------------------------- - * Function: H5Z__flush_file_cb + * Function: H5Z__flush_file_cb * - * Purpose: The callback function for H5Z_unregister. It iterates + * 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 - * - * Programmer: Raymond Lu - * 6 May 2013 - * + * Return: NON-NEGATIVE if finishes flushing and moves on + * NEGATIVE if there is an error *------------------------------------------------------------------------- */ static int @@ -568,6 +562,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUS FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(obj_ptr); /* Call the flush routine for mounted file hierarchies. Do a global flush @@ -582,17 +577,11 @@ done: } /* end H5Z__flush_file_cb() */ /*------------------------------------------------------------------------- - * Function: H5Zfilter_avail - * - * Purpose: Check if a filter is available - * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, November 14, 2002 + * Function: H5Zfilter_avail * - * Modifications: + * Purpose: Check if a filter is available * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure *------------------------------------------------------------------------- */ htri_t @@ -615,15 +604,11 @@ done: } /* end H5Zfilter_avail() */ /*------------------------------------------------------------------------- - * Function: H5Z_filter_avail + * Function: H5Z_filter_avail * - * Purpose: Private function to check if a filter is available - * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure - * - * Programmer: Raymond Lu - * 13 February 2013 + * Purpose: Private function to check if a filter is available * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure *------------------------------------------------------------------------- */ htri_t @@ -650,21 +635,16 @@ done: } /* end H5Z_filter_avail() */ /*------------------------------------------------------------------------- - * Function: H5Z_prelude_callback - * - * Purpose: Makes a dataset creation "prelude" callback for the "can_apply" - * or "set_local" routines. - * - * Return: Non-negative on success/Negative on failure + * Function: H5Z_prelude_callback * - * Programmer: Quincey Koziol - * Friday, April 4, 2003 + * Purpose: Makes a dataset creation "prelude" callback for the "can_apply" + * or "set_local" routines. * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * Return: Non-negative on success/Negative on failure * + * Notes: The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ static herr_t @@ -736,21 +716,16 @@ done: } /* end H5Z_prelude_callback() */ /*------------------------------------------------------------------------- - * Function: H5Z_prepare_prelude_callback_dcpl - * - * Purpose: Prepares to make a dataset creation "prelude" callback - * for the "can_apply" or "set_local" routines. + * Function: H5Z_prepare_prelude_callback_dcpl * - * Return: Non-negative on success/Negative on failure + * Purpose: Prepares to make a dataset creation "prelude" callback + * for the "can_apply" or "set_local" routines. * - * Programmer: Quincey Koziol - * Friday, April 4, 2003 - * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * Return: Non-negative on success/Negative on failure * + * Notes: The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ static herr_t @@ -801,14 +776,14 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type 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") - } /* end if */ + } /* 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") - } /* end if */ - } /* end if */ - } /* end if */ + } + } + } done: if (space_id > 0 && H5I_dec_ref(space_id) < 0) @@ -818,22 +793,18 @@ done: } /* end H5Z_prepare_prelude_callback_dcpl() */ /*------------------------------------------------------------------------- - * Function: H5Z_can_apply - * - * Purpose: Checks if all the filters defined in the dataset creation - * property list can be applied to a particular combination of - * datatype and dataspace for a dataset. - * - * Return: Non-negative on success/Negative on failure + * Function: H5Z_can_apply * - * Programmer: Quincey Koziol - * Thursday, April 3, 2003 + * Purpose: Checks if all the filters defined in the dataset creation + * property list can be applied to a particular combination of + * datatype and dataspace for a dataset. * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * Return: Non-negative on success + * Negative on failure * + * Notes: The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ herr_t @@ -852,22 +823,18 @@ done: } /* end H5Z_can_apply() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_local - * - * Purpose: Makes callbacks to modify dataset creation list property - * settings for filters on a new dataset, based on the datatype - * and dataspace of that dataset (chunk). - * - * Return: Non-negative on success/Negative on failure + * Function: H5Z_set_local * - * Programmer: Quincey Koziol - * Friday, April 4, 2003 + * Purpose: Makes callbacks to modify dataset creation list property + * settings for filters on a new dataset, based on the datatype + * and dataspace of that dataset (chunk). * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * Return: Non-negative on success + * Negative on failure * + * Notes: The chunk dimensions are used to create a dataspace, instead + * of passing in the dataset's dataspace, since the chunk + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ herr_t @@ -886,17 +853,14 @@ done: } /* end H5Z_set_local() */ /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_direct - * - * Purpose: Checks if all the filters defined in the pipeline can be - * applied to an opaque byte stream (currently only a group). - * The pipeline is assumed to have at least one filter. - * - * Return: Non-negative on success/Negative on failure + * Function: H5Z_can_apply_direct * - * Programmer: Neil Fortner - * Tuesday, September 22, 2009 + * Purpose: Checks if all the filters defined in the pipeline can be + * applied to an opaque byte stream (currently only a group). + * The pipeline is assumed to have at least one filter. * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -917,22 +881,18 @@ done: } /* end H5Z_can_apply_direct() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_local_direct - * - * Purpose: Makes callbacks to modify local settings for filters on a - * new opaque object. The pipeline is assumed to have at - * least one filter. + * Function: H5Z_set_local_direct * - * Return: Non-negative on success/Negative on failure + * Purpose: Makes callbacks to modify local settings for filters on a + * new opaque object. The pipeline is assumed to have at + * least one filter. * - * Programmer: Neil Fortner - * Tuesday, September 22, 2009 - * - * Notes: - * This callback will almost certainly not do anything - * useful, other than to make certain that the filter will - * accept opque data. + * Return: Non-negative on success + * Negative on failure * + * Notes: This callback will almost certainly not do anything + * useful, other than to make certain that the filter will + * accept opaque data. *------------------------------------------------------------------------- */ herr_t @@ -953,17 +913,12 @@ done: } /* end H5Z_set_local_direct() */ /*------------------------------------------------------------------------- - * Function: H5Z_modify - * - * Purpose: Modify filter parameters for specified pipeline. + * Function: H5Z_modify * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * - * Modifications: + * Purpose: Modify filter parameters for specified pipeline. * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1022,17 +977,12 @@ done: } /* end H5Z_modify() */ /*------------------------------------------------------------------------- - * Function: H5Z_append - * - * Purpose: Append another filter to the specified pipeline. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, August 4, 1998 + * Function: H5Z_append * - * Modifications: + * Purpose: Append another filter to the specified pipeline. * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1125,19 +1075,13 @@ done: } /* end H5Z_append() */ /*------------------------------------------------------------------------- - * Function: H5Z_find_idx - * - * Purpose: Given a filter ID return the offset in the global array - * that holds all the registered filters. + * Function: H5Z__find_idx * - * Return: Success: Non-negative index of entry in global filter table. - * Failure: Negative - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * - * Modifications: + * Purpose: Given a filter ID return the offset in the global array + * that holds all the registered filters. * + * Return: Success: Non-negative index of entry in global filter table. + * Failure: Negative *------------------------------------------------------------------------- */ static int @@ -1157,21 +1101,13 @@ done: } /* end H5Z_find_idx() */ /*------------------------------------------------------------------------- - * Function: H5Z_find - * - * Purpose: Given a filter ID return a pointer to a global struct that - * defines the filter. - * - * Return: Success: Ptr to entry in global filter table. - * Failure: NULL + * Function: H5Z_find * - * Programmer: Robb Matzke - * Wednesday, August 5, 1998 - * - * Modifications: - * Use H5Z_find_idx now - * Quincey Koziol, April 5, 2003 + * Purpose: Given a filter ID return a pointer to a global struct that + * defines the filter. * + * Return: Success: Ptr to entry in global filter table. + * Failure: NULL *------------------------------------------------------------------------- */ H5Z_class2_t * @@ -1194,31 +1130,26 @@ done: } /* H5Z_find() */ /*------------------------------------------------------------------------- - * Function: H5Z_pipeline - * - * Purpose: Process data through the filter pipeline. The FLAGS argument - * is the filter invocation flags (definition flags come from - * the PLINE->filter[].flags). The filters are processed in - * definition order unless the H5Z_FLAG_REVERSE is set. The - * FILTER_MASK is a bit-mask to indicate which filters to skip - * and on exit will indicate which filters failed. Each - * filter has an index number in the pipeline and that index - * number is the filter's bit in the FILTER_MASK. NBYTES is the - * number of bytes of data to filter and on exit should be the - * number of resulting bytes while BUF_SIZE holds the total - * allocated size of the buffer, which is pointed to BUF. - * - * If the buffer must grow during processing of the pipeline - * then the pipeline function should free the original buffer - * and return a fresh buffer, adjusting BUF_SIZE accordingly. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, August 4, 1998 - * - * Modifications: + * Function: H5Z_pipeline + * + * Purpose: Process data through the filter pipeline. The FLAGS argument + * is the filter invocation flags (definition flags come from + * the PLINE->filter[].flags). The filters are processed in + * definition order unless the H5Z_FLAG_REVERSE is set. The + * FILTER_MASK is a bit-mask to indicate which filters to skip + * and on exit will indicate which filters failed. Each + * filter has an index number in the pipeline and that index + * number is the filter's bit in the FILTER_MASK. NBYTES is the + * number of bytes of data to filter and on exit should be the + * number of resulting bytes while BUF_SIZE holds the total + * allocated size of the buffer, which is pointed to BUF. + * + * If the buffer must grow during processing of the pipeline + * then the pipeline function should free the original buffer + * and return a fresh buffer, adjusting BUF_SIZE accordingly. * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1226,7 +1157,8 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i H5Z_cb_t cb_struct, size_t *nbytes /*in,out*/, size_t *buf_size /*in,out*/, void **buf /*in,out*/) { - size_t i, idx, new_nbytes; + size_t idx; + size_t new_nbytes; int fclass_idx; /* Index of filter class in global table */ H5Z_class2_t *fclass = NULL; /* Filter class pointer */ #ifdef H5Z_DEBUG @@ -1235,6 +1167,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i #endif unsigned failed = 0; unsigned tmp_flags; + size_t i; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1249,10 +1182,9 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */ for (i = pline->nused; i > 0; --i) { idx = i - 1; - if (*filter_mask & ((unsigned)1 << idx)) { failed |= (unsigned)1 << idx; - continue; /*filter excluded*/ + continue; /* filter excluded */ } /* If the filter isn't registered and the application doesn't @@ -1275,7 +1207,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i * and registered */ if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) issue_error = TRUE; - } /* end if */ + } else issue_error = TRUE; @@ -1289,14 +1221,16 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i else HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered") - } /* end if */ - } /* end if */ + } + } /* end if */ fclass = &H5Z_table_g[fclass_idx]; + #ifdef H5Z_DEBUG fstats = &H5Z_stat_table_g[fclass_idx]; H5_timer_begin(&timer); #endif + tmp_flags = flags | (pline->filter[idx].flags); tmp_flags |= (edc_read == H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0; new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts, @@ -1319,16 +1253,15 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i failed |= (unsigned)1 << idx; H5E_clear_stack(NULL); } - else { + else *nbytes = new_nbytes; - } } } else if (pline) { /* Write */ for (idx = 0; idx < pline->nused; idx++) { if (*filter_mask & ((unsigned)1 << idx)) { failed |= (unsigned)1 << idx; - continue; /*filter excluded*/ + continue; /* filter excluded */ } if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { /* Check if filter is optional -- If it isn't, then error */ @@ -1337,21 +1270,26 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i failed |= (unsigned)1 << idx; H5E_clear_stack(NULL); - continue; /*filter excluded*/ - } + continue; /* filter excluded */ + } /* end if */ + fclass = &H5Z_table_g[fclass_idx]; + #ifdef H5Z_DEBUG fstats = &H5Z_stat_table_g[fclass_idx]; H5_timer_begin(&timer); #endif + new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts, pline->filter[idx].cd_values, *nbytes, buf_size, buf); + #ifdef H5Z_DEBUG H5_timer_end(&(fstats->stats[0].timer), &timer); fstats->stats[0].total += MAX(*nbytes, new_nbytes); if (0 == new_nbytes) fstats->stats[0].errors += *nbytes; #endif + if (0 == new_nbytes) { if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, @@ -1361,14 +1299,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i *nbytes = *buf_size; } - failed |= (unsigned)1 << idx; H5E_clear_stack(NULL); } - else { + else *nbytes = new_nbytes; - } - } + } /* end for */ } *filter_mask = failed; @@ -1378,24 +1314,19 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Z_filter_info - * - * Purpose: Get pointer to filter info for pipeline - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 + * Function: H5Z_filter_info * - * Modifications: + * Purpose: Get pointer to filter info for pipeline * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ H5Z_filter_info_t * H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) { - size_t idx; /* Index of filter in pipeline */ - H5Z_filter_info_t *ret_value; /* Return value */ + size_t idx; /* Index of filter in pipeline */ + H5Z_filter_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1419,20 +1350,14 @@ done: } /* end H5Z_filter_info() */ /*------------------------------------------------------------------------- - * Function: H5Z_filter_in_pline - * - * Purpose: Check wheter a filter is in the filter pipeline using the - * filter ID. This function is very similar to H5Z_filter_info - * - * Return: TRUE - found filter - * FALSE - not found - * FAIL - error + * Function: H5Z_filter_in_pline * - * Programmer: Raymond Lu - * 26 April 2013 - * - * Modifications: + * Purpose: Check wheter a filter is in the filter pipeline using the + * filter ID. This function is very similar to H5Z_filter_info * + * Return: TRUE - found filter + * FALSE - not found + * FAIL - error *------------------------------------------------------------------------- */ htri_t @@ -1460,18 +1385,13 @@ done: } /* end H5Z_filter_in_pline() */ /*------------------------------------------------------------------------- - * Function: H5Z_all_filters_avail - * - * Purpose: Verify that all the filters in a pipeline are currently - * available (i.e. registered) - * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, April 8, 2003 + * Function: H5Z_all_filters_avail * - * Modifications: + * Purpose: Verify that all the filters in a pipeline are currently + * available (i.e. registered) * + * Return: Non-negative (TRUE/FALSE) on success + * Negative on failure *------------------------------------------------------------------------- */ htri_t @@ -1487,7 +1407,6 @@ H5Z_all_filters_avail(const H5O_pline_t *pline) /* Iterate through all the filters in pipeline */ for (i = 0; i < pline->nused; i++) { - /* Look for each filter in the list of registered filters */ for (j = 0; j < H5Z_table_used_g; j++) if (H5Z_table_g[j].id == pline->filter[i].id) @@ -1505,16 +1424,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_delete * - * Purpose: Delete filter FILTER from pipeline PLINE; - * deletes all filters if FILTER is H5Z_FILTER_NONE - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Pedro Vicente - * Monday, January 26, 2004 - * - * Modifications: + * Purpose: Delete filter FILTER from pipeline PLINE; + * deletes all filters if FILTER is H5Z_FILTER_NONE * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1536,7 +1450,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) 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 */ @@ -1547,7 +1461,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) if (pline->filter[idx].id == filter) { found = TRUE; break; - } /* end if */ + } /* filter was not found in the pipeline */ if (!found) @@ -1572,8 +1486,8 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->filter[idx].name = pline->filter[idx]._name; if (pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES) pline->filter[idx].cd_values = pline->filter[idx]._cd_values; - } /* end for */ - } /* end if */ + } + } /* Decrement number of used filters */ pline->nused--; @@ -1589,14 +1503,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Zget_filter_info * - * Purpose: Gets information about a pipeline data filter and stores it - * in filter_config_flags. - * - * Return: zero on success / negative on failure - * - * Programmer: James Laird and Nat Furrer - * Monday, June 7, 2004 + * Purpose: Gets information about a pipeline data filter and stores it + * in filter_config_flags. * + * Return: zero on success + * negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1618,14 +1529,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_get_filter_info * - * Purpose: Gets information about a pipeline data filter and stores it - * in filter_config_flags. - * - * Return: zero on success / negative on failure - * - * Programmer: Quincey Koziol - * Saturday, May 11, 2013 + * Purpose: Gets information about a pipeline data filter and stores it + * in filter_config_flags. * + * Return: zero on success + * negative on failure *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index a2a2443..308a741 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Friday, August 27, 1999 */ @@ -62,8 +62,6 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{ * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -72,7 +70,7 @@ H5Z_filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], { void * outbuf = NULL; /* Pointer to new buffer */ int status; /* Status from zlib operation */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index 1779910..a7514cb 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu<slu@ncsa.uiuc.edu> + * Programmer: Raymond Lu * Jan 3, 2003 */ @@ -53,20 +53,8 @@ const H5Z_class2_t H5Z_FLETCHER32[1] = {{ * Programmer: Raymond Lu * Jan 3, 2003 * - * Modifications: - * Raymond Lu - * July 8, 2005 - * There was a bug in the calculating code of the Fletcher32 - * checksum in the library before v1.6.3. The checksum - * value wasn't consistent between big-endian and little-endian - * systems. This bug was fixed in Release 1.6.3. However, - * after fixing the bug, the checksum value is no longer the - * same as before on little-endian system. We'll check both - * the correct checksum and the wrong checksum to be consistent - * with Release 1.6.2 and before. *------------------------------------------------------------------------- */ -/* ARGSUSED */ static size_t H5Z_filter_fletcher32(unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t *buf_size, void **buf) @@ -77,7 +65,7 @@ H5Z_filter_fletcher32(unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, uint32_t reversed_fletcher; /* Possible wrong checksum value */ uint8_t c[4]; uint8_t tmp; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 7b02240..2b5e299 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -123,8 +123,6 @@ static unsigned parms_index = 0; * Programmer: Xiaowen Wu * Tuesday, December 21, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -161,8 +159,6 @@ done: * Programmer: Xiaowen Wu * Thursday, March 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -185,8 +181,6 @@ H5Z_calc_parms_nooptype(void) * Programmer: Xiaowen Wu * Saturday, January 29, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -221,8 +215,6 @@ H5Z_calc_parms_atomic(void) * Programmer: Xiaowen Wu * Wednesday, January 19, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -291,8 +283,6 @@ done: * Programmer: Xiaowen Wu * Wednesday, January 19, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -382,8 +372,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -420,8 +408,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, January 11, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -505,8 +491,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -515,7 +499,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) H5T_t * dtype_base = NULL; /* Array datatype's base datatype */ H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */ size_t dtype_size; /* Array datatype's size (in bytes) */ - htri_t is_vlstring; /* flag indicating if datatype is varible-length string */ + htri_t is_vlstring; /* flag indicating if datatype is variable-length string */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -591,8 +575,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -604,7 +586,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) size_t dtype_member_offset; /* Compound datatype's current member datatype's offset (in bytes) */ size_t dtype_next_member_offset; /* Compound datatype's next member datatype's offset (in bytes) */ size_t dtype_size; /* Compound datatype's size (in bytes) */ - htri_t is_vlstring; /* flag indicating if datatype is varible-length string */ + htri_t is_vlstring; /* flag indicating if datatype is variable-length string */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -715,8 +697,6 @@ done: * Programmer: Xiaowen Wu * Tuesday, January 11, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -788,7 +768,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get dataspace */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Get total number of elements in the chunk */ if ((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0) @@ -1070,6 +1050,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned for (i = 0; i < n; i++) H5Z_nbit_decompress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, p); break; + case H5Z_NBIT_ARRAY: base_size = parms[parms_index]; /* read in advance */ n = total_size / base_size; /* number of base_type elements inside the array datatype */ @@ -1081,6 +1062,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned parms_index = begin_index; } break; + case H5Z_NBIT_COMPOUND: base_size = parms[parms_index]; /* read in advance */ n = total_size / base_size; /* number of base_type elements inside the array datatype */ @@ -1092,10 +1074,12 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned parms_index = begin_index; } break; + case H5Z_NBIT_NOOPTYPE: parms_index++; /* skip size of no-op type */ H5Z_nbit_decompress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ @@ -1141,11 +1125,13 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig H5Z_nbit_decompress_one_atomic(data, data_offset + member_offset, buffer, j, buf_len, p); break; + case H5Z_NBIT_ARRAY: if (H5Z__nbit_decompress_one_array(data, data_offset + member_offset, buffer, j, buf_len, parms) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") break; + case H5Z_NBIT_COMPOUND: if (H5Z__nbit_decompress_one_compound(data, data_offset + member_offset, buffer, j, buf_len, parms) < 0) @@ -1157,6 +1143,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig H5Z_nbit_decompress_one_nooptype(data, data_offset + member_offset, buffer, j, buf_len, member_size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ @@ -1188,7 +1175,6 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff switch (parms[3]) { case H5Z_NBIT_ATOMIC: - /* set the index before goto function call */ p.size = parms[4]; p.order = parms[5]; p.precision = parms[6]; @@ -1202,24 +1188,27 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff H5Z_nbit_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, p); } break; + case H5Z_NBIT_ARRAY: size = parms[4]; - parms_index = 4; + parms_index = 4; /* set the index before goto function call */ for (i = 0; i < d_nelmts; i++) { if (H5Z__nbit_decompress_one_array(data, i * size, buffer, &j, &buf_len, parms) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") parms_index = 4; } break; + case H5Z_NBIT_COMPOUND: size = parms[4]; - parms_index = 4; + parms_index = 4; /* set the index before goto function call */ for (i = 0; i < d_nelmts; i++) { if (H5Z__nbit_decompress_one_compound(data, i * size, buffer, &j, &buf_len, parms) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") parms_index = 4; } break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ @@ -1349,6 +1338,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned ch for (i = 0; i < n; i++) H5Z_nbit_compress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, p); break; + case H5Z_NBIT_ARRAY: base_size = parms[parms_index]; /* read in advance */ n = total_size / base_size; /* number of base_type elements inside the array datatype */ @@ -1358,6 +1348,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned ch parms_index = begin_index; } break; + case H5Z_NBIT_COMPOUND: base_size = parms[parms_index]; /* read in advance */ n = total_size / base_size; /* number of base_type elements inside the array datatype */ @@ -1367,10 +1358,12 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned ch parms_index = begin_index; } break; + case H5Z_NBIT_NOOPTYPE: parms_index++; /* skip size of no-op type */ H5Z_nbit_compress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ @@ -1398,16 +1391,20 @@ H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, unsigned p.offset = parms[parms_index++]; H5Z_nbit_compress_one_atomic(data, data_offset + member_offset, buffer, j, buf_len, p); break; + case H5Z_NBIT_ARRAY: H5Z_nbit_compress_one_array(data, data_offset + member_offset, buffer, j, buf_len, parms); break; + case H5Z_NBIT_COMPOUND: H5Z_nbit_compress_one_compound(data, data_offset + member_offset, buffer, j, buf_len, parms); break; + case H5Z_NBIT_NOOPTYPE: size = parms[parms_index++]; H5Z_nbit_compress_one_nooptype(data, data_offset + member_offset, buffer, j, buf_len, size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ @@ -1420,7 +1417,8 @@ H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, { /* i: index of data, new_size: index of buffer, buf_len: number of bits to be filled in current byte */ - size_t i, size; + unsigned i; + size_t size; size_t new_size = 0; int buf_len; parms_atomic p; @@ -1433,7 +1431,6 @@ H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, switch (parms[3]) { case H5Z_NBIT_ATOMIC: - /* set the index before goto function call */ p.size = parms[4]; p.order = parms[5]; p.precision = parms[6]; @@ -1443,6 +1440,7 @@ H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, H5Z_nbit_compress_one_atomic(data, i * p.size, buffer, &new_size, &buf_len, p); } break; + case H5Z_NBIT_ARRAY: size = parms[4]; parms_index = 4; @@ -1451,6 +1449,7 @@ H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, parms_index = 4; } break; + case H5Z_NBIT_COMPOUND: size = parms[4]; parms_index = 4; @@ -1459,6 +1458,7 @@ H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, parms_index = 4; } break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index 2e227e6..018a043 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Thursday, April 16, 1998 */ diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index 78227b1..97da13c 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Thursday, April 16, 1998 */ @@ -25,7 +25,7 @@ * Filter identifiers. Values 0 through 255 are for filters defined by the * HDF5 library. Values 256 through 511 are available for testing new * filters. Subsequent values should be obtained from the HDF5 development - * team at hdf5dev@ncsa.uiuc.edu. These values will never change because they + * team at help@hdfgroup.org. These values will never change because they * appear in the HDF5 files. */ typedef int H5Z_filter_t; @@ -50,7 +50,7 @@ typedef int H5Z_filter_t; * unlimited amount, but currently each * filter uses a bit in a 32-bit field, * so the format would have to be - * changed to accomodate that) + * changed to accommodate that) */ /* Flags for filter definition (stored) */ @@ -203,14 +203,14 @@ typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts, const unsigne * contain a pointers to the filter function and timing statistics. */ typedef struct H5Z_class2_t { - int version; /* Version number of the H5Z_class_t struct */ - H5Z_filter_t id; /* Filter ID number */ - unsigned encoder_present; /* Does this filter have an encoder? */ - unsigned decoder_present; /* Does this filter have a decoder? */ - const char * name; /* Comment for debugging */ - H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */ - H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */ - H5Z_func_t filter; /* The actual filter function */ + int version; /* Version number of the H5Z_class_t struct */ + H5Z_filter_t id; /* Filter ID number */ + unsigned encoder_present; /* Does this filter have an encoder? */ + unsigned decoder_present; /* Does this filter have a decoder? */ + const char * name; /* Comment for debugging */ + H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */ + H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */ + H5Z_func_t filter; /* The actual filter function */ } H5Z_class2_t; H5_DLL herr_t H5Zregister(const void *cls); diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index fdfaa2f..a234a6d 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -13,16 +13,16 @@ #define H5Z_PACKAGE /*suppress error about including H5Zpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ -#include "H5Tprivate.h" /* Datatypes */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5Zpkg.h" /* Data filters */ /* Struct of parameters needed for compressing/decompressing one atomic datatype */ typedef struct { @@ -727,19 +727,17 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_scaleoffset + * Function: H5Z_can_apply_scaleoffset * - * Purpose: Check the parameters for scaleoffset compression for + * Purpose: Check the parameters for scaleoffset compression for * validity and whether they fit a particular dataset. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Xiaowen Wu * Friday, February 4, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -781,26 +779,24 @@ done: } /* end H5Z_can_apply_scaleoffset() */ /*------------------------------------------------------------------------- - * Function: H5Z_scaleoffset_get_type + * Function: H5Z_scaleoffset_get_type * - * Purpose: Get the specific integer type based on datatype size and sign + * Purpose: Get the specific integer type based on datatype size and sign * or floating-point type based on size * - * Return: Success: id number of integer type - * Failure: 0 + * Return: Success: id number of integer type + * Failure: 0 * - * Programmer: Xiaowen Wu + * Programmer: Xiaowen Wu * Wednesday, April 13, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static enum H5Z_scaleoffset_t H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dtype_sign) { - enum H5Z_scaleoffset_t type = t_bad; /* integer type */ - enum H5Z_scaleoffset_t ret_value; /* return value */ + enum H5Z_scaleoffset_t type = t_bad; /* integer type */ + enum H5Z_scaleoffset_t ret_value = t_bad; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -853,12 +849,12 @@ done: } /*------------------------------------------------------------------------- - * Function: H5Z_scaleoffset_set_parms_fillval + * Function: H5Z_scaleoffset_set_parms_fillval * - * Purpose: Get the fill value of the dataset and store in cd_values[] + * Purpose: Get the fill value of the dataset and store in cd_values[] * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Xiaowen Wu * Monday, March 7, 2005 @@ -908,19 +904,17 @@ H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum } /* end H5Z_scaleoffset_set_parms_fillval() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_local_scaleoffset + * Function: H5Z_set_local_scaleoffset * - * Purpose: Set the "local" dataset parameters for scaleoffset + * Purpose: Set the "local" dataset parameters for scaleoffset * compression. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Xiaowen Wu + * Programmer: Xiaowen Wu * Friday, February 4, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -963,7 +957,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get dataspace */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Get total number of elements in the chunk */ if ((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0) @@ -1059,7 +1053,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if (status == H5D_FILL_VALUE_UNDEFINED) cd_values[H5Z_SCALEOFFSET_PARM_FILAVAIL] = H5Z_SCALEOFFSET_FILL_UNDEFINED; else { - int need_convert = FALSE; /* Flag indicating convertion of byte order */ + int need_convert = FALSE; /* Flag indicating conversion of byte order */ cd_values[H5Z_SCALEOFFSET_PARM_FILAVAIL] = H5Z_SCALEOFFSET_FILL_DEFINED; @@ -1089,19 +1083,17 @@ done: } /* end H5Z_set_local_scaleoffset() */ /*------------------------------------------------------------------------- - * Function: H5Z_filter_scaleoffset + * Function: H5Z_filter_scaleoffset * - * Purpose: Implement an I/O filter for storing packed integer + * Purpose: Implement an I/O filter for storing packed integer * data using scale and offset method. * - * Return: Success: Size of buffer filtered - * Failure: 0 + * Return: Success: Size of buffer filtered + * Failure: 0 * - * Programmer: Xiaowen Wu + * Programmer: Xiaowen Wu * Monday, February 7, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -1120,17 +1112,17 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value uint32_t minbits = 0; /* minimum number of bits to store values */ unsigned long long minval = 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */ - int need_convert = FALSE; /* flag indicating convertion of byte order */ + int need_convert = FALSE; /* flag indicating conversion of byte order */ unsigned char * outbuf = NULL; /* pointer to new output buffer */ unsigned buf_offset = 21; /* buffer offset because of parameters stored in file */ unsigned i; /* index */ - parms_atomic p; /* paramters needed for compress/decompress functions */ + parms_atomic p; /* parameters needed for compress/decompress functions */ FUNC_ENTER_NOAPI_NOINIT /* check arguments */ if (cd_nelmts != H5Z_SCALEOFFSET_TOTAL_NPARMS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scaleoffset number of paramters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scaleoffset number of parameters") /* Check if memory byte order matches dataset datatype byte order */ switch (H5T_native_order_g) { @@ -1202,7 +1194,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value minbits = (uint32_t)scale_factor; } - /* prepare paramters to pass to compress/decompress functions */ + /* prepare parameters to pass to compress/decompress functions */ p.size = cd_values[H5Z_SCALEOFFSET_PARM_SIZE]; p.mem_order = H5T_native_order_g; diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index 71b3d22..4d5f456 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -53,11 +53,8 @@ const H5Z_class2_t H5Z_SHUFFLE[1] = {{ * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) { @@ -112,10 +109,6 @@ done: * Programmer: Kent Yang * Wednesday, November 13, 2002 * - * Modifications: - * Quincey Koziol, November 13, 2002 - * Cleaned up code. - * *------------------------------------------------------------------------- */ static size_t @@ -129,10 +122,10 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t numofelements; /* Number of elements in buffer */ size_t i; /* Local index variables */ #ifdef NO_DUFFS_DEVICE - size_t j; /* Local index variable */ -#endif /* NO_DUFFS_DEVICE */ - size_t leftover; /* Extra bytes at end of buffer */ - size_t ret_value; /* Return value */ + size_t j; /* Local index variable */ +#endif /* NO_DUFFS_DEVICE */ + size_t leftover; /* Extra bytes at end of buffer */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 301490c..1dfa6af 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -67,8 +67,6 @@ H5Z_class2_t H5Z_SZIP[1] = {{ * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -117,14 +115,6 @@ done: * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: Used new logic to set the size of the scanline parameter. - * Now SZIP compression can be applied to the chunk - * of any shape and size with only one restriction: the number - * of elements in the chunk has to be not less than number - * of elements (pixels) in the block (cd_values[H5Z_SZIP_PARM_PPB] - * parameter). - * Elena Pourmal, July 20, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -262,10 +252,6 @@ done: * Programmer: Kent Yang * Tuesday, April 1, 2003 * - * Modifications: - * Quincey Koziol, April 2, 2003 - * Cleaned up code. - * *------------------------------------------------------------------------- */ static size_t diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index be0472f..c98fd59 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -264,7 +264,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); } /* The difference of this macro from H5Z_XFORM_DO_OP3 is that it handles the operations when the left operand - * is empty, like -x or +x. The reason that it's seperated from H5Z_XFORM_DO_OP3 is because compilers don't + * is empty, like -x or +x. The reason that it's separated from H5Z_XFORM_DO_OP3 is because compilers don't * accept operations like *x or /x. So in H5Z_do_op, these two macros are called in different ways. (SLU * 2012/3/20) */ @@ -306,7 +306,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); } /* - * Programmer: Bill Wendling <wendling@ncsa.uiuc.edu> + * Programmer: Bill Wendling * 25. August 2003 */ @@ -331,11 +331,11 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); * Purpose: Rollback the H5Z_token to the previous H5Z_token retrieved. There * should only need to be one level of rollback necessary * for our grammar. + * * Return: Always succeeds. + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ @@ -509,8 +509,6 @@ done: * Return: Nothing * Programmer: Bill Wendling * 25. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ @@ -535,7 +533,7 @@ H5Z_xform_destroy_parse_tree(H5Z_node *tree) * Purpose: Entry function for parsing the expression string. * * Return: Success: Valid H5Z_node ptr to an expression tree. - * NULLure: NULL + * Failure: NULL * * Programmer: Bill Wendling * 26. August 2003 @@ -546,7 +544,7 @@ static void * H5Z_xform_parse(const char *expression, H5Z_datval_ptrs *dat_val_pointers) { H5Z_token tok; - void * ret_value; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -572,11 +570,10 @@ done: * expr := term | term '+' term | term '-' term * * Return: Success: Valid H5Z_node ptr to expression tree - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ @@ -584,7 +581,7 @@ static H5Z_node * H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) { H5Z_node *expr; - H5Z_node *ret_value; /* Return value */ + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -665,19 +662,18 @@ done: * term := factor | factor '*' factor | factor '/' factor * * Return: Success: Valid H5Z_node ptr to expression tree - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ static H5Z_node * H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) { - H5Z_node *term = NULL; - H5Z_node *ret_value; + H5Z_node *term = NULL; + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -754,11 +750,10 @@ done: * '(' expr ')' * * Return: Success: Valid H5Z_node ptr to expression tree - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ @@ -767,7 +762,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) { H5Z_node *factor = NULL; H5Z_node *new_node; - H5Z_node *ret_value; + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -779,7 +774,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - sscanf(current->tok_begin, "%ld", &factor->value.int_val); + HDsscanf(current->tok_begin, "%ld", &factor->value.int_val); break; case H5Z_XFORM_FLOAT: @@ -787,7 +782,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - sscanf(current->tok_begin, "%lf", &factor->value.float_val); + HDsscanf(current->tok_begin, "%lf", &factor->value.float_val); break; case H5Z_XFORM_SYMBOL: @@ -893,20 +888,21 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_new_node - * Purpose: Create and initilize a new H5Z_node structure. + * + * Purpose: Create and initialize a new H5Z_node structure. + * * Return: Success: Valid H5Z_node ptr - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ static H5Z_node * H5Z_new_node(H5Z_token_type type) { - H5Z_node *ret_value; + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -923,12 +919,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_xform_eval * Purpose: If the transform is trivial, this function applies it. - * Otherwise, it calls H5Z_xform_eval_full to do the full + * Otherwise, it calls H5Z__xform_eval_full to do the full * transform. - * Return: SUCCEED if transform applied succesfully, FAIL otherwise + * Return: SUCCEED if transform applied successfully, FAIL otherwise * Programmer: Leon Arber * 5/1/04 - * Modifications: * *------------------------------------------------------------------------- */ @@ -1037,15 +1032,17 @@ done: * Function: H5Z_xform_eval_full * Purpose: Does a full evaluation of the parse tree contained in tree * and applies this transform to array. + * + * Notes: In the case of a polynomial data transform (ie, the left and right + * subtree are both of type H5Z_XFORM_SYMBOL), the convention is + * that the left hand side will accumulate changes and, at the end, + * the new data will be copied from the lhs. + * * Return: Nothing + * * Programmer: Leon Arber * 5/1/04 - * Modifications: - * * - * Notes: In the case of a polynomial data transform (ie, the left and right subtree - * are both of type H5Z_XFORM_SYMBOL), the convention is that the left hand side - * will accumulate changes and, at the end, the new data will be copied from the lhs. *------------------------------------------------------------------------- */ static herr_t @@ -1090,7 +1087,6 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_t * 1. See if "x" is on left hand side, right hand side, or if both sides are "x" * 2. Figure out what type of data we're going to be manipulating * 3. Do the operation on the data. */ - switch (tree->type) { case H5Z_XFORM_PLUS: H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size) @@ -1129,10 +1125,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_find_type + * * Return: Native type of datatype that is passed in - * Programmer: Leon Arber, 4/20/04 - * Modifications: * + * Programmer: Leon Arber, 4/20/04 * *------------------------------------------------------------------------- */ @@ -1199,12 +1195,14 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_xform_copy_tree + * * Purpose: Makes a copy of the parse tree passed in. + * * Return: A pointer to a root for a new parse tree which is a copy * of the one passed in. + * * Programmer: Leon Arber * April 1, 2004. - * Modifications: * *------------------------------------------------------------------------- */ @@ -1257,7 +1255,6 @@ H5Z_xform_copy_tree(H5Z_node *tree, H5Z_datval_ptrs *dat_val_pointers, H5Z_datva H5Z_XFORM_DO_OP4(H5Z_XFORM_MINUS) else if (tree->type == H5Z_XFORM_DIVIDE) H5Z_XFORM_DO_OP4(H5Z_XFORM_DIVIDE) - else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error in parse tree while trying to copy") @@ -1267,12 +1264,14 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_op_is_numbs + * * Purpose: Internal function to facilitate the condition check in - * H5Z_xform_reduce_tree to reduce the bulkiness of the code. + * H5Z__xform_reduce_tree to reduce the bulkiness of the code. + * * Return: TRUE or FALSE + * * Programmer: Raymond Lu * 15 March 2012 - * Modifications: * *------------------------------------------------------------------------- */ @@ -1294,14 +1293,16 @@ H5Z_op_is_numbs(H5Z_node *_tree) /*------------------------------------------------------------------------- * Function: H5Z_op_is_numbs2 + * * Purpose: Internal function to facilitate the condition check in * H5Z_xform_reduce_tree to reduce the bulkiness of the code. * The difference from H5Z_op_is_numbs is that the left child * can be empty, like -x or +x. + * * Return: TRUE or FALSE + * * Programmer: Raymond Lu * 15 March 2012 - * Modifications: * *------------------------------------------------------------------------- */ @@ -1327,13 +1328,14 @@ H5Z_op_is_numbs2(H5Z_node *_tree) /*------------------------------------------------------------------------- * Function: H5Z_xform_reduce_tree + * * Purpose: Simplifies parse tree passed in by performing any obvious * and trivial arithemtic calculations. * * Return: None. + * * Programmer: Leon Arber * April 1, 2004. - * Modifications: * *------------------------------------------------------------------------- */ @@ -1381,16 +1383,13 @@ H5Z_xform_reduce_tree(H5Z_node *tree) * Purpose: If the root of the tree passed in points to a simple * arithmetic operation and the left and right subtrees are both * integer or floating point values, this function does that - * operation, free the left and rigt subtrees, and replaces + * operation, free the left and right subtrees, and replaces * the root with the result of the operation. + * * Return: None. + * * Programmer: Leon Arber * April 1, 2004. - * Modifications: - * Raymond Lu - * 15 March 2012 - * I added a new macro H5Z_XFORM_DO_OP6 to handle the special - * operations like -x or +x when the left operand is empty. * *------------------------------------------------------------------------- */ @@ -1420,23 +1419,19 @@ H5Z_do_op(H5Z_node *tree) * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ H5Z_data_xform_t * H5Z_xform_create(const char *expr) { H5Z_data_xform_t *data_xform_prop = NULL; - H5Z_data_xform_t *ret_value; unsigned int i; - unsigned int count = 0; + unsigned int count = 0; + H5Z_data_xform_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1474,7 +1469,7 @@ H5Z_xform_create(const char *expr) * of the data we have for polynomial transforms */ data_xform_prop->dat_val_pointers->num_ptrs = 0; - /* we generate the parse tree right here and store a poitner to its root in the property. */ + /* we generate the parse tree right here and store a pointer to its root in the property. */ if ((data_xform_prop->parse_root = (H5Z_node *)H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression") @@ -1516,14 +1511,10 @@ done: * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1561,7 +1552,7 @@ H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop) * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * @@ -1569,8 +1560,6 @@ H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop) * after the top-level copy has been performed and this routine finishes * the "deep" part of the copy. * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1652,14 +1641,12 @@ done: * * Return: TRUE for no data transform, FALSE for a data transform * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * * Comments: Can't fail * - * Modifications: - * *------------------------------------------------------------------------- */ hbool_t @@ -1682,12 +1669,10 @@ H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop) * Return: * Pointer to a copy of the string in the data_xform property. * - * Programmer: Leon Arber, larber@ncsa.uiuc.edu + * Programmer: Leon Arber * * Date: Sept. 4, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ const char * diff --git a/src/H5dbg.c b/src/H5dbg.c index e0b2b74..a78dbe8 100644 --- a/src/H5dbg.c +++ b/src/H5dbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5dbg.c - * Mar 4 2006 - * Quincey Koziol <koziol@ncsa.uiuc.edu> + * Created: H5dbg.c + * Mar 4 2006 + * Quincey Koziol * - * Purpose: Generic debugging routines + * Purpose: Generic debugging routines * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ /****************/ /* Local Macros */ @@ -56,15 +56,14 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5_buffer_dump + * Function: H5_buffer_dump * - * Purpose: Dumps a buffer of memory in an octal dump form + * Purpose: Dumps a buffer of memory in an octal dump form * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 4 2006 + * Programmer: Quincey Koziol + * Mar 4 2006 * *------------------------------------------------------------------------- */ @@ -106,6 +105,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark } /* end if */ else HDfprintf(stream, " "); + if (7 == v) HDfputc(' ', stream); } /* end for */ @@ -118,12 +118,14 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark HDfputc(' ', stream); else { c = buf[buf_offset + u + v]; + if (HDisprint(c)) HDfputc(c, stream); else HDfputc('.', stream); } /* end else */ } /* end if */ + if (7 == v) HDfputc(' ', stream); } /* end for */ diff --git a/src/H5detect.c b/src/H5detect.c index 5227811..99aa58a 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -220,25 +220,6 @@ precision(detected_t *d) * * Return: void * - * Modifications: - * - * Robb Matzke, 4 Nov 1996 - * The INFO.perm now contains `-1' for bytes that aren't used and - * are always zero. This happens on the Cray for `short' where - * sizeof(short) is 8, but only the low-order 4 bytes are ever used. - * - * Robb Matzke, 4 Nov 1996 - * Added a `padding' field to indicate how many zero bytes appear to - * the left (N) or right (-N) of the value. - * - * Robb Matzke, 5 Nov 1996 - * Removed HFILE and CFILE arguments. - * - * Neil Fortner, 6 Sep 2013 - * Split macro into DETECT_I and DETECT_BYTE macros, extracted - * common code into DETECT_I_BYTE_CORE. This was done to remove - * "will never be executed" warnings. - * *------------------------------------------------------------------------- */ #define DETECT_I_BYTE_CORE(TYPE, VAR, INFO, DETECT_TYPE) \ @@ -1653,12 +1634,6 @@ verify_signal_handlers(int signum, void (*handler)(int)) * * Return: Success: EXIT_SUCCESS * - * Modifications: - * 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. - * *------------------------------------------------------------------------- */ int HDF_NO_UBSAN diff --git a/src/H5err.txt b/src/H5err.txt index f0a60a1..624c801 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -46,7 +46,7 @@ MAJOR, H5E_ARGS, Invalid arguments to routine MAJOR, H5E_RESOURCE, Resource unavailable MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail) -MAJOR, H5E_FILE, File accessibilty +MAJOR, H5E_FILE, File accessibility MAJOR, H5E_IO, Low-level I/O MAJOR, H5E_FUNC, Function entry/exit MAJOR, H5E_ATOM, Object atom @@ -78,7 +78,7 @@ MAJOR, H5E_NONE_MAJOR, No error # Sections (for grouping minor errors) SECTION, ARGS, Argument errors SECTION, RESOURCE, Resource errors -SECTION, FILEACC, File accessibilty errors +SECTION, FILEACC, File accessibility errors SECTION, FILE, Generic low-level file I/O errors SECTION, FUNC, Function entry/exit interface errors SECTION, ATOM, Object atom related errors @@ -119,7 +119,7 @@ MINOR, RESOURCE, H5E_CANTGC, Unable to garbage collect MINOR, RESOURCE, H5E_CANTGETSIZE, Unable to compute size MINOR, RESOURCE, H5E_OBJOPEN, Object is already open -# File accessibilty errors +# File accessibility errors MINOR, FILEACC, H5E_FILEEXISTS, File already exists MINOR, FILEACC, H5E_FILEOPEN, File already open MINOR, FILEACC, H5E_CANTCREATE, Unable to create file diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index 44768dd..617d1f5 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -32,9 +32,8 @@ static const char *FileHeader = "\n\ *------------------------------------------------------------------------- */ -#include <stdio.h> -#include <time.h> #include "H5private.h" + /* Do NOT use HDfprintf in this file as it is not linked with the library, * which contains the H5system.c file in which the function is defined. */ @@ -65,7 +64,7 @@ insert_libhdf5_settings(FILE *flibinfo) if (NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) { HDperror(LIBSETTINGSFNAME); HDexit(EXIT_FAILURE); - } /* end if */ + } /* print variable definition and the string */ /* Do not use const else AIX strings does not show it. */ @@ -76,30 +75,31 @@ insert_libhdf5_settings(FILE *flibinfo) /* 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); - } /* end while */ + } + if (HDfeof(fsettings)) { /* 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(EXIT_FAILURE); - } /* end else */ + } if (0 != HDfclose(fsettings)) { HDperror(LIBSETTINGSFNAME); HDexit(EXIT_FAILURE); - } /* end if */ + } #else /* print variable definition and an empty string */ /* Do not use const else AIX strings does not show it. */ @@ -165,12 +165,12 @@ information about the library build configuration\n"; 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 */ + } + } else real_name[0] = '\0'; } @@ -209,13 +209,15 @@ information about the library build configuration\n"; if (real_name[0]) fprintf(rawoutstream, ">"); HDfputc('\n', rawoutstream); - } /* end if */ + } + fprintf(rawoutstream, " *\n * Purpose:\t\t"); + for (s = purpose; *s; s++) { HDfputc(*s, rawoutstream); if ('\n' == *s && s[1]) fprintf(rawoutstream, " *\t\t\t"); - } /* end for */ + } fprintf(rawoutstream, " *\n * Modifications:\n *\n"); fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); diff --git a/src/H5overflow.h b/src/H5overflow.h index 54433c8..af21277 100644 --- a/src/H5overflow.h +++ b/src/H5overflow.h @@ -14,9 +14,11 @@ /* Generated automatically by bin/make_overflow -- do not edit */ /* Add new types to H5overflow.txt file */ + #ifndef _H5overflow_H #define _H5overflow_H + /* Each type in this file is tested for assignment to the other types, * and range checks are defined for bad assignments at run-time. */ @@ -25,2186 +27,2226 @@ /* src: unsigned, dst: int8_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_INT8_T -#define ASSIGN_unsigned_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_INT8_T -#define ASSIGN_unsigned_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_INT8_T */ -#define ASSIGN_unsigned_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: int8_t */ /* src: unsigned, dst: int */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_INT -#define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_INT -#define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_INT */ -#define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: int */ /* src: unsigned, dst: uint8_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT8_T -#define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT8_T -#define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT8_T */ -#define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: uint8_t */ /* src: unsigned, dst: uint16_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT16_T -#define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT16_T -#define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT16_T */ -#define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: uint16_t */ /* src: unsigned, dst: uint32_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT32_T -#define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT32_T -#define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT32_T */ -#define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: uint32_t */ /* src: unsigned, dst: uint64_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT64_T -#define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT64_T -#define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT64_T */ -#define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: uint64_t */ /* src: unsigned, dst: ptrdiff_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: ptrdiff_t */ /* src: unsigned, dst: size_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_SIZE_T -#define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_SIZE_T -#define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_SIZE_T */ -#define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: size_t */ /* src: unsigned, dst: ssize_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_SSIZE_T -#define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_SSIZE_T -#define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: ssize_t */ /* src: unsigned, dst: haddr_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HADDR_T -#define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HADDR_T -#define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HADDR_T */ -#define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: haddr_t */ /* src: unsigned, dst: hsize_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HSIZE_T -#define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HSIZE_T -#define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: hsize_t */ /* src: unsigned, dst: hssize_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HSSIZE_T -#define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HSSIZE_T -#define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: hssize_t */ /* src: unsigned, dst: h5_stat_size_t */ #if H5_SIZEOF_UNSIGNED < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: unsigned dst: h5_stat_size_t */ + /* Assignment checks for int8_t */ /* src: int8_t, dst: unsigned */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_int8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_int8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_int8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: unsigned */ /* src: int8_t, dst: int */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_INT -#define ASSIGN_int8_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_INT -#define ASSIGN_int8_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_INT */ -#define ASSIGN_int8_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: int */ /* src: int8_t, dst: uint8_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_UINT8_T -#define ASSIGN_int8_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_UINT8_T -#define ASSIGN_int8_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_int8_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: uint8_t */ /* src: int8_t, dst: uint16_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_UINT16_T -#define ASSIGN_int8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_UINT16_T -#define ASSIGN_int8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_int8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: uint16_t */ /* src: int8_t, dst: uint32_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_UINT32_T -#define ASSIGN_int8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_UINT32_T -#define ASSIGN_int8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_int8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: uint32_t */ /* src: int8_t, dst: uint64_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_UINT64_T -#define ASSIGN_int8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_UINT64_T -#define ASSIGN_int8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_int8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: uint64_t */ /* src: int8_t, dst: ptrdiff_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_int8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_int8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_int8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: ptrdiff_t */ /* src: int8_t, dst: size_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_SIZE_T -#define ASSIGN_int8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_SIZE_T -#define ASSIGN_int8_t_TO_size_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_int8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: size_t */ /* src: int8_t, dst: ssize_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_int8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_int8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_int8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: ssize_t */ /* src: int8_t, dst: haddr_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_HADDR_T -#define ASSIGN_int8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_HADDR_T -#define ASSIGN_int8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_int8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: haddr_t */ /* src: int8_t, dst: hsize_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_int8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_int8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_int8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: hsize_t */ /* src: int8_t, dst: hssize_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_int8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_int8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_int8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: hssize_t */ /* src: int8_t, dst: h5_stat_size_t */ #if H5_SIZEOF_INT8_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_int8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT8_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_int8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT8_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_int8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int8_t dst: h5_stat_size_t */ + /* Assignment checks for int */ /* src: int, dst: unsigned */ #if H5_SIZEOF_INT < H5_SIZEOF_UNSIGNED -#define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_UNSIGNED -#define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: unsigned */ /* src: int, dst: int8_t */ #if H5_SIZEOF_INT < H5_SIZEOF_INT8_T -#define ASSIGN_int_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_INT8_T -#define ASSIGN_int_TO_int8_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_INT8_T */ -#define ASSIGN_int_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: int8_t */ /* src: int, dst: uint8_t */ #if H5_SIZEOF_INT < H5_SIZEOF_UINT8_T -#define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_UINT8_T -#define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_UINT8_T */ -#define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: uint8_t */ /* src: int, dst: uint16_t */ #if H5_SIZEOF_INT < H5_SIZEOF_UINT16_T -#define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_UINT16_T -#define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_UINT16_T */ -#define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: uint16_t */ /* src: int, dst: uint32_t */ #if H5_SIZEOF_INT < H5_SIZEOF_UINT32_T -#define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_UINT32_T -#define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_UINT32_T */ -#define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: uint32_t */ /* src: int, dst: uint64_t */ #if H5_SIZEOF_INT < H5_SIZEOF_UINT64_T -#define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_UINT64_T -#define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_UINT64_T */ -#define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: uint64_t */ /* src: int, dst: ptrdiff_t */ #if H5_SIZEOF_INT < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: ptrdiff_t */ /* src: int, dst: size_t */ #if H5_SIZEOF_INT < H5_SIZEOF_SIZE_T -#define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_SIZE_T -#define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_SIZE_T */ -#define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: size_t */ /* src: int, dst: ssize_t */ #if H5_SIZEOF_INT < H5_SIZEOF_SSIZE_T -#define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_SSIZE_T -#define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: ssize_t */ /* src: int, dst: haddr_t */ #if H5_SIZEOF_INT < H5_SIZEOF_HADDR_T -#define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_HADDR_T -#define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_HADDR_T */ -#define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: haddr_t */ /* src: int, dst: hsize_t */ #if H5_SIZEOF_INT < H5_SIZEOF_HSIZE_T -#define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_HSIZE_T -#define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: hsize_t */ /* src: int, dst: hssize_t */ #if H5_SIZEOF_INT < H5_SIZEOF_HSSIZE_T -#define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_HSSIZE_T -#define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: hssize_t */ /* src: int, dst: h5_stat_size_t */ #if H5_SIZEOF_INT < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_INT > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_INT == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: int dst: h5_stat_size_t */ + /* Assignment checks for uint8_t */ /* src: uint8_t, dst: unsigned */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: unsigned */ /* src: uint8_t, dst: int8_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_INT8_T -#define ASSIGN_uint8_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_INT8_T -#define ASSIGN_uint8_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_uint8_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: int8_t */ /* src: uint8_t, dst: int */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_INT -#define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_INT -#define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_INT */ -#define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: int */ /* src: uint8_t, dst: uint16_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT16_T -#define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT16_T -#define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: uint16_t */ /* src: uint8_t, dst: uint32_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT32_T -#define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT32_T -#define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: uint32_t */ /* src: uint8_t, dst: uint64_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT64_T -#define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT64_T -#define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: uint64_t */ /* src: uint8_t, dst: ptrdiff_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: ptrdiff_t */ /* src: uint8_t, dst: size_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_SIZE_T -#define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_SIZE_T -#define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: size_t */ /* src: uint8_t, dst: ssize_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: ssize_t */ /* src: uint8_t, dst: haddr_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_HADDR_T -#define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HADDR_T -#define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: haddr_t */ /* src: uint8_t, dst: hsize_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: hsize_t */ /* src: uint8_t, dst: hssize_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: hssize_t */ /* src: uint8_t, dst: h5_stat_size_t */ #if H5_SIZEOF_UINT8_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT8_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint8_t dst: h5_stat_size_t */ + /* Assignment checks for uint16_t */ /* src: uint16_t, dst: unsigned */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: unsigned */ /* src: uint16_t, dst: int8_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_INT8_T -#define ASSIGN_uint16_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_INT8_T -#define ASSIGN_uint16_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_uint16_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: int8_t */ /* src: uint16_t, dst: int */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_INT -#define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_INT -#define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_INT */ -#define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: int */ /* src: uint16_t, dst: uint8_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_UINT8_T -#define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UINT8_T -#define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: uint8_t */ /* src: uint16_t, dst: uint32_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_UINT32_T -#define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UINT32_T -#define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: uint32_t */ /* src: uint16_t, dst: uint64_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_UINT64_T -#define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UINT64_T -#define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: uint64_t */ /* src: uint16_t, dst: ptrdiff_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: ptrdiff_t */ /* src: uint16_t, dst: size_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_SIZE_T -#define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_SIZE_T -#define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: size_t */ /* src: uint16_t, dst: ssize_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: ssize_t */ /* src: uint16_t, dst: haddr_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_HADDR_T -#define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_HADDR_T -#define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: haddr_t */ /* src: uint16_t, dst: hsize_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: hsize_t */ /* src: uint16_t, dst: hssize_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: hssize_t */ /* src: uint16_t, dst: h5_stat_size_t */ #if H5_SIZEOF_UINT16_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT16_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint16_t dst: h5_stat_size_t */ + /* Assignment checks for uint32_t */ /* src: uint32_t, dst: unsigned */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: unsigned */ /* src: uint32_t, dst: int8_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_INT8_T -#define ASSIGN_uint32_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_INT8_T -#define ASSIGN_uint32_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_uint32_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: int8_t */ /* src: uint32_t, dst: int */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_INT -#define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_INT -#define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_INT */ -#define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: int */ /* src: uint32_t, dst: uint8_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT8_T -#define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT8_T -#define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: uint8_t */ /* src: uint32_t, dst: uint16_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT16_T -#define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT16_T -#define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: uint16_t */ /* src: uint32_t, dst: uint64_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT64_T -#define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT64_T -#define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: uint64_t */ /* src: uint32_t, dst: ptrdiff_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: ptrdiff_t */ /* src: uint32_t, dst: size_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_SIZE_T -#define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_SIZE_T -#define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: size_t */ /* src: uint32_t, dst: ssize_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: ssize_t */ /* src: uint32_t, dst: haddr_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_HADDR_T -#define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HADDR_T -#define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: haddr_t */ /* src: uint32_t, dst: hsize_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: hsize_t */ /* src: uint32_t, dst: hssize_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: hssize_t */ /* src: uint32_t, dst: h5_stat_size_t */ #if H5_SIZEOF_UINT32_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT32_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint32_t dst: h5_stat_size_t */ + /* Assignment checks for uint64_t */ /* src: uint64_t, dst: unsigned */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: unsigned */ /* src: uint64_t, dst: int8_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_INT8_T -#define ASSIGN_uint64_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_INT8_T -#define ASSIGN_uint64_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_uint64_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: int8_t */ /* src: uint64_t, dst: int */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_INT -#define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_INT -#define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_INT */ -#define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: int */ /* src: uint64_t, dst: uint8_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT8_T -#define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT8_T -#define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: uint8_t */ /* src: uint64_t, dst: uint16_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT16_T -#define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT16_T -#define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: uint16_t */ /* src: uint64_t, dst: uint32_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT32_T -#define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT32_T -#define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: uint32_t */ /* src: uint64_t, dst: ptrdiff_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: ptrdiff_t */ /* src: uint64_t, dst: size_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_SIZE_T -#define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_SIZE_T -#define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: size_t */ /* src: uint64_t, dst: ssize_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: ssize_t */ /* src: uint64_t, dst: haddr_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_HADDR_T -#define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HADDR_T -#define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: haddr_t */ /* src: uint64_t, dst: hsize_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: hsize_t */ /* src: uint64_t, dst: hssize_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: hssize_t */ /* src: uint64_t, dst: h5_stat_size_t */ #if H5_SIZEOF_UINT64_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_UINT64_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: uint64_t dst: h5_stat_size_t */ + /* Assignment checks for ptrdiff_t */ /* src: ptrdiff_t, dst: unsigned */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: unsigned */ /* src: ptrdiff_t, dst: int8_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_INT8_T -#define ASSIGN_ptrdiff_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_INT8_T -#define ASSIGN_ptrdiff_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_ptrdiff_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: int8_t */ /* src: ptrdiff_t, dst: int */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_INT -#define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_INT -#define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_INT */ -#define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: int */ /* src: ptrdiff_t, dst: uint8_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT8_T -#define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT8_T -#define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: uint8_t */ /* src: ptrdiff_t, dst: uint16_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT16_T -#define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT16_T -#define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: uint16_t */ /* src: ptrdiff_t, dst: uint32_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT32_T -#define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT32_T -#define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: uint32_t */ /* src: ptrdiff_t, dst: uint64_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT64_T -#define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT64_T -#define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: uint64_t */ /* src: ptrdiff_t, dst: size_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_SIZE_T -#define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_SIZE_T -#define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: size_t */ /* src: ptrdiff_t, dst: ssize_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: ssize_t */ /* src: ptrdiff_t, dst: haddr_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HADDR_T -#define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HADDR_T -#define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: haddr_t */ /* src: ptrdiff_t, dst: hsize_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: hsize_t */ /* src: ptrdiff_t, dst: hssize_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: hssize_t */ /* src: ptrdiff_t, dst: h5_stat_size_t */ #if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ptrdiff_t dst: h5_stat_size_t */ + /* Assignment checks for size_t */ /* src: size_t, dst: unsigned */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: unsigned */ /* src: size_t, dst: int8_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_INT8_T -#define ASSIGN_size_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_INT8_T -#define ASSIGN_size_t_TO_int8_t(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_size_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: int8_t */ /* src: size_t, dst: int */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_INT -#define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_INT -#define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_INT */ -#define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: int */ /* src: size_t, dst: uint8_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT8_T -#define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT8_T -#define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: uint8_t */ /* src: size_t, dst: uint16_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT16_T -#define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT16_T -#define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: uint16_t */ /* src: size_t, dst: uint32_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT32_T -#define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT32_T -#define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: uint32_t */ /* src: size_t, dst: uint64_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT64_T -#define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT64_T -#define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: uint64_t */ /* src: size_t, dst: ptrdiff_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: ptrdiff_t */ /* src: size_t, dst: ssize_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: ssize_t */ /* src: size_t, dst: haddr_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_HADDR_T -#define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HADDR_T -#define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: haddr_t */ /* src: size_t, dst: hsize_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: hsize_t */ /* src: size_t, dst: hssize_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: hssize_t */ /* src: size_t, dst: h5_stat_size_t */ #if H5_SIZEOF_SIZE_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SIZE_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: size_t dst: h5_stat_size_t */ + /* Assignment checks for ssize_t */ /* src: ssize_t, dst: unsigned */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: unsigned */ /* src: ssize_t, dst: int8_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_INT8_T -#define ASSIGN_ssize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_INT8_T -#define ASSIGN_ssize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_ssize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: int8_t */ /* src: ssize_t, dst: int */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_INT -#define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_INT -#define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_INT */ -#define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: int */ /* src: ssize_t, dst: uint8_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT8_T -#define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT8_T -#define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: uint8_t */ /* src: ssize_t, dst: uint16_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT16_T -#define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT16_T -#define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: uint16_t */ /* src: ssize_t, dst: uint32_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT32_T -#define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT32_T -#define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: uint32_t */ /* src: ssize_t, dst: uint64_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT64_T -#define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT64_T -#define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: uint64_t */ /* src: ssize_t, dst: ptrdiff_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: ptrdiff_t */ /* src: ssize_t, dst: size_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_SIZE_T -#define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_SIZE_T -#define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: size_t */ /* src: ssize_t, dst: haddr_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HADDR_T -#define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HADDR_T -#define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: haddr_t */ /* src: ssize_t, dst: hsize_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: hsize_t */ /* src: ssize_t, dst: hssize_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: hssize_t */ /* src: ssize_t, dst: h5_stat_size_t */ #if H5_SIZEOF_SSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: ssize_t dst: h5_stat_size_t */ + /* Assignment checks for haddr_t */ /* src: haddr_t, dst: unsigned */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: unsigned */ /* src: haddr_t, dst: int8_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_INT8_T -#define ASSIGN_haddr_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_INT8_T -#define ASSIGN_haddr_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_haddr_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: int8_t */ /* src: haddr_t, dst: int */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_INT -#define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_INT -#define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_INT */ -#define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: int */ /* src: haddr_t, dst: uint8_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT8_T -#define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT8_T -#define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: uint8_t */ /* src: haddr_t, dst: uint16_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT16_T -#define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT16_T -#define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: uint16_t */ /* src: haddr_t, dst: uint32_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT32_T -#define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT32_T -#define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: uint32_t */ /* src: haddr_t, dst: uint64_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT64_T -#define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT64_T -#define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: uint64_t */ /* src: haddr_t, dst: ptrdiff_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: ptrdiff_t */ /* src: haddr_t, dst: size_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_SIZE_T -#define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_SIZE_T -#define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: size_t */ /* src: haddr_t, dst: ssize_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: ssize_t */ /* src: haddr_t, dst: hsize_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: hsize_t */ /* src: haddr_t, dst: hssize_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: hssize_t */ /* src: haddr_t, dst: h5_stat_size_t */ #if H5_SIZEOF_HADDR_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HADDR_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: haddr_t dst: h5_stat_size_t */ + /* Assignment checks for hsize_t */ /* src: hsize_t, dst: unsigned */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: unsigned */ /* src: hsize_t, dst: int8_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_INT8_T -#define ASSIGN_hsize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_INT8_T -#define ASSIGN_hsize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_hsize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: int8_t */ /* src: hsize_t, dst: int */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_INT -#define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_INT -#define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_INT */ -#define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: int */ /* src: hsize_t, dst: uint8_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT8_T -#define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT8_T -#define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: uint8_t */ /* src: hsize_t, dst: uint16_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT16_T -#define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT16_T -#define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: uint16_t */ /* src: hsize_t, dst: uint32_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT32_T -#define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT32_T -#define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: uint32_t */ /* src: hsize_t, dst: uint64_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT64_T -#define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT64_T -#define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: uint64_t */ /* src: hsize_t, dst: ptrdiff_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: ptrdiff_t */ /* src: hsize_t, dst: size_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_SIZE_T -#define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_SIZE_T -#define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: size_t */ /* src: hsize_t, dst: ssize_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: ssize_t */ /* src: hsize_t, dst: haddr_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_HADDR_T -#define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_HADDR_T -#define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: haddr_t */ /* src: hsize_t, dst: hssize_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: hssize_t */ /* src: hsize_t, dst: h5_stat_size_t */ #if H5_SIZEOF_HSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hsize_t dst: h5_stat_size_t */ + /* Assignment checks for hssize_t */ /* src: hssize_t, dst: unsigned */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: unsigned */ /* src: hssize_t, dst: int8_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_INT8_T -#define ASSIGN_hssize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_INT8_T -#define ASSIGN_hssize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_hssize_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: int8_t */ /* src: hssize_t, dst: int */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_INT -#define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_INT -#define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_INT */ -#define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: int */ /* src: hssize_t, dst: uint8_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT8_T -#define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT8_T -#define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: uint8_t */ /* src: hssize_t, dst: uint16_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT16_T -#define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT16_T -#define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: uint16_t */ /* src: hssize_t, dst: uint32_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT32_T -#define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT32_T -#define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: uint32_t */ /* src: hssize_t, dst: uint64_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT64_T -#define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT64_T -#define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: uint64_t */ /* src: hssize_t, dst: ptrdiff_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: ptrdiff_t */ /* src: hssize_t, dst: size_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_SIZE_T -#define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_SIZE_T -#define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: size_t */ /* src: hssize_t, dst: ssize_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: ssize_t */ /* src: hssize_t, dst: haddr_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_HADDR_T -#define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_HADDR_T -#define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: haddr_t */ /* src: hssize_t, dst: hsize_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: hsize_t */ /* src: hssize_t, dst: h5_stat_size_t */ #if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T -#define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ -#define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) + #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) #endif /* src: hssize_t dst: h5_stat_size_t */ + /* Assignment checks for h5_stat_size_t */ /* src: h5_stat_size_t, dst: unsigned */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UNSIGNED -#define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UNSIGNED -#define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UNSIGNED */ -#define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: unsigned */ /* src: h5_stat_size_t, dst: int8_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_INT8_T -#define ASSIGN_h5_stat_size_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_INT8_T -#define ASSIGN_h5_stat_size_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_INT8_T */ -#define ASSIGN_h5_stat_size_t_TO_int8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_int8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: int8_t */ /* src: h5_stat_size_t, dst: int */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_INT -#define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_INT -#define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_INT */ -#define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: int */ /* src: h5_stat_size_t, dst: uint8_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT8_T -#define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT8_T -#define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT8_T */ -#define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: uint8_t */ /* src: h5_stat_size_t, dst: uint16_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT16_T -#define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT16_T -#define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT16_T */ -#define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: uint16_t */ /* src: h5_stat_size_t, dst: uint32_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT32_T -#define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT32_T -#define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT32_T */ -#define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: uint32_t */ /* src: h5_stat_size_t, dst: uint64_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT64_T -#define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT64_T -#define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT64_T */ -#define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: uint64_t */ /* src: h5_stat_size_t, dst: ptrdiff_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_PTRDIFF_T -#define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_PTRDIFF_T -#define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_PTRDIFF_T */ -#define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: ptrdiff_t */ /* src: h5_stat_size_t, dst: size_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_SIZE_T -#define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_SIZE_T -#define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_SIZE_T */ -#define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: size_t */ /* src: h5_stat_size_t, dst: ssize_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_SSIZE_T -#define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_SSIZE_T -#define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_SSIZE_T */ -#define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: ssize_t */ /* src: h5_stat_size_t, dst: haddr_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HADDR_T -#define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HADDR_T -#define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HADDR_T */ -#define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: haddr_t */ /* src: h5_stat_size_t, dst: hsize_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HSIZE_T -#define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HSIZE_T -#define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HSIZE_T */ -#define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: hsize_t */ /* src: h5_stat_size_t, dst: hssize_t */ #if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HSSIZE_T -#define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HSSIZE_T -#define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) #else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HSSIZE_T */ -#define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) + #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) #endif /* src: h5_stat_size_t dst: hssize_t */ #endif /* H5overflow_H */ + diff --git a/src/H5private.h b/src/H5private.h index e7cbd81..10a61dc 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> +/* Programmer: Robb Matzke * Friday, October 30, 1998 * * Purpose: This file is included by all HDF5 library source files to @@ -839,7 +839,7 @@ typedef off_t h5_stat_size_t; #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #ifndef HDftell -#define HDftell(F) ftello(F) +#define HDftell(F) ftell(F) #endif /* HDftell */ #ifndef HDftruncate #define HDftruncate(F, L) ftruncate(F, L) @@ -885,7 +885,7 @@ typedef off_t h5_stat_size_t; #endif /* HDgetgroups */ #ifndef HDgethostname #define HDgethostname(N, L) gethostname(N, L) -#endif /* HDgetlogin */ +#endif /* HDgethostname */ #ifndef HDgetlogin #define HDgetlogin() getlogin() #endif /* HDgetlogin */ @@ -910,6 +910,7 @@ typedef off_t h5_stat_size_t; #ifndef HDgets #define HDgets(S) gets(S) #endif /* HDgets */ + #ifndef HDgettimeofday #define HDgettimeofday(S, P) gettimeofday(S, P) #endif /* HDgettimeofday */ @@ -1104,13 +1105,23 @@ typedef off_t h5_stat_size_t; #define HDrandom() HDrand() #endif /* HDrandom */ H5_DLL int HDrand(void); -#elif H5_HAVE_RANDOM +#ifndef HDsrandom +#define HDsrandom(S) HDsrand(S) +#endif /* HDsrandom */ +H5_DLL void HDsrand(unsigned int seed); +#elif defined(H5_HAVE_RANDOM) #ifndef HDrand #define HDrand() random() #endif /* HDrand */ #ifndef HDrandom #define HDrandom() random() #endif /* HDrandom */ +#ifndef HDsrand +#define HDsrand(S) srandom(S) +#endif /* HDsrand */ +#ifndef HDsrandom +#define HDsrandom(S) srandom(S) +#endif /* HDsrandom */ #else /* H5_HAVE_RANDOM */ #ifndef HDrand #define HDrand() rand() @@ -1118,6 +1129,12 @@ H5_DLL int HDrand(void); #ifndef HDrandom #define HDrandom() rand() #endif /* HDrandom */ +#ifndef HDsrand +#define HDsrand(S) srand(S) +#endif /* HDsrand */ +#ifndef HDsrandom +#define HDsrandom(S) srand(S) +#endif /* HDsrandom */ #endif /* H5_HAVE_RANDOM */ #ifndef HDread @@ -1238,26 +1255,6 @@ H5_DLL int HDrand(void); #ifndef HDsqrt #define HDsqrt(X) sqrt(X) #endif /* HDsqrt */ -#ifdef H5_HAVE_RAND_R -H5_DLL void HDsrand(unsigned int seed); -#ifndef HDsrandom -#define HDsrandom(S) HDsrand(S) -#endif /* HDsrandom */ -#elif H5_HAVE_RANDOM -#ifndef HDsrand -#define HDsrand(S) srandom(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srandom(S) -#endif /* HDsrandom */ -#else /* H5_HAVE_RAND_R */ -#ifndef HDsrand -#define HDsrand(S) srand(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srand(S) -#endif /* HDsrandom */ -#endif /* H5_HAVE_RAND_R */ #ifndef HDsscanf #define HDsscanf(S, FMT, ...) sscanf(S, FMT, __VA_ARGS__) #endif /* HDsscanf */ @@ -1337,6 +1334,9 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #ifndef HDstrtoull #define HDstrtoull(S, R, N) strtoull(S, R, N) #endif /* HDstrtoul */ +#ifndef HDstrtoumax +#define HDstrtoumax(S, R, N) strtoumax(S, R, N) +#endif /* HDstrtoumax */ #ifndef HDstrxfrm #define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z) #endif /* HDstrxfrm */ @@ -1823,12 +1823,11 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ /* global library version information string */ extern char H5_lib_vers_info_g[]; +#include "H5TSprivate.h" + /* Lock headers */ #ifdef H5_HAVE_THREADSAFE -/* Include required thread-safety header */ -#include "H5TSprivate.h" - /* replacement structure for original global variable */ typedef struct H5_api_struct { H5TS_mutex_t init_lock; /* API entrance mutex */ diff --git a/src/H5public.h b/src/H5public.h index 2a33fe4..01c7854 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -91,7 +91,7 @@ extern "C" { #define H5_GCC_DIAG_ON(x) #endif -/* Version numbers TAB char must surround the H5_VERS_xxx number */ +/* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 8 /* For minor interface/format changes */ #define H5_VERS_RELEASE 22 /* For tweaks, bug-fixes, or development */ diff --git a/src/H5timer.c b/src/H5timer.c index e5aded7..2c94aed 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -12,12 +12,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- - * * Created: H5timer.c * Aug 21 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * - * Purpose: Internal 'timer' routines & support routines. + * Purpose: Internal, platform-independent 'timer' support routines. * *------------------------------------------------------------------------- */ diff --git a/src/H5trace.c b/src/H5trace.c index 3d8dc4a..deb5776 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5trace.c - * Aug 21 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5trace.c + * Aug 21 2006 + * Quincey Koziol * - * Purpose: Internal code for tracing API calls + * Purpose: Internal code for tracing API calls * *------------------------------------------------------------------------- */ @@ -30,12 +30,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Ipkg.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_PARALLEL /* datatypes of predefined drivers needed by H5_trace() */ @@ -71,36 +71,36 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5_trace + * Function: H5_trace * - * Purpose: This function is called whenever an API function is called - * and tracing is turned on. If RETURNING is non-zero then - * the caller is about to return and RETURNING points to the + * Purpose: This function is called whenever an API function is called + * and tracing is turned on. If RETURNING is non-zero then + * the caller is about to return and RETURNING points to the * time for the corresponding function call event. Otherwise * we print the function name and the arguments. * - * The TYPE argument is a string which gives the type of each of - * the following argument pairs. Each type is zero or more - * asterisks (one for each level of indirection, although some - * types have one level of indirection already implied) followed - * by either one letter (lower case) or two letters (first one - * uppercase). + * The TYPE argument is a string which gives the type of each of + * the following argument pairs. Each type is zero or more + * asterisks (one for each level of indirection, although some + * types have one level of indirection already implied) followed + * by either one letter (lower case) or two letters (first one + * uppercase). * - * The variable argument list consists of pairs of values. Each - * pair is a string which is the formal argument name in the - * calling function, followed by the argument value. The type - * of the argument value is given by the TYPE string. + * The variable argument list consists of pairs of values. Each + * pair is a string which is the formal argument name in the + * calling function, followed by the argument value. The type + * of the argument value is given by the TYPE string. * - * Note: The TYPE string is meant to be terse and is generated by a - * separate perl script. + * Note: The TYPE string is meant to be terse and is generated by a + * separate perl script. * - * WARNING: DO NOT CALL ANY HDF5 FUNCTION THAT CALLS FUNC_ENTER(). DOING - * SO MAY CAUSE H5_trace() TO BE INVOKED RECURSIVELY OR MAY - * CAUSE LIBRARY INITIALIZATIONS THAT ARE NOT DESIRED. + * WARNING: DO NOT CALL ANY HDF5 FUNCTION THAT CALLS FUNC_ENTER(). DOING + * SO MAY CAUSE H5_trace() TO BE INVOKED RECURSIVELY OR MAY + * CAUSE LIBRARY INITIALIZATIONS THAT ARE NOT DESIRED. * - * Return: Execution time for an API call + * Return: Execution time for an API call * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -125,7 +125,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if (!out) return 0.0F; /*tracing is off*/ - va_start(ap, type); + HDva_start(ap, type); if (H5_debug_g.ttop) { if (returning) { @@ -164,7 +164,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if (current_depth < last_call_depth) { /* We are at the beginning of a line */ if (H5_debug_g.ttimes) { - char tmp[128]; + char tmp[320]; HDsprintf(tmp, "%.6f", event_time.etime - first_time.etime); HDfprintf(out, " %*s ", (int)HDstrlen(tmp), ""); @@ -219,10 +219,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) * name is the null pointer then don't print the argument or the * following `='. This is used for return values. */ - argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */ + argname = HDva_arg(ap, char *); if (argname) { - unsigned n = (unsigned)MAX(0, (int)HDstrlen(argname) - - 3); /*lint !e666 Allow expression with side effects */ + unsigned n = (unsigned)MAX(0, (int)HDstrlen(argname) - 3); if (!HDstrcmp(argname + n, "_id")) { HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); @@ -236,17 +235,17 @@ H5_trace(const double *returning, const char *func, const char *type, ...) /* The value */ if (ptr) - vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */ + vp = HDva_arg(ap, void *); switch (type[0]) { case 'a': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ + haddr_t addr = HDva_arg(ap, haddr_t); HDfprintf(out, "%a", addr); } /* end else */ @@ -255,13 +254,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'b': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - hbool_t bool_var = va_arg(ap, hbool_t); /*lint !e732 Loss of sign not really occuring */ - + /* Can't pass hbool_t to HDva_arg() */ + hbool_t bool_var = (hbool_t)HDva_arg(ap, int); if (TRUE == bool_var) HDfprintf(out, "TRUE"); else if (!bool_var) @@ -274,12 +273,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - double dbl = va_arg(ap, double); + double dbl = HDva_arg(ap, double); HDfprintf(out, "%g", dbl); } /* end else */ @@ -290,12 +289,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int); + H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)HDva_arg(ap, int); switch (alloc_time) { case H5D_ALLOC_TIME_ERROR: @@ -328,12 +327,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int); + H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)HDva_arg(ap, int); switch (opt) { case H5FD_MPIO_COLLECTIVE_IO: @@ -354,12 +353,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'f': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int); + H5D_fill_time_t fill_time = (H5D_fill_time_t)HDva_arg(ap, int); switch (fill_time) { case H5D_FILL_TIME_ERROR: @@ -388,12 +387,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'F': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int); + H5D_fill_value_t fill_value = (H5D_fill_value_t)HDva_arg(ap, int); switch (fill_value) { case H5D_FILL_VALUE_ERROR: @@ -422,12 +421,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'h': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int); + H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)HDva_arg(ap, int); switch (opt) { case H5FD_MPIO_CHUNK_DEFAULT: @@ -452,13 +451,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { H5D_mpio_actual_io_mode_t actual_io_mode = - (H5D_mpio_actual_io_mode_t)va_arg(ap, int); + (H5D_mpio_actual_io_mode_t)HDva_arg(ap, int); switch (actual_io_mode) { case H5D_MPIO_NO_COLLECTIVE: @@ -491,12 +490,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5D_layout_t layout = (H5D_layout_t)va_arg(ap, int); + H5D_layout_t layout = (H5D_layout_t)HDva_arg(ap, int); switch (layout) { case H5D_LAYOUT_ERROR: @@ -529,13 +528,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'n': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { H5D_mpio_no_collective_cause_t nocol_cause_mode = - (H5D_mpio_no_collective_cause_t)va_arg(ap, int); + (H5D_mpio_no_collective_cause_t)HDva_arg(ap, int); hbool_t flag_already_displayed = FALSE; /* Check for all bit-flags which might be set */ @@ -587,13 +586,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { H5D_mpio_actual_chunk_opt_mode_t chunk_opt_mode = - (H5D_mpio_actual_chunk_opt_mode_t)va_arg(ap, int); + (H5D_mpio_actual_chunk_opt_mode_t)HDva_arg(ap, int); switch (chunk_opt_mode) { case H5D_MPIO_NO_CHUNK_OPTIMIZATION: @@ -618,12 +617,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5D_space_status_t space_status = (H5D_space_status_t)va_arg(ap, int); + H5D_space_status_t space_status = (H5D_space_status_t)HDva_arg(ap, int); switch (space_status) { case H5D_SPACE_STATUS_NOT_ALLOCATED: @@ -652,12 +651,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)va_arg(ap, int); + H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)HDva_arg(ap, int); switch (transfer) { case H5FD_MPIO_INDEPENDENT: @@ -684,12 +683,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - herr_t status = va_arg(ap, herr_t); + herr_t status = HDva_arg(ap, herr_t); if (status >= 0) HDfprintf(out, "SUCCEED"); @@ -703,12 +702,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5E_direction_t direction = (H5E_direction_t)va_arg(ap, int); + H5E_direction_t direction = (H5E_direction_t)HDva_arg(ap, int); switch (direction) { case H5E_WALK_UPWARD: @@ -729,27 +728,26 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5E_error2_t *error = - va_arg(ap, H5E_error2_t *); /*lint !e64 Type mismatch not really occuring */ + H5E_error2_t *error = HDva_arg(ap, H5E_error2_t *); - HDfprintf(out, "0x%lx", (unsigned long)error); + HDfprintf(out, "0x%p", error); } /* end else */ break; case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5E_type_t etype = (H5E_type_t)va_arg(ap, int); + H5E_type_t etype = (H5E_type_t)HDva_arg(ap, int); switch (etype) { case H5E_MAJOR: @@ -778,12 +776,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5F_close_degree_t degree = (H5F_close_degree_t)va_arg(ap, int); + H5F_close_degree_t degree = (H5F_close_degree_t)HDva_arg(ap, int); switch (degree) { case H5F_CLOSE_DEFAULT: @@ -812,12 +810,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'm': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5F_mem_t mem_type = (H5F_mem_t)va_arg(ap, int); + H5F_mem_t mem_type = (H5F_mem_t)HDva_arg(ap, int); switch (mem_type) { case H5FD_MEM_NOLIST: @@ -863,12 +861,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5F_scope_t scope = (H5F_scope_t)va_arg(ap, int); + H5F_scope_t scope = (H5F_scope_t)HDva_arg(ap, int); switch (scope) { case H5F_SCOPE_LOCAL: @@ -889,12 +887,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'v': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5F_libver_t libver_vers = (H5F_libver_t)va_arg(ap, int); + H5F_libver_t libver_vers = (H5F_libver_t)HDva_arg(ap, int); switch (libver_vers) { case H5F_LIBVER_EARLIEST: @@ -924,12 +922,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5G_obj_t obj_type = (H5G_obj_t)va_arg(ap, int); + H5G_obj_t obj_type = (H5G_obj_t)HDva_arg(ap, int); switch (obj_type) { case H5G_UNKNOWN: @@ -972,15 +970,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5G_stat_t *statbuf = - va_arg(ap, H5G_stat_t *); /*lint !e64 Type mismatch not really occuring */ + H5G_stat_t *statbuf = HDva_arg(ap, H5G_stat_t *); - HDfprintf(out, "0x%lx", (unsigned long)statbuf); + HDfprintf(out, "0x%p", statbuf); } break; #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -994,7 +991,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'h': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { hsize_t *p = (hsize_t *)vp; @@ -1012,7 +1009,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - hsize_t hsize = va_arg(ap, hsize_t); /*lint !e732 Loss of sign not really occuring */ + hsize_t hsize = HDva_arg(ap, hsize_t); if (H5S_UNLIMITED == hsize) HDfprintf(out, "H5S_UNLIMITED"); @@ -1028,7 +1025,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { hssize_t *p = (hssize_t *)vp; @@ -1042,7 +1039,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - hssize_t hssize = va_arg(ap, hssize_t); + hssize_t hssize = HDva_arg(ap, hssize_t); HDfprintf(out, "%Hd", hssize); asize[argno] = (hssize_t)hssize; @@ -1058,12 +1055,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - hid_t obj = va_arg(ap, hid_t); + hid_t obj = HDva_arg(ap, hid_t); if (H5P_DEFAULT == obj) HDfprintf(out, "H5P_DEFAULT"); @@ -1246,12 +1243,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5_index_t idx_type = (H5_index_t)va_arg(ap, int); + H5_index_t idx_type = (H5_index_t)HDva_arg(ap, int); switch (idx_type) { case H5_INDEX_UNKNOWN: @@ -1280,12 +1277,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5_iter_order_t order = (H5_iter_order_t)va_arg(ap, int); + H5_iter_order_t order = (H5_iter_order_t)HDva_arg(ap, int); switch (order) { case H5_ITER_UNKNOWN: @@ -1318,7 +1315,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { int *p = (int *)vp; @@ -1332,7 +1329,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - int is = va_arg(ap, int); + int is = HDva_arg(ap, int); HDfprintf(out, "%d", is); asize[argno] = is; @@ -1342,12 +1339,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5I_type_t id_type = (H5I_type_t)va_arg(ap, int); + H5I_type_t id_type = (H5I_type_t)HDva_arg(ap, int); switch (id_type) { case H5I_UNINIT: @@ -1424,7 +1421,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'u': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { unsigned *p = (unsigned *)vp; @@ -1438,8 +1435,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - unsigned iu = - va_arg(ap, unsigned); /*lint !e732 Loss of sign not really occuring */ + unsigned iu = HDva_arg(ap, unsigned); HDfprintf(out, "%u", iu); asize[argno] = iu; @@ -1457,12 +1453,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5L_type_t link_type = (H5L_type_t)va_arg(ap, int); + H5L_type_t link_type = (H5L_type_t)HDva_arg(ap, int); switch (link_type) { case H5L_TYPE_ERROR: @@ -1503,13 +1499,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ #ifdef H5_HAVE_PARALLEL else { - MPI_Comm comm = va_arg(ap, MPI_Comm); + MPI_Comm comm = HDva_arg(ap, MPI_Comm); HDfprintf(out, "%ld", (long)comm); } /* end else */ @@ -1519,13 +1515,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ #ifdef H5_HAVE_PARALLEL else { - MPI_Info info = va_arg(ap, MPI_Info); + MPI_Info info = HDva_arg(ap, MPI_Info); HDfprintf(out, "%ld", (long)info); } /* end else */ @@ -1535,12 +1531,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5FD_mem_t mt = (H5FD_mem_t)va_arg(ap, int); + H5FD_mem_t mt = (H5FD_mem_t)HDva_arg(ap, int); switch (mt) { case H5FD_MEM_NOLIST: @@ -1594,12 +1590,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - off_t offset = va_arg(ap, off_t); + off_t offset = HDva_arg(ap, off_t); HDfprintf(out, "%ld", (long)offset); } /* end else */ @@ -1610,12 +1606,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5O_type_t objtype = (H5O_type_t)va_arg(ap, int); + H5O_type_t objtype = (H5O_type_t)HDva_arg(ap, int); switch (objtype) { case H5O_TYPE_UNKNOWN: @@ -1635,7 +1631,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; case H5O_TYPE_NTYPES: - HDfprintf(out, "H5O_TYPE_TYPES"); + HDfprintf(out, "H5O_TYPE_NTYPES"); break; default: @@ -1654,12 +1650,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'p': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - hid_t pclass_id = va_arg(ap, hid_t); + hid_t pclass_id = HDva_arg(ap, hid_t); char * class_name = NULL; H5P_genclass_t *pclass; @@ -1678,12 +1674,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'r': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - hobj_ref_t ref = va_arg(ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */ + hobj_ref_t ref = HDva_arg(ap, hobj_ref_t); HDfprintf(out, "Reference Object=%a", ref); } /* end else */ @@ -1694,12 +1690,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5R_type_t reftype = (H5R_type_t)va_arg(ap, int); + H5R_type_t reftype = (H5R_type_t)HDva_arg(ap, int); switch (reftype) { case H5R_BADTYPE: @@ -1736,12 +1732,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5S_class_t cls = (H5S_class_t)va_arg(ap, int); + H5S_class_t cls = (H5S_class_t)HDva_arg(ap, int); switch (cls) { case H5S_NO_CLASS: @@ -1770,12 +1766,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5S_seloper_t so = (H5S_seloper_t)va_arg(ap, int); + H5S_seloper_t so = (H5S_seloper_t)HDva_arg(ap, int); switch (so) { case H5S_SELECT_NOOP: @@ -1828,12 +1824,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5S_sel_type st = (H5S_sel_type)va_arg(ap, int); + H5S_sel_type st = (H5S_sel_type)HDva_arg(ap, int); switch (st) { case H5S_SEL_ERROR: @@ -1876,13 +1872,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - const char *str = - va_arg(ap, const char *); /*lint !e64 Type mismatch not really occuring */ + const char *str = HDva_arg(ap, const char *); HDfprintf(out, "\"%s\"", str); } /* end else */ @@ -1893,12 +1888,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_cset_t cset = (H5T_cset_t)va_arg(ap, int); + H5T_cset_t cset = (H5T_cset_t)HDva_arg(ap, int); switch (cset) { case H5T_CSET_ERROR: @@ -1940,12 +1935,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_direction_t direct = (H5T_direction_t)va_arg(ap, int); + H5T_direction_t direct = (H5T_direction_t)HDva_arg(ap, int); switch (direct) { case H5T_DIR_DEFAULT: @@ -1970,12 +1965,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_pers_t pers = (H5T_pers_t)va_arg(ap, int); + H5T_pers_t pers = (H5T_pers_t)HDva_arg(ap, int); switch (pers) { case H5T_PERS_DONTCARE: @@ -2000,12 +1995,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'n': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_norm_t norm = (H5T_norm_t)va_arg(ap, int); + H5T_norm_t norm = (H5T_norm_t)HDva_arg(ap, int); switch (norm) { case H5T_NORM_ERROR: @@ -2034,12 +2029,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_order_t order = (H5T_order_t)va_arg(ap, int); + H5T_order_t order = (H5T_order_t)HDva_arg(ap, int); switch (order) { case H5T_ORDER_ERROR: @@ -2076,12 +2071,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'p': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_pad_t pad = (H5T_pad_t)va_arg(ap, int); + H5T_pad_t pad = (H5T_pad_t)HDva_arg(ap, int); switch (pad) { case H5T_PAD_ERROR: @@ -2114,12 +2109,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_sign_t sign = (H5T_sign_t)va_arg(ap, int); + H5T_sign_t sign = (H5T_sign_t)HDva_arg(ap, int); switch (sign) { case H5T_SGN_ERROR: @@ -2148,12 +2143,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_class_t type_class = (H5T_class_t)va_arg(ap, int); + H5T_class_t type_class = (H5T_class_t)HDva_arg(ap, int); switch (type_class) { case H5T_NO_CLASS: @@ -2218,12 +2213,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'z': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5T_str_t str = (H5T_str_t)va_arg(ap, int); + H5T_str_t str = (H5T_str_t)HDva_arg(ap, int); switch (str) { case H5T_STR_ERROR: @@ -2274,12 +2269,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - htri_t tri_var = va_arg(ap, htri_t); + htri_t tri_var = HDva_arg(ap, htri_t); if (tri_var > 0) HDfprintf(out, "TRUE"); @@ -2295,7 +2290,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { unsigned long *p = (unsigned long *)vp; @@ -2309,18 +2304,17 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - unsigned long iul = - va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ + unsigned long iul = HDva_arg(ap, unsigned long); HDfprintf(out, "%lu", iul); - asize[argno] = iul; + asize[argno] = (hssize_t)iul; } /* end else */ break; case 'L': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { unsigned long long *p = (unsigned long long *)vp; @@ -2334,11 +2328,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - unsigned long long iull = va_arg( - ap, unsigned long long); /*lint !e732 Loss of sign not really occuring */ + unsigned long long iull = HDva_arg(ap, unsigned long long); HDfprintf(out, "%llu", iull); - asize[argno] = iull; + asize[argno] = (hssize_t)iull; } /* end else */ break; @@ -2351,14 +2344,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'x': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { void **p = (void **)vp; HDfprintf(out, " {"); for (i = 0; i < asize[asize_idx]; i++) { if (p[i]) - HDfprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i])); + HDfprintf(out, "%s0x%p", (i ? ", " : ""), p[i]); else HDfprintf(out, "%sNULL", (i ? ", " : "")); } /* end for */ @@ -2369,10 +2362,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */ + vp = HDva_arg(ap, void *); if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end else */ @@ -2381,7 +2374,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'z': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { size_t *p = (size_t *)vp; @@ -2395,7 +2388,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - size_t size = va_arg(ap, size_t); /*lint !e732 Loss of sign not really occuring */ + size_t size = HDva_arg(ap, size_t); HDfprintf(out, "%Zu", size); asize[argno] = (hssize_t)size; @@ -2407,12 +2400,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)va_arg(ap, int); + H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)HDva_arg(ap, int); switch (scale_type) { case H5Z_SO_FLOAT_DSCALE: @@ -2442,22 +2435,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - H5Z_class2_t *filter = - va_arg(ap, H5Z_class2_t *); /*lint !e64 Type mismatch not really occuring */ + H5Z_class2_t *filter = HDva_arg(ap, H5Z_class2_t *); - HDfprintf(out, "0x%lx", (unsigned long)filter); + HDfprintf(out, "0x%p", filter); } /* end else */ break; case 'e': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5Z_EDC_t edc = (H5Z_EDC_t)va_arg(ap, int); + H5Z_EDC_t edc = (H5Z_EDC_t)HDva_arg(ap, int); if (H5Z_DISABLE_EDC == edc) HDfprintf(out, "H5Z_DISABLE_EDC"); @@ -2471,12 +2463,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'f': if (ptr) { if (vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { - H5Z_filter_t id = va_arg(ap, H5Z_filter_t); + H5Z_filter_t id = HDva_arg(ap, H5Z_filter_t); if (H5Z_FILTER_DEFLATE == id) HDfprintf(out, "H5Z_FILTER_DEFLATE"); @@ -2488,7 +2480,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if (ptr) { if (vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if (asize_idx >= 0 && asize[asize_idx] >= 0) { ssize_t *p = (ssize_t *)vp; @@ -2502,7 +2494,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "NULL"); } /* end if */ else { - ssize_t ssize = va_arg(ap, ssize_t); + ssize_t ssize = HDva_arg(ap, ssize_t); HDfprintf(out, "%Zd", ssize); asize[argno] = (hssize_t)ssize; @@ -2530,7 +2522,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) (event_time.etime - *returning)); error: - va_end(ap); + HDva_end(ap); if (returning) HDfprintf(out, ";\n"); else { diff --git a/src/H5version.h b/src/H5version.h index 5f35b99..71044dd 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -14,6 +14,7 @@ /* Generated automatically by bin/make_vers -- do not edit */ /* Add new versioned symbols to H5vers.txt file */ + #ifndef _H5version_H #define _H5version_H @@ -22,6 +23,7 @@ #error "Can't choose old API versions when deprecated APIs are disabled" #endif /* defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) */ + /* If a particular "global" version of the library's interfaces is chosen, * set the versions for the API symbols affected. * @@ -136,6 +138,7 @@ #endif /* H5_USE_16_API */ + /* Choose the correct version of each API symbol, defaulting to the latest * version of each. The "best" name for API parameters/data structures * that have changed definitions is also set. An error is issued for @@ -161,10 +164,10 @@ #ifndef H5Aiterate_vers #define H5Aiterate_vers 2 #endif /* H5Aiterate_vers */ -#define H5Aiterate H5Aiterate2 +#define H5Aiterate H5Aiterate2 #define H5A_operator_t H5A_operator2_t #elif H5Aiterate_vers == 1 -#define H5Aiterate H5Aiterate1 +#define H5Aiterate H5Aiterate1 #define H5A_operator_t H5A_operator1_t #else /* H5Aiterate_vers */ #error "H5Aiterate_vers set to invalid value" @@ -251,13 +254,13 @@ #ifndef H5Ewalk_vers #define H5Ewalk_vers 2 #endif /* H5Ewalk_vers */ -#define H5Ewalk H5Ewalk2 +#define H5Ewalk H5Ewalk2 #define H5E_error_t H5E_error2_t -#define H5E_walk_t H5E_walk2_t +#define H5E_walk_t H5E_walk2_t #elif H5Ewalk_vers == 1 -#define H5Ewalk H5Ewalk1 +#define H5Ewalk H5Ewalk1 #define H5E_error_t H5E_error1_t -#define H5E_walk_t H5E_walk1_t +#define H5E_walk_t H5E_walk1_t #else /* H5Ewalk_vers */ #error "H5Ewalk_vers set to invalid value" #endif /* H5Ewalk_vers */ @@ -398,6 +401,7 @@ #error "H5E_auto_t_vers set to invalid value" #endif /* H5E_auto_t_vers */ + #if !defined(H5Z_class_t_vers) || H5Z_class_t_vers == 2 #ifndef H5Z_class_t_vers #define H5Z_class_t_vers 2 @@ -410,3 +414,4 @@ #endif /* H5Z_class_t_vers */ #endif /* H5version_H */ + @@ -20,37 +20,37 @@ #define _HDF5_H #include "H5public.h" -#include "H5Apublic.h" /* Attributes */ -#include "H5ACpublic.h" /* Metadata cache */ -#include "H5Dpublic.h" /* Datasets */ -#include "H5Epublic.h" /* Errors */ -#include "H5Fpublic.h" /* Files */ -#include "H5FDpublic.h" /* File drivers */ -#include "H5Gpublic.h" /* Groups */ -#include "H5Ipublic.h" /* ID management */ -#include "H5Lpublic.h" /* Links */ -#include "H5MMpublic.h" /* Memory management */ -#include "H5Opublic.h" /* Object headers */ -#include "H5Ppublic.h" /* Property lists */ -#include "H5PLpublic.h" /* Plugins */ -#include "H5Rpublic.h" /* References */ -#include "H5Spublic.h" /* Dataspaces */ -#include "H5Tpublic.h" /* Datatypes */ -#include "H5Zpublic.h" /* Data filters */ +#include "H5Apublic.h" /* Attributes */ +#include "H5ACpublic.h" /* Metadata cache */ +#include "H5Dpublic.h" /* Datasets */ +#include "H5Epublic.h" /* Errors */ +#include "H5Fpublic.h" /* Files */ +#include "H5FDpublic.h" /* File drivers */ +#include "H5Gpublic.h" /* Groups */ +#include "H5Ipublic.h" /* ID management */ +#include "H5Lpublic.h" /* Links */ +#include "H5MMpublic.h" /* Memory management */ +#include "H5Opublic.h" /* Object headers */ +#include "H5Ppublic.h" /* Property lists */ +#include "H5PLpublic.h" /* Plugins */ +#include "H5Rpublic.h" /* References */ +#include "H5Spublic.h" /* Dataspaces */ +#include "H5Tpublic.h" /* Datatypes */ +#include "H5Zpublic.h" /* Data filters */ /* Predefined file drivers */ -#include "H5FDcore.h" /* Files stored entirely in memory */ -#include "H5FDfamily.h" /* File families */ +#include "H5FDcore.h" /* Files stored entirely in memory */ +#include "H5FDdirect.h" /* Linux direct I/O */ +#include "H5FDfamily.h" /* File families */ #include "H5FDhdfs.h" /* Hadoop HDFS */ #include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5FDmulti.h" /* Usage-partitioned file family */ #include "H5FDros3.h" /* R/O S3 "file" I/O */ -#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif -#include "H5FDdirect.h" /* Linux direct I/O */ #endif diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 6b94b8b..cce342b 100644 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -60,7 +60,7 @@ H5FO.c H5Tcommit.c - H5Tcompound.c + H5Tcompound.c H5Tcset.c H5Tenum.c diff --git a/test/hdfs.c b/test/hdfs.c index 3e28d5f..664615c 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -19,7 +19,7 @@ * * Demonstrates basic use cases and fapl interaction. * - * Programmer: Jacob Smith <jake.smith@hdfgroup.org> + * Programmer: Jacob Smith * 2018-04-23 */ @@ -27,9 +27,11 @@ #include "H5FDhdfs.h" /* this file driver's utilities */ #ifdef H5_HAVE_LIBHDFS + #define HDFS_TEST_DEBUG 0 #define HDFS_TEST_MAX_BUF_SIZE 256 -#endif /* H5_HAVE_LIBHDFS */ + +/* only include the testing macros if needed */ /***************************************************************************** * @@ -359,11 +361,8 @@ * OTHER MACROS AND DEFINITIONS * ********************************/ -/* copied from src/hdfs.c - */ -#ifdef H5_HAVE_LIBHDFS +/* copied from src/hdfs.c */ #define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) -#endif /* H5_HAVE_LIBHDFS */ #define HDFS_NAMENODE_NAME_MAX_SIZE 128 @@ -371,12 +370,10 @@ * FILE-LOCAL GLOBAL VARIABLES * *******************************/ -#ifdef H5_HAVE_LIBHDFS static const char filename_missing[] = "/tmp/missing.txt"; static const char filename_bard[] = "/tmp/t8.shakespeare.txt"; static const char filename_raven[] = "/tmp/Poe_Raven.txt"; static const char filename_example_h5[] = "/tmp/t.h5"; -#endif /* H5_HAVE_LIBHDFS */ static H5FD_hdfs_fapl_t default_fa = { 1, /* fa version */ @@ -408,8 +405,6 @@ static H5FD_hdfs_fapl_t default_fa = { * Programmer: Jacob Smith * 2018-04-25 * - * Changes: None. - * *--------------------------------------------------------------------------- */ static int @@ -587,8 +582,7 @@ error: H5E_END_TRY; } return 1; - -} /* end test_fapl_config_validation() */ +} /* test_fapl_config_validation */ /*------------------------------------------------------------------------- * @@ -605,8 +599,6 @@ error: * Programmer: Jacob Smith * 2018-04-25 * - * Changes: None. - * *------------------------------------------------------------------------- */ static int @@ -616,10 +608,10 @@ test_hdfs_fapl(void) * test-local variables * ************************/ - hid_t fapl_id = -1; /* file access property list ID */ - hid_t driver_id = -1; /* ID for this VFD */ - unsigned long driver_flags = 0; /* VFD feature flags */ - H5FD_hdfs_fapl_t hdfs_fa_0 = { + hid_t fapl_id = -1; /* file access property list ID */ + hid_t driver_id = -1; /* ID for this VFD */ + unsigned long driver_flags = 0; /* VFD feature flags */ + H5FD_hdfs_fapl_t hdfs_fa_0 = { 1, /* version*/ "", /* node name */ 9000, /* node port */ @@ -662,7 +654,7 @@ error: return 1; -} /* end test_hdfs_fapl() */ +} /* test_hdfs_fapl() */ /*--------------------------------------------------------------------------- * @@ -686,15 +678,6 @@ static int test_vfd_open(void) { -#ifndef H5_HAVE_LIBHDFS - TESTING("HDFS VFD-level open"); - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; - -#else - /********************* * test-local macros * *********************/ @@ -711,10 +694,10 @@ test_vfd_open(void) struct test_condition { const char *message; const char *url; - unsigned flags; - int which_fapl; - haddr_t maxaddr; - hbool_t might_use_other_driver; + unsigned flags; + int which_fapl; + haddr_t maxaddr; + hbool_t might_use_other_driver; }; /************************ @@ -803,11 +786,11 @@ test_vfd_open(void) FALSE, }, }; - unsigned i = 0; + unsigned i = 0; unsigned failing_conditions_count = 10; - H5FD_t * fd = NULL; - hid_t fapl_hdfs = -1; - hid_t fapl_unconfigured = -1; + H5FD_t *fd = NULL; + hid_t fapl_hdfs = -1; + hid_t fapl_unconfigured = -1; TESTING("HDFS VFD-level open"); @@ -825,8 +808,8 @@ test_vfd_open(void) /* all the test cases that will _not_ open */ for (i = 0; i < failing_conditions_count; i++) { - struct test_condition T = failing_conditions[i]; - hid_t fapl_id = H5P_DEFAULT; + struct test_condition T = failing_conditions[i]; + hid_t fapl_id = H5P_DEFAULT; fd = NULL; @@ -889,7 +872,6 @@ test_vfd_open(void) return 0; error: - /*********** * CLEANUP * ***********/ @@ -914,9 +896,7 @@ error: #undef FAPL_UNCONFIGURED #undef FAPL_HDFS -#endif /* H5_HAVE_LIBHDFS */ - -} /* end test_vfd_open() */ +} /* test_vfd_open */ /*--------------------------------------------------------------------------- * @@ -939,14 +919,6 @@ error: static int test_eof_eoa(void) { -#ifndef H5_HAVE_LIBHDFS - TESTING("HDFS eof/eoa gets and sets"); - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; - -#else /********************* * test-local macros * @@ -961,7 +933,7 @@ test_eof_eoa(void) ************************/ H5FD_t *fd_shakespeare = NULL; - hid_t fapl_id = -1; + hid_t fapl_id = -1; TESTING("HDFS eof/eoa gets and sets"); @@ -1011,7 +983,6 @@ test_eof_eoa(void) return 0; error: - /*********** * CLEANUP * ***********/ @@ -1026,9 +997,7 @@ error: return 1; -#endif /* H5_HAVE_LIBHDFS */ - -} /* end test_eof_eoa() */ +} /* test_eof_eoa */ /*----------------------------------------------------------------------------- * @@ -1047,19 +1016,10 @@ error: static int test_H5FDread_without_eoa_set_fails(void) { -#ifndef H5_HAVE_LIBHDFS - TESTING("HDFS VFD read-eoa temporal coupling library limitation"); - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; - -#else - - char buffer[HDFS_TEST_MAX_BUF_SIZE]; - unsigned int i = 0; - H5FD_t * file_shakespeare = NULL; - hid_t fapl_id = -1; + char buffer[HDFS_TEST_MAX_BUF_SIZE]; + unsigned int i = 0; + H5FD_t *file_shakespeare = NULL; + hid_t fapl_id = -1; TESTING("HDFS VFD read-eoa temporal coupling library limitation"); @@ -1108,7 +1068,6 @@ test_H5FDread_without_eoa_set_fails(void) return 0; error: - /*********** * CLEANUP * ***********/ @@ -1123,9 +1082,7 @@ error: return 1; -#endif /* H5_HAVE_LIBHDFS */ - -} /* end test_H5FDread_without_eoa_set_fails() */ +} /* test_H5FDread_without_eoa_set_fails */ /*--------------------------------------------------------------------------- * @@ -1146,14 +1103,6 @@ error: static int test_read(void) { -#ifndef H5_HAVE_LIBHDFS - TESTING("HDFS VFD read/range-gets"); - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; - -#else /********************* * test-local macros * @@ -1276,9 +1225,8 @@ test_read(void) FAIL_IF(FAIL == H5FDset_eoa(file_raven, H5FD_MEM_DEFAULT, test.eoa_set)) /* zero buffer contents */ - for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) { + for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) buffer[i] = 0; - } /* ------------ * * conduct test * @@ -1291,10 +1239,8 @@ test_read(void) H5E_END_TRY; JSVERIFY(test.success, open_return, test.message) - - if (open_return == SUCCEED) { + if (open_return == SUCCEED) JSVERIFY_STR(test.expected, buffer, NULL) - } } /* for each testcase */ @@ -1312,14 +1258,12 @@ test_read(void) return 0; error: - /*********** * CLEANUP * ***********/ - if (file_raven != 0) { + if (file_raven) (void)H5FDclose(file_raven); - } if (fapl_id >= 0) { H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } H5E_END_TRY; @@ -1327,9 +1271,7 @@ error: return 1; -#endif /* H5_HAVE_LIBHDFS */ - -} /* end test_read() */ +} /* test_read */ /*--------------------------------------------------------------------------- * @@ -1348,24 +1290,11 @@ error: * Programmer: Jacob Smith * 2017-11-06 * - * Changes: - * + modify from S3VFD codebase to HDFS; Minor changes, mostly. - * + Jacob Smith 2018-06-08 - * *--------------------------------------------------------------------------- */ static int test_noops_and_autofails(void) { -#ifndef H5_HAVE_LIBHDFS - TESTING("HDFS VFD always-fail and no-op routines"); - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; - -#else - /********************* * test-local macros * *********************/ @@ -1427,7 +1356,6 @@ test_noops_and_autofails(void) return 0; error: - /*********** * CLEANUP * ***********/ @@ -1436,15 +1364,13 @@ error: H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } H5E_END_TRY; } - if (file != NULL) { + if (file) { (void)H5FDclose(file); } return 1; -#endif /* H5_HAVE_LIBHDFS */ - -} /* end test_noops_and_autofails() */ +} /* test_noops_and_autofails */ /*--------------------------------------------------------------------------- * @@ -1473,7 +1399,7 @@ test_cmp(void) return 0; -} /* end test_cmp() */ +} /* test_cmp */ /*--------------------------------------------------------------------------- * @@ -1491,24 +1417,11 @@ test_cmp(void) * Programmer: Jacob Smith * 2017-11-07 * - * Changes: - * + modify from S3VFD codebase to HDFS; Minor changes, mostly. - * + Jacob Smith 2018-06-08 - * *--------------------------------------------------------------------------- */ static int test_H5F_integration(void) { -#ifndef H5_HAVE_LIBHDFS - TESTING("HDFS file access through HD5F library (H5F API)"); - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; - -#else - /********************* * test-local macros * *********************/ @@ -1579,16 +1492,15 @@ error: H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } H5E_END_TRY; } - if (file > 0) { + if (file > 0) (void)H5Fclose(file); - } return 1; -#endif /* H5_HAVE_LIBHDFS */ - } /* test_H5F_integration */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * * Function: main @@ -1606,15 +1518,22 @@ error: int main(void) { +#ifdef H5_HAVE_LIBHDFS int nerrors = 0; - /****************** - * commence tests * - ******************/ - static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = ""; const char *hdfs_namenode_name_env = NULL; +#endif /* H5_HAVE_LIBHDFS */ + + HDprintf("Testing hdfs VFD functionality.\n"); + +#ifdef H5_HAVE_LIBHDFS + + /******************** + * initialize tests * + ********************/ + hdfs_namenode_name_env = HDgetenv("HDFS_TEST_NAMENODE_NAME"); if (hdfs_namenode_name_env == NULL || hdfs_namenode_name_env[0] == '\0') { HDstrncpy(hdfs_namenode_name, "localhost", HDFS_NAMENODE_NAME_MAX_SIZE); @@ -1624,9 +1543,11 @@ main(void) default_fa.namenode_name, hdfs_namenode_name_env, HDFS_NAMENODE_NAME_MAX_SIZE); } - h5_reset(); + /****************** + * commence tests * + ******************/ - HDprintf("Testing hdfs VFD functionality.\n"); + h5_reset(); nerrors += test_fapl_config_validation(); nerrors += test_hdfs_fapl(); @@ -1647,4 +1568,10 @@ main(void) } return nerrors; /* 0 if no errors, 1 if any errors */ -} /* end main() */ +#else + HDprintf("SKIPPED - HDFS VFD not built\n"); + return EXIT_SUCCESS; + +#endif /* H5_HAVE_LIBHDFS */ + +} /* main() */ diff --git a/test/ros3.c b/test/ros3.c index 54965f7..91f256f 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -20,7 +20,7 @@ * * Demonstrates basic use cases and fapl/dxpl interaction. * - * Programmer: Jacob Smith <jake.smith@hdfgroup.org> + * Programmer: Jacob Smith * 2017-10-11 */ @@ -1415,15 +1415,9 @@ test_noops_and_autofails(void) /* no-op calls to `lock()` and `unlock()` */ /* - JSVERIFY( SUCCEED, - H5FDlock(file, TRUE), - "lock always succeeds; has no effect" ) - JSVERIFY( SUCCEED, - H5FDlock(file, FALSE), - NULL ) - JSVERIFY( SUCCEED, - H5FDunlock(file), - NULL ) + JSVERIFY(SUCCEED, H5FDlock(file, TRUE), "lock always succeeds; has no effect") + JSVERIFY(SUCCEED, H5FDlock(file, FALSE), NULL) + JSVERIFY(SUCCEED, H5FDunlock(file), NULL) */ /* Lock/unlock with null file or similar error crashes tests. * HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()` diff --git a/test/s3comms.c b/test/s3comms.c index a054d41..d0764fd 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -15,7 +15,7 @@ * * Purpose: Unit tests for the S3 Communications (s3comms) module. * - * Programmer: Jacob Smith <jake.smith@hdfgroup.org> + * Programmer: Jacob Smith * 2017-10-11 */ |