diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-21 02:18:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-21 02:18:45 (GMT) |
commit | 0695d6366a670e1dd9b6b0ca463feec12ab659d7 (patch) | |
tree | baf248c43e42f8a479fb46dd21a916180575ac9b /src | |
parent | 68659dd411a8ca3b0b2ef86eaaa7d5ba5d5bc449 (diff) | |
parent | 8fc9a9ba251ea34ac5a943ad8eb7f6cf012b929d (diff) | |
download | hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.zip hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.tar.gz hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.tar.bz2 |
[svn-r27835] Description:
Sync w/trunk.
Tested on:
MacOSX/64 10.10.5 (amazon) w/serial & parallel
(h5committest not required on this branch)
Diffstat (limited to 'src')
332 files changed, 8126 insertions, 11596 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e555c2..fce59c2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,8 +22,8 @@ set (H5_HDRS ${HDF5_SRC_DIR}/hdf5.h ${HDF5_SRC_DIR}/H5api_adpt.h ${HDF5_SRC_DIR}/H5public.h - ${HDF5_SRC_DIR}/H5version.h - ${HDF5_SRC_DIR}/H5overflow.h + #${HDF5_SRC_DIR}/H5version.h + #${HDF5_SRC_DIR}/H5overflow.h ) IDE_GENERATED_PROPERTIES ("H5" "${H5_HDRS}" "${H5_SRCS}" ) @@ -134,12 +134,12 @@ set (H5E_SRCS ) set (H5E_HDRS - ${HDF5_SRC_DIR}/H5Edefin.h - ${HDF5_SRC_DIR}/H5Einit.h + #${HDF5_SRC_DIR}/H5Edefin.h + #${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epkg.h - ${HDF5_SRC_DIR}/H5Epubgen.h + #${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Epublic.h - ${HDF5_SRC_DIR}/H5Eterm.h + #${HDF5_SRC_DIR}/H5Eterm.h ) IDE_GENERATED_PROPERTIES ("H5E" "${H5E_HDRS}" "${H5E_SRCS}" ) @@ -722,7 +722,6 @@ set (H5_PUBLIC_HEADERS ${H5Z_HDRS} ) - set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h ${HDF5_SRC_DIR}/H5Aprivate.h @@ -769,6 +768,56 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5win32defs.h ) +set (H5_GENERATED_HEADERS + ${HDF5_SRC_DIR}/H5Edefin.h + ${HDF5_SRC_DIR}/H5Einit.h + ${HDF5_SRC_DIR}/H5Epubgen.h + ${HDF5_SRC_DIR}/H5Eterm.h + ${HDF5_SRC_DIR}/H5version.h + ${HDF5_SRC_DIR}/H5overflow.h +) + +if (HDF5_GENERATE_HEADERS) + find_package (Perl) + if (PERL_FOUND) + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt + DEPENDS ${HDF5_SRC_DIR}/H5err.txt + COMMENT " Creating err header" + ) + + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5version.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SRC_DIR}/H5vers.txt + DEPENDS ${HDF5_SRC_DIR}/H5vers.txt + COMMENT " Creating API version macro" + ) + + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5overflow.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt + DEPENDS ${HDF5_SRC_DIR}/H5overflow.txt + COMMENT " Creating Assignment overflow macro" + ) + + add_custom_target(generate_precompiled DEPENDS + "${HDF5_SRC_DIR}/H5version.h;${HDF5_SRC_DIR}/H5overflow.h") + + add_custom_target(run_perl_scripts ALL + DEPENDS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5version.h ${HDF5_SRC_DIR}/H5overflow.h + ) + else (PERL_FOUND) + message (STATUS "Cannot generate headers - perl not found") + endif (PERL_FOUND) +endif (HDF5_GENERATE_HEADERS) + #----------------------------------------------------------------------------- # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside @@ -778,6 +827,7 @@ TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif (MSVC OR MINGW) +add_dependencies(H5detect generate_precompiled) set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( @@ -792,6 +842,7 @@ TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif (MSVC OR MINGW) +add_dependencies(H5make_libsettings generate_precompiled) set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( @@ -802,59 +853,13 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) -if (GENERATE_ERROR_HEADERS) - find_package (Perl) - if (PERL_FOUND) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5Edefin.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SOURCE_DIR}/src/H5err.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5err.txt - COMMENT " Creating err header" - ) - - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5version.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SOURCE_DIR}/src/H5vers.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5vers.txt - COMMENT " Creating API version macro" - ) - - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5overflow.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SOURCE_DIR}/src/H5overflow.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5overflow.txt - COMMENT " Creating Assignment overflow macro" - ) - - add_custom_target(run_perl_scripts ALL - DEPENDS ${HDF5_BINARY_DIR}/H5Edefin.h ${HDF5_BINARY_DIR}/H5version.h ${HDF5_BINARY_DIR}/H5overflow.h - ) - else (PERL_FOUND) - message (STATUS "Cannot generate headers - perl not found") - endif (PERL_FOUND) -endif (GENERATE_ERROR_HEADERS) - #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5Detect/CMake at configure time #----------------------------------------------------------------------------- set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5Tinit.c) -set_source_files_properties (${HDF5_BINARY_DIR}/H5Tinit.c GENERATED) set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5lib_settings.c) -set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5Edefin.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5Edefin.h GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5version.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5version.h GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED) - -add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) + +add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) if (NOT WIN32) @@ -74,6 +74,7 @@ hbool_t H5_api_entered_g = FALSE; H5_api_t H5_g; #else hbool_t H5_libinit_g = FALSE; /* Library hasn't been initialized */ +hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */ #endif #ifdef H5_HAVE_MPE @@ -261,6 +262,9 @@ H5_term_library(void) if(!(H5_INIT_GLOBAL)) goto done; + /* Indicate that the library is being shut down */ + H5_TERM_GLOBAL = TRUE; + /* Check if we should display error output */ (void)H5Eget_auto2(H5E_DEFAULT, &func, NULL); @@ -270,7 +274,7 @@ H5_term_library(void) * way that would necessitate some cleanup work in the other interface. */ #define DOWN(F) \ - (((n = H5##F##_term_interface()) && (at + 8) < sizeof loop)? \ + (((n = H5##F##_term_package()) && (at + 8) < sizeof loop)? \ (sprintf(loop + at, "%s%s", (at ? "," : ""), #F), \ at += HDstrlen(loop + at), \ n): \ @@ -281,20 +285,46 @@ 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 */ - pending += DOWN(R); - pending += DOWN(D); pending += DOWN(L); - pending += DOWN(G); - pending += DOWN(A); - pending += DOWN(S); - pending += DOWN(T); + + /* Close the "top" of various interfaces (IDs, etc) but don't shut + * down the whole interface yet, so that the object header messages + * get serialized correctly for entries in the metadata cache and the + * symbol table entry in the superblock gets serialized correctly, etc. + * all of which is performed in the 'F' shutdown. + */ + pending += DOWN(A_top); + pending += DOWN(D_top); + pending += DOWN(G_top); + pending += DOWN(R_top); + pending += DOWN(S_top); + pending += DOWN(T_top); + /* Don't shut down the file code until objects in files are shut down */ if(pending == 0) pending += DOWN(F); + /* Wait to shut down the "bottom" of various interfaces until the + * files are closed, so pieces of the file can be serialized + * correctly. + */ + if(pending == 0) { + /* Shut down the "bottom" of the attribute, dataset, group, + * reference, dataspace, and datatype interfaces, fully closing + * out the interfaces now. + */ + pending += DOWN(A); + pending += DOWN(D); + pending += DOWN(G); + pending += DOWN(R); + pending += DOWN(S); + pending += DOWN(T); + } /* end if */ + /* Don't shut down "low-level" components until "high-level" components * have successfully shut down. This prevents property lists and IDs * from being closed "out from underneath" of the high-level objects @@ -303,8 +333,8 @@ H5_term_library(void) if(pending == 0) { pending += DOWN(AC); pending += DOWN(Z); - pending += DOWN(FD); pending += DOWN(P); + pending += DOWN(FD); pending += DOWN(PL); /* Don't shut down the error code until other APIs which use it are shut down */ if(pending == 0) @@ -318,7 +348,7 @@ H5_term_library(void) /* Don't shut down the free list code until _everything_ else is down */ if(pending == 0) pending += DOWN(FL); - } + } /* end if */ } while(pending && ntries++ < 100); if(pending) { @@ -362,12 +392,17 @@ H5_term_library(void) (void)H5MM_free(tmp_open_stream); } /* end while */ + /* Reset flag indicating that the library is being shut down */ + H5_TERM_GLOBAL = FALSE; + /* Mark library as closed */ H5_INIT_GLOBAL = FALSE; + done: #ifdef H5_HAVE_THREADSAFE H5_API_UNLOCK #endif /* H5_HAVE_THREADSAFE */ + return; } /* end H5_term_library() */ @@ -17,11 +17,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5A__init_interface +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -37,6 +34,7 @@ #include "H5Sprivate.h" /* Dataspace functions */ #include "H5SMprivate.h" /* Shared Object Header Messages */ + /****************/ /* Local Macros */ /****************/ @@ -68,6 +66,9 @@ typedef struct H5A_iter_cb1 { /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -95,39 +96,16 @@ static const H5I_class_t H5I_ATTR_CLS[1] = {{ (H5I_free_t)H5A_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5A_top_package_initialize_s = FALSE; - -/*------------------------------------------------------------------------- - * Function: H5A_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A_init() */ /*-------------------------------------------------------------------------- NAME - H5A__init_interface -- Initialize interface-specific information + H5A__init_package -- Initialize interface-specific information USAGE - herr_t H5A__init_interface() + herr_t H5A__init_package() RETURNS Non-negative on success/Negative on failure @@ -135,12 +113,12 @@ DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5A__init_interface(void) +herr_t +H5A__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* * Create attribute ID type. @@ -148,21 +126,25 @@ H5A__init_interface(void) if(H5I_register_type(H5I_ATTR_CLS) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Mark "top" of interface as initialized, too */ + H5A_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A__init_interface() */ +} /* end H5A__init_package() */ /*-------------------------------------------------------------------------- NAME - H5A_term_interface + H5A_top_term_package PURPOSE Terminate various H5A objects USAGE - void H5A_term_interface() + void H5A_top_term_package() RETURNS DESCRIPTION - Release any other resources allocated. + Release IDs for the atom group, deferring full interface shutdown + until later (in H5A_term_package). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -170,32 +152,68 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5A_term_interface(void) +H5A_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5A_top_package_initialize_s) { if(H5I_nmembers(H5I_ATTR) > 0) { (void)H5I_clear_type(H5I_ATTR, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close deprecated interface */ - n += H5A__term_deprec_interface(); - /* Destroy the attribute object id group */ - (void)H5I_dec_type_ref(H5I_ATTR); - n++; /*H5I*/ + /* Mark closed */ + if(0 == n) + H5A_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* H5A_top_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5A_term_package + PURPOSE + Terminate various H5A objects + USAGE + void H5A_term_package() + RETURNS + DESCRIPTION + Release any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + + Finishes shutting down the interface, after H5A_top_term_package() + is called + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5A_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_ATTR)); + HDassert(FALSE == H5A_top_package_initialize_s); + + /* Destroy the attribute object id group */ + n += (H5I_dec_type_ref(H5I_ATTR) > 0); - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* H5A_term_interface() */ +} /* H5A_term_package() */ /*-------------------------------------------------------------------------- @@ -31,11 +31,9 @@ /* Module Setup */ /****************/ -#define H5AC_PACKAGE /*suppress error about including H5ACpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5ACmodule.h" /* This source code file is part of the H5AC module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5AC_init_interface /***********/ /* Headers */ @@ -74,6 +72,9 @@ static herr_t H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -135,7 +136,6 @@ static const char *H5AC_entry_type_names[H5AC_NTYPES] = * Purpose: Initialize the interface from some other layer. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol @@ -146,7 +146,7 @@ static const char *H5AC_entry_type_names[H5AC_NTYPES] = herr_t H5AC_init(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* FUNC_ENTER() does all the work */ @@ -157,7 +157,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_init_interface + * Function: H5AC__init_package * * Purpose: Initialize interface-specific information * @@ -168,8 +168,8 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5AC_init_interface(void) +herr_t +H5AC__init_package(void) { #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ @@ -177,7 +177,7 @@ H5AC_init_interface(void) #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE #ifdef H5_HAVE_PARALLEL /* Sanity check */ @@ -224,17 +224,16 @@ H5AC_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5AC_init_interface() */ +} /* end H5AC__init_package() */ /*------------------------------------------------------------------------- - * Function: H5AC_term_interface + * Function: H5AC_term_package * * Purpose: Terminate this interface. * * Return: Success: Positive if anything was done that might * affect other interfaces; zero otherwise. - * * Failure: Negative. * * Programmer: Quincey Koziol @@ -243,13 +242,13 @@ done: *------------------------------------------------------------------------- */ int -H5AC_term_interface(void) +H5AC_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { #ifdef H5_HAVE_PARALLEL if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) { /* Indicate more work to do */ @@ -258,30 +257,20 @@ H5AC_term_interface(void) /* Close H5AC dxpl */ if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ - else { - /* Reset static IDs */ - H5AC_dxpl_id = (-1); - H5AC_ind_dxpl_id = (-1); - - /* Reset interface initialization flag */ - H5_interface_initialize_g = 0; - } /* end else */ } /* end if */ - else { -#endif /* H5_HAVE_PARALLEL */ - /* Reset static IDs */ - H5AC_dxpl_id = (-1); - H5AC_ind_dxpl_id = (-1); -#ifdef H5_HAVE_PARALLEL - } /* end else */ #endif /* H5_HAVE_PARALLEL */ + + /* Reset static IDs */ + H5AC_dxpl_id = (-1); + H5AC_ind_dxpl_id = (-1); /* Reset interface initialization flag */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5AC_term_interface() */ +} /* end H5AC_term_package() */ /*------------------------------------------------------------------------- @@ -1066,7 +1055,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, size_t trace_entry_size = 0; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5ACmodule.h b/src/H5ACmodule.h new file mode 100644 index 0000000..a8dba59 --- /dev/null +++ b/src/H5ACmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5AC package. Including this header means that the source file + * is part of the H5AC package. + */ +#ifndef _H5ACmodule_H +#define _H5ACmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5AC_MODULE +#define H5_MY_PKG H5AC +#define H5_MY_PKG_ERR H5E_CACHE +#define H5_MY_PKG_INIT YES + +#endif /* _H5ACmodule_H */ + diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 6c2b924..fdad19a 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -29,11 +29,9 @@ /* Module Setup */ /****************/ -#define H5AC_PACKAGE /*suppress error about including H5ACpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5ACmodule.h" /* This source code file is part of the H5AC module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5AC__init_mpio_interface /***********/ /* Headers */ @@ -135,33 +133,6 @@ H5FL_DEFINE(H5AC_aux_t); H5FL_DEFINE_STATIC(H5AC_slist_entry_t); -/*------------------------------------------------------------------------- - * Function: H5AC__init_mpio_interface - * - * Purpose: Initialize interface-specific information - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 6/20/15 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5AC__init_mpio_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Funnel all work to H5AC_init() */ - if(H5AC_init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "interface initialization failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__init_mpio_interface() */ - /*------------------------------------------------------------------------- * Function: H5AC__set_sync_point_done_callback diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 74bf079..050e21c 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -28,7 +28,7 @@ * */ -#ifndef H5AC_PACKAGE +#if !(defined H5AC_FRIEND || defined H5AC_MODULE) #error "Do not include this file outside the H5AC package!" #endif diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 5e29d3f..28e49a6 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ /***********/ @@ -247,7 +247,7 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -438,7 +438,7 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Adense.c b/src/H5Adense.c index 6d18249..3dc3a42 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -29,8 +29,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -1149,7 +1149,7 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ 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_NOAPI(FAIL) @@ -1701,7 +1701,7 @@ H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char * htri_t attr_sharable; /* Flag indicating attributes are sharable */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) /* * Check arguments. diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index ccc7659..ae0f041 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -31,11 +31,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5A__init_deprec_interface +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -84,51 +81,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5A__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5A__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5A_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5A__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5A_init()) -} /* H5A__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5A__term_deprec_interface -- Terminate interface -USAGE - herr_t H5A__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5A__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5A__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Aint.c b/src/H5Aint.c index 91bbc24..193e8f4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -142,11 +142,11 @@ H5A_t * H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id) { - H5A_t *attr = NULL; /* Attribute created */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute */ - htri_t tri_ret; /* htri_t return value */ - H5A_t *ret_value; /* Return value */ + H5A_t *attr = NULL; /* Attribute created */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ + htri_t exists; /* Whether attribute exists */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->oloc->addr, NULL) @@ -161,9 +161,9 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((tri_ret = H5O_attr_exists(loc->oloc, name, H5AC_ind_dxpl_id)) < 0) + if((exists = H5O_attr_exists(loc->oloc, name, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") - else if(tri_ret > 0) + else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") /* Check if the dataspace has an extent set (or is NULL) */ @@ -360,7 +360,7 @@ H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -424,7 +424,7 @@ H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_na H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -705,7 +705,7 @@ ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) { size_t copy_len, nbytes; - ssize_t ret_value; + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -849,7 +849,8 @@ H5A_get_create_plist(H5A_t* attr) H5P_genplist_t *plist; /* Default property list */ hid_t new_plist_id; /* ID of ACPL to return */ H5P_genplist_t *new_plist; /* ACPL to return */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT if(NULL == (plist = (H5P_genplist_t *)H5I_object(H5P_LST_ATTRIBUTE_CREATE_ID_g))) @@ -888,7 +889,9 @@ done: herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo) { - FUNC_ENTER_NOAPI_NOERR + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(attr); @@ -906,7 +909,8 @@ H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo) ainfo->corder = attr->shared->crt_idx; } /* end else */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_info() */ @@ -1099,15 +1103,16 @@ done: H5O_loc_t * H5A_oloc(H5A_t *attr) { - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(NULL) HDassert(attr); /* Set return value */ ret_value = &(attr->oloc); +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_oloc() */ @@ -1130,15 +1135,16 @@ H5A_oloc(H5A_t *attr) H5G_name_t * H5A_nameof(H5A_t *attr) { - H5G_name_t *ret_value; /* Return value */ + H5G_name_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(NULL) HDassert(attr); /* Set return value */ - ret_value=&(attr->path); + ret_value = &(attr->path); +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_nameof() */ @@ -1159,15 +1165,16 @@ H5A_nameof(H5A_t *attr) H5T_t * H5A_type(const H5A_t *attr) { - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(NULL) HDassert(attr); /* Set return value */ ret_value = attr->shared->dt; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_type() */ @@ -1193,7 +1200,7 @@ H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, 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 */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1552,7 +1559,7 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) static int H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1587,7 +1594,7 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) static int H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1790,8 +1797,8 @@ done: htri_t H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) { - 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_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL) @@ -1857,8 +1864,9 @@ H5A_set_version(const H5F_t *f, H5A_t *attr) { hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* check arguments */ HDassert(f); @@ -1888,7 +1896,8 @@ H5A_set_version(const H5F_t *f, H5A_t *attr) else attr->shared->version = H5O_ATTR_VERSION_1; /* Write out basic version */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_set_version() */ @@ -1925,8 +1934,7 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si void *buf = NULL; /* Buffer for copying data */ void *reclaim_buf = NULL; /* Buffer for reclaiming data */ hid_t buf_sid = -1; /* ID for buffer dataspace */ - - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Amodule.h b/src/H5Amodule.h new file mode 100644 index 0000000..e347fe1 --- /dev/null +++ b/src/H5Amodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5A package. Including this header means that the source file + * is part of the H5A package. + */ +#ifndef _H5Amodule_H +#define _H5Amodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5A_MODULE +#define H5_MY_PKG H5A +#define H5_MY_PKG_ERR H5E_ATTR +#define H5_MY_PKG_INIT YES + +#endif /* _H5Amodule_H */ + diff --git a/src/H5Apkg.h b/src/H5Apkg.h index d3fcd53..b815d11 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -21,7 +21,7 @@ * the H5A package. Source files outside the H5A package should * include H5Aprivate.h instead. */ -#ifndef H5A_PACKAGE +#if !(defined H5A_FRIEND || defined H5A_MODULE) #error "Do not include this file outside the H5A package!" #endif @@ -184,8 +184,6 @@ H5_DLLVAR const H5B2_class_t H5A_BT2_CORDER[1]; /******************************/ /* Function prototypes for H5A package scope */ -H5_DLL herr_t H5A_init(void); -H5_DLL herr_t H5A__term_deprec_interface(void); H5_DLL H5A_t *H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id); H5_DLL H5A_t *H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, diff --git a/src/H5Atest.c b/src/H5Atest.c index 19b5547..d57bbe1 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ #define H5A_TESTING /*suppress warning about H5A testing funcs*/ @@ -95,7 +95,7 @@ htri_t H5A_is_shared_test(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -97,7 +97,7 @@ /* Module Setup */ /****************/ -#define H5B_PACKAGE /*suppress error about including H5Bpkg */ +#include "H5Bmodule.h" /* This source code file is part of the H5B module */ /***********/ @@ -166,6 +166,9 @@ static H5B_t * H5B__copy(const H5B_t *old_bt); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the haddr_t sequence information */ H5FL_SEQ_DEFINE(haddr_t); @@ -309,7 +312,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ unsigned idx = 0, lt = 0, rt; /* Final, left & right key indices */ int cmp = 1; /* Key comparison value */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1203,7 +1206,7 @@ herr_t H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, void *udata) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOERR @@ -1700,7 +1703,7 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) { H5B_shared_t *shared = NULL; /* New shared B-tree struct */ size_t u; /* Local index variable */ - H5B_shared_t *ret_value; /* Return value */ + H5B_shared_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1808,7 +1811,7 @@ H5B__copy(const H5B_t *old_bt) { H5B_t *new_node = NULL; H5B_shared_t *shared; /* Pointer to shared B-tree info */ - H5B_t *ret_value; + H5B_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -33,7 +33,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ @@ -67,6 +68,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* v2 B-tree client ID to class mapping */ /* Remember to add client ID to H5B2_subid_t in H5B2private.h when adding a new @@ -132,7 +136,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udat H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ haddr_t hdr_addr; /* B-tree header address */ - H5B2_t *ret_value; /* Return value */ + H5B2_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -206,7 +210,7 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata) H5B2_t *bt2 = NULL; /* Pointer to the B-tree */ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ - H5B2_t *ret_value; /* Return value */ + H5B2_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 9e43ff8..421e24b 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ /***********/ @@ -216,7 +216,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ - H5B2_hdr_t *ret_value; /* Return value */ + H5B2_hdr_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -490,7 +490,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - H5B2_internal_t *ret_value; /* Return value */ + H5B2_internal_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -798,7 +798,7 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - H5B2_leaf_t *ret_value; /* Return value */ + H5B2_leaf_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index d3b5014..f723d10 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index d873cf6..16d8467 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ @@ -239,7 +240,7 @@ H5B2_hdr_t * H5B2__hdr_alloc(H5F_t *f) { H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */ - H5B2_hdr_t *ret_value; /* Return value */ + H5B2_hdr_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -285,8 +286,8 @@ haddr_t H5B2__hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udata) { - H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */ - haddr_t ret_value; /* Return value */ + H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5B2int.c b/src/H5B2int.c index 0f884c2..f412260 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ @@ -1837,7 +1838,7 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, uint16_t nrec, unsigned flags) { H5B2_leaf_cache_ud_t udata; /* User-data for callback */ - H5B2_leaf_t *ret_value; /* Return value */ + H5B2_leaf_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1959,7 +1960,7 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, uint16_t nrec, uint16_t depth, unsigned flags) { H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */ - H5B2_internal_t *ret_value; /* Return value */ + H5B2_internal_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5B2module.h b/src/H5B2module.h new file mode 100644 index 0000000..0fc30a5 --- /dev/null +++ b/src/H5B2module.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5B2 package. Including this header means that the source file + * is part of the H5B2 package. + */ +#ifndef _H5B2module_H +#define _H5B2module_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5B2_MODULE +#define H5_MY_PKG H5B2 +#define H5_MY_PKG_ERR H5E_BTREE +#define H5_MY_PKG_INIT NO + +#endif /* _H5B2module_H */ + + diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index b13c58d..d661efa 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -21,7 +21,7 @@ * the H5B2 package. Source files outside the H5B2 package should * include H5B2private.h instead. */ -#ifndef H5B2_PACKAGE +#if !(defined H5B2_FRIEND || defined H5B2_MODULE) #error "Do not include this file outside the H5B2 package!" #endif diff --git a/src/H5B2stat.c b/src/H5B2stat.c index bdb4a1f..10c692e 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -24,7 +24,7 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /* Suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ /***********/ diff --git a/src/H5B2test.c b/src/H5B2test.c index 31cf8e1..8ed364e 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ #define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ @@ -120,7 +120,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -469,7 +469,7 @@ 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 */ + int ret_value = -1; /* Return information */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Bcache.c b/src/H5Bcache.c index d071712..d08f1bc 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5B_PACKAGE /*suppress error about including H5Bpkg */ +#include "H5Bmodule.h" /* This source code file is part of the H5B module */ /***********/ @@ -151,7 +151,7 @@ H5B__deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata, const uint8_t *image = (const uint8_t *)_image; /* Pointer into image buffer */ uint8_t *native; /* Pointer to native keys */ unsigned u; /* Local index variable */ - H5B_t *ret_value; /* Return value */ + H5B_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index e6d54dc..d92a24b 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5B_PACKAGE /*suppress error about including H5Bpkg */ +#include "H5Bmodule.h" /* This source code file is part of the H5B module */ /***********/ diff --git a/src/H5Bmodule.h b/src/H5Bmodule.h new file mode 100644 index 0000000..6800b26 --- /dev/null +++ b/src/H5Bmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5B package. Including this header means that the source file + * is part of the H5B package. + */ +#ifndef _H5Bmodule_H +#define _H5Bmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5B_MODULE +#define H5_MY_PKG H5B +#define H5_MY_PKG_ERR H5E_BTREE +#define H5_MY_PKG_INIT NO + +#endif /* _H5Bmodule_H */ + diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index 374fcb5..e645626 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -21,7 +21,7 @@ * the H5B package. Source files outside the H5B package should * include H5Bprivate.h instead. */ -#ifndef H5B_PACKAGE +#if !(defined H5B_FRIEND || defined H5B_MODULE) #error "Do not include this file outside the H5B package!" #endif @@ -74,8 +74,8 @@ /* Module Setup */ /****************/ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /***********/ @@ -107,6 +107,7 @@ #define H5C_IMAGE_EXTRA_SPACE 0 #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + /******************/ /* Local Typedefs */ /******************/ @@ -203,6 +204,9 @@ herr_t H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -2598,7 +2602,7 @@ H5C_protect(H5F_t * f, size_t empty_space; void * thing; H5C_cache_entry_t * entry_ptr; - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -8291,7 +8295,7 @@ H5C_load_entry(H5F_t * f, H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */ size_t len; /* Size of image in file */ unsigned u; /* Local index variable */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -30,10 +30,19 @@ #include "H5private.h" /* Generic Functions */ #include "H5CSprivate.h" /* Function stack */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5Eprivate.h" /* Error handling */ #ifdef H5_HAVE_CODESTACK +#define H5CS_MIN_NSLOTS 16 /* Minimum number of records in an function stack */ + +/* A function stack */ +typedef struct H5CS_t { + unsigned nused; /* Number of records currently used in stack */ + unsigned nalloc; /* Number of records current allocated for stack */ + const char **rec; /* Array of function records */ +} H5CS_t; + #ifdef H5_HAVE_THREADSAFE /* * The per-thread function stack. pthread_once() initializes a special @@ -44,8 +53,8 @@ * In order for this macro to work, H5CS_get_my_stack() must be preceeded * by "H5CS_t *fstack =". */ -static H5CS_t *H5CS_get_stack(void); -#define H5CS_get_my_stack() H5CS_get_stack() +static H5CS_t *H5CS__get_stack(void); +#define H5CS_get_my_stack() H5CS__get_stack() #else /* H5_HAVE_THREADSAFE */ /* * The function stack. Eventually we'll have some sort of global table so each @@ -58,7 +67,7 @@ H5CS_t H5CS_stack_g[1]; #ifdef H5_HAVE_THREADSAFE /*------------------------------------------------------------------------- - * Function: H5CS_get_stack + * Function: H5CS__get_stack * * Purpose: Support function for H5CS_get_my_stack() to initialize and * acquire per-thread function stack. @@ -70,19 +79,17 @@ H5CS_t H5CS_stack_g[1]; * Programmer: Quincey Koziol * February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5CS_t * -H5CS_get_stack(void) +H5CS__get_stack(void) { H5CS_t *fstack; - FUNC_ENTER_NOAPI_NOERR_NOFS + FUNC_ENTER_STATIC_NOERR_NOFS fstack = H5TS_get_thread_local_value(H5TS_funcstk_key_g); - if (!fstack) { + if(!fstack) { /* No associated value with current thread - create one */ #ifdef H5_HAVE_WIN_THREADS fstack = (H5CS_t *)LocalAlloc(LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ @@ -92,17 +99,19 @@ H5CS_get_stack(void) HDassert(fstack); /* Set the thread-specific info */ - fstack->nused=0; + fstack->nused = 0; + fstack->nalloc = 0; + fstack->rec = NULL; /* (It's not necessary to release this in this API, it is * released by the "key destructor" set up in the H5TS * routines. See calls to pthread_key_create() in H5TS.c -QAK) */ H5TS_set_thread_local_value(H5TS_funcstk_key_g, (void *)fstack); - } + } /* end if */ - FUNC_LEAVE_NOAPI_NOFS(fstack); -} /* end H5CS_get_stack() */ + FUNC_LEAVE_NOAPI_NOFS(fstack) +} /* end H5CS__get_stack() */ #endif /* H5_HAVE_THREADSAFE */ @@ -133,59 +142,28 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream) HDassert(fstack); /* Default to outputting information to stderr */ - if (!stream) + if(!stream) stream = stderr; - HDfprintf (stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g); + 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()); + HDfprintf(stream, "thread %lu.", HDpthread_self_ulong()); #else /* H5_HAVE_THREADSAFE */ - HDfprintf (stream, "thread 0."); + HDfprintf(stream, "thread 0."); #endif /* H5_HAVE_THREADSAFE */ - if (fstack && fstack->nused>0) - HDfprintf (stream, " Back trace follows."); - HDfputc ('\n', stream); + if(fstack && fstack->nused>0) + HDfprintf(stream, " Back trace follows."); + HDfputc('\n', stream); - for (i=fstack->nused-1; i>=0; --i) - HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->slot[i]); + for(i = fstack->nused - 1; i >= 0; --i) + HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]); - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_print_stack() */ /*------------------------------------------------------------------------- - * Function: H5CS_print - * - * Purpose: Prints the default function stack in some default way. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, February 6, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5CS_print(FILE *stream) -{ - H5CS_t *fstack = H5CS_get_my_stack (); /* Get the correct function stack */ - - /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS - - /* Sanity check */ - HDassert(fstack); - - H5CS_print_stack(fstack, stream); - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); -} /* end H5CS_print() */ - - -/*------------------------------------------------------------------------- * Function: H5CS_push * * Purpose: Pushes a new record onto function stack for the current @@ -196,30 +174,37 @@ 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 /* Sanity check */ HDassert(fstack); + HDassert(fstack->nused <= fstack->nalloc); HDassert(func_name); - /* - * Push the function if there's room. Otherwise just increment count - */ - if (fstack->nused<H5CS_NSLOTS) - fstack->slot[fstack->nused] = func_name; + /* Check if we need to expand the stack of records */ + if(fstack->nused == fstack->nalloc) { + size_t na = MAX((fstack->nalloc * 2), H5CS_MIN_NSLOTS); + const char **x = (const char **)HDrealloc(fstack->rec, na * sizeof(const char *)); + + /* (Avoid returning an error from this routine, currently -QAK) */ + HDassert(x); + fstack->rec = x; + fstack->nalloc = na; + } /* end if */ + + /* Push the function name */ + fstack->rec[fstack->nused] = func_name; fstack->nused++; - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_push() */ @@ -240,14 +225,14 @@ H5CS_push(const char *func_name) herr_t H5CS_pop(void) { - H5CS_t *fstack = H5CS_get_my_stack (); + H5CS_t *fstack = H5CS_get_my_stack(); /* Don't push this function on the function stack... :-) */ FUNC_ENTER_NOAPI_NOERR_NOFS /* Sanity check */ HDassert(fstack); - HDassert(fstack->nused>0); + HDassert(fstack->nused > 0); /* Pop the function. */ fstack->nused--; @@ -266,43 +251,52 @@ H5CS_pop(void) * Programmer: Quincey Koziol * Tuesday, August 9, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ -herr_t -H5CS_copy_stack(H5CS_t *new_stack) +H5CS_t * +H5CS_copy_stack(void) { - H5CS_t *old_stack = H5CS_get_my_stack (); + H5CS_t *old_stack = H5CS_get_my_stack(); /* Existing function stack for library */ + H5CS_t *new_stack; /* New function stack, for copy */ unsigned u; /* Local index variable */ + H5CS_t *ret_value = NULL; /* Return value */ /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS + FUNC_ENTER_NOAPI_NOFS /* Sanity check */ HDassert(old_stack); + /* Allocate a new stack */ + /* (Don't use library allocate code, since this code stack supports it) */ + if(NULL == (new_stack = HDcalloc(1, sizeof(H5CS_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack") + if(NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records") + /* Copy old stack to new one, duplicating the strings */ for(u = 0; u < old_stack->nused; u++) - new_stack->slot[u] = H5MM_strdup(old_stack->slot[u]); - new_stack->nused = old_stack->nused; + new_stack->rec[u] = HDstrdup(old_stack->rec[u]); + new_stack->nused = new_stack->nalloc = old_stack->nused; - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + /* Set the return value */ + ret_value = new_stack; + +done: + FUNC_LEAVE_NOAPI_NOFS(ret_value) } /* end H5CS_copy_stack() */ /*------------------------------------------------------------------------- * Function: H5CS_close_stack * - * Purpose: Closes a copy of a stack + * Purpose: Closes and frees a copy of a stack * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Tuesday, August 9, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -316,11 +310,20 @@ H5CS_close_stack(H5CS_t *stack) /* Sanity check */ HDassert(stack); - /* Free strings on stack */ - for(u = 0; u < stack->nused; u++) - stack->slot[u] = H5MM_xfree((void *)stack->slot[u]); - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + /* Free stack */ + for(u = 0; u < stack->nused; u++) { + if(stack->rec[u]) + HDfree((void *)stack->rec[u]); + stack->rec[u] = NULL; + } /* end for */ + if(stack->rec) { + HDfree(stack->rec); + stack->rec = NULL; + } /* end if */ + if(stack) + HDfree(stack); + + FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_close_stack() */ #endif /* H5_HAVE_CODESTACK */ diff --git a/src/H5CSprivate.h b/src/H5CSprivate.h index 13f3b66..ab7f993 100644 --- a/src/H5CSprivate.h +++ b/src/H5CSprivate.h @@ -26,19 +26,13 @@ /* Private headers needed by this file */ #include "H5private.h" -#define H5CS_NSLOTS 48 /*number of slots in an function stack */ - -/* A function stack */ -typedef struct H5CS_t { - unsigned nused; /*num slots currently used in stack */ - const char *slot[H5CS_NSLOTS]; /*array of function records */ -} H5CS_t; - -H5_DLL herr_t H5CS_push (const char *func_name); -H5_DLL herr_t H5CS_pop (void); -H5_DLL herr_t H5CS_print (FILE *stream); -H5_DLL herr_t H5CS_print_stack (const H5CS_t *stack, FILE *stream); -H5_DLL herr_t H5CS_copy_stack (H5CS_t *stack); -H5_DLL herr_t H5CS_close_stack (H5CS_t *stack); +/* Forward declarations for structure fields */ +struct H5CS_t; +H5_DLL herr_t H5CS_push(const char *func_name); +H5_DLL herr_t H5CS_pop(void); +H5_DLL herr_t H5CS_print_stack(const struct H5CS_t *stack, FILE *stream); +H5_DLL struct H5CS_t *H5CS_copy_stack(void); +H5_DLL herr_t H5CS_close_stack(struct H5CS_t *stack); #endif /* _H5CSprivate_H */ + diff --git a/src/H5Cmodule.h b/src/H5Cmodule.h new file mode 100644 index 0000000..2c39eab --- /dev/null +++ b/src/H5Cmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5C package. Including this header means that the source file + * is part of the H5C package. + */ +#ifndef _H5Cmodule_H +#define _H5Cmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5C_MODULE +#define H5_MY_PKG H5C +#define H5_MY_PKG_ERR H5E_CACHE +#define H5_MY_PKG_INIT NO + +#endif /* _H5Cmodule_H */ + diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index ec34285..6b63ad5 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -29,8 +29,8 @@ /* Module Setup */ /****************/ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /***********/ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index ea965fd..6ef2c96 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -28,7 +28,7 @@ * reason why this file was created. */ -#ifndef H5C_PACKAGE +#if !(defined H5C_FRIEND || defined H5C_MODULE) #error "Do not include this file outside the H5C package!" #endif @@ -836,7 +836,7 @@ if ( ( (entry_ptr) == NULL ) || \ #define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) -#define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3) +#define H5C__HASH_FCN(x) (int)((unsigned)((x) & H5C__HASH_MASK) >> 3) #if H5C_DO_SANITY_CHECKS @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_pub_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -52,6 +49,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare extern the free list to manage blocks of VL data */ H5FL_BLK_EXTERN(vlen_vl_buf); @@ -73,51 +73,6 @@ H5FL_BLK_EXTERN(type_conv); -/*-------------------------------------------------------------------------- -NAME - H5D__init_pub_interface -- Initialize interface-specific information -USAGE - herr_t H5D__init_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5D_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5D__init_pub_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5D_init()) -} /* H5D__init_pub_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5D__term_pub_interface -- Terminate interface -USAGE - herr_t H5D__term_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5D__term_pub_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5D__term_pub_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Dcreate2 * diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index a4009a9..762c252 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -26,7 +26,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -331,7 +331,7 @@ 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; + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -553,7 +553,7 @@ H5D__btree_insert(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, void *_l 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 @@ -969,7 +969,7 @@ done: static hbool_t H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1085,7 +1085,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 @@ -1127,7 +1127,7 @@ 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 */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 8584d0a..1987b40 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -44,7 +44,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -205,6 +205,7 @@ static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *ty H5D_chunk_map_t *fm); static herr_t H5D__chunk_flush(H5D_t *dset, hid_t dxpl_id); static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm); +static herr_t H5D__chunk_dest(H5D_t *dset, hid_t dxpl_id); /* "Nonexistent" layout operation callback */ static ssize_t @@ -268,7 +269,8 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ NULL, NULL, H5D__chunk_flush, - H5D__chunk_io_term + H5D__chunk_io_term, + H5D__chunk_dest }}; @@ -291,6 +293,7 @@ const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{ H5D__nonexistent_readvv, NULL, NULL, + NULL, NULL }}; @@ -683,7 +686,7 @@ done: hbool_t H5D__chunk_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 @@ -2190,6 +2193,72 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__chunk_dest + * + * Purpose: Destroy the entire chunk cache by flushing dirty entries, + * preempting all entries, and freeing the cache itself. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Thursday, May 21, 1998 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__chunk_dest(H5D_t *dset, hid_t dxpl_id) +{ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ + H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */ + H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */ + int nerrors = 0; /* Accumulated count of errors */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) + + /* Sanity check */ + HDassert(dset); + + /* Fill the DXPL cache values for later use */ + if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) + nerrors++; + + /* Flush all the cached chunks */ + for(ent = rdcc->head; ent; ent = next) { + next = ent->next; + if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) + nerrors++; + } /* end for */ + + /* Continue even if there are failures. */ + if(nerrors) + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + + /* Release cache structures */ + if(rdcc->slot) + rdcc->slot = H5FL_SEQ_FREE(H5D_rdcc_ent_ptr_t, rdcc->slot); + HDmemset(rdcc, 0, sizeof(H5D_rdcc_t)); + + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.dxpl_id = dxpl_id; + idx_info.pline = &dset->shared->dcpl_cache.pline; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; + + /* Free any index structures */ + if(dset->shared->layout.storage.u.chunk.ops->dest && + (dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + +done: + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) +} /* end H5D__chunk_dest() */ + + +/*------------------------------------------------------------------------- * Function: H5D_chunk_idx_reset * * Purpose: Reset index information @@ -2401,7 +2470,7 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) { hsize_t val; /* Intermediate value */ unsigned ndims = shared->ndims; /* Rank of dataset */ - unsigned ret; /* Value to return */ + unsigned ret = 0; /* Value to return */ FUNC_ENTER_STATIC_NOERR @@ -2894,7 +2963,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, H5D_rdcc_ent_t *ent; /*cache entry */ size_t chunk_size; /*size of a chunk */ void *chunk = NULL; /*the file chunk */ - void *ret_value; /*return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -5158,72 +5227,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_dump_index() */ - -/*------------------------------------------------------------------------- - * Function: H5D__chunk_dest - * - * Purpose: Destroy the entire chunk cache by flushing dirty entries, - * preempting all entries, and freeing the cache itself. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5D__chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset) -{ - H5D_chk_idx_info_t idx_info; /* Chunked index info */ - H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ - H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ - H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */ - H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */ - int nerrors = 0; /* Accumulated count of errors */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL) - - HDassert(f); - HDassert(dset); - - /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") - - /* Flush all the cached chunks */ - for(ent = rdcc->head; ent; ent = next) { - next = ent->next; - if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) - nerrors++; - } /* end for */ - - /* Continue even if there are failures. */ - if(nerrors) - HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") - - /* Release cache structures */ - if(rdcc->slot) - rdcc->slot = H5FL_SEQ_FREE(H5D_rdcc_ent_ptr_t, rdcc->slot); - HDmemset(rdcc, 0, sizeof(H5D_rdcc_t)); - - /* Compose chunked index info struct */ - idx_info.f = f; - idx_info.dxpl_id = dxpl_id; - idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; - - /* Free any index structures */ - if(dset->shared->layout.storage.u.chunk.ops->dest && - (dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") - -done: - FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5D__chunk_dest() */ - #ifdef H5D_CHUNK_DEBUG /*------------------------------------------------------------------------- @@ -5364,7 +5367,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, 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 */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index acb4541..ebe75bd 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -70,6 +70,7 @@ static ssize_t H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]); static herr_t H5D__compact_flush(H5D_t *dset, hid_t dxpl_id); +static herr_t H5D__compact_dest(H5D_t *dset, hid_t dxpl_id); /*********************/ @@ -91,7 +92,8 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ H5D__compact_readvv, H5D__compact_writevv, H5D__compact_flush, - NULL + NULL, + H5D__compact_dest }}; @@ -285,7 +287,7 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -326,7 +328,7 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -379,6 +381,33 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__compact_dest + * + * Purpose: Free the compact buffer + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__compact_dest(H5D_t *dset, hid_t H5_ATTR_UNUSED dxpl_id) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(dset); + + /* Free the buffer for the raw data for compact datasets */ + dset->shared->layout.storage.u.compact.buf = H5MM_xfree(dset->shared->layout.storage.u.compact.buf); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__compact_dest() */ + + +/*------------------------------------------------------------------------- * Function: H5D__compact_copy * * Purpose: Copy compact storage raw data from SRC file to DST file. diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index fb3ac85..988bb61 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -27,7 +27,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -133,6 +133,7 @@ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ H5D__contig_readvv, H5D__contig_writevv, H5D__contig_flush, + NULL, NULL }}; @@ -466,7 +467,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__contig_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) +H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, + const H5D_t *dset, hid_t H5_ATTR_UNUSED dapl_id) { hsize_t tmp_size; /* Temporary holder for raw data size */ size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */ @@ -539,7 +541,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 @@ -917,7 +919,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1244,7 +1246,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - 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 diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 4e934f2..34e0ae9 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_dbg_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -61,26 +58,6 @@ /* Local Variables */ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5D__init_dbg_interface -- Initialize interface-specific information -USAGE - herr_t H5D__init_dbg_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5D_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5D__init_dbg_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5D_init()) -} /* H5D__init_dbg_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index cd2bc84..5a2b355 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_deprec_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -85,51 +82,6 @@ static herr_t H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5D__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5D__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5D_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5D__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5D_init()) -} /* H5D__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5D__term_deprec_interface -- Terminate interface -USAGE - herr_t H5D__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5D__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5D__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Defl.c b/src/H5Defl.c index 9e5872a..ec96ae7 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -22,7 +22,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -100,6 +100,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ H5D__efl_readvv, H5D__efl_writevv, NULL, + NULL, NULL }}; @@ -455,7 +456,7 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, 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) */ + ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */ FUNC_ENTER_STATIC @@ -535,7 +536,7 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, 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) */ + 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 484c362..947a177 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ + /***********/ /* Headers */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 6de8da9..49075d9 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -118,6 +115,9 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{ (H5I_free_t)H5D_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5D_top_package_initialize_s = FALSE; + /*------------------------------------------------------------------------- @@ -149,9 +149,9 @@ done: /*-------------------------------------------------------------------------- NAME - H5D__init_interface -- Initialize interface-specific information + H5D__init_package -- Initialize interface-specific information USAGE - herr_t H5D__init_interface() + herr_t H5D__init_package() RETURNS Non-negative on success/Negative on failure @@ -162,13 +162,13 @@ NOTES a deadlock in the library when the library is attempting to terminate -QAK --------------------------------------------------------------------------*/ -static herr_t -H5D__init_interface(void) +herr_t +H5D__init_package(void) { - H5P_genplist_t *def_dcpl; /* Default Dataset Creation Property list */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *def_dcpl; /* Default Dataset Creation Property list */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Initialize the atom group for the dataset IDs */ if(H5I_register_type(H5I_DATASET_CLS) < 0) @@ -202,34 +202,36 @@ H5D__init_interface(void) if(H5D__get_dxpl_cache_real(H5P_DATASET_XFER_DEFAULT, &H5D_def_dxpl_cache) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve default DXPL info") + /* Mark "top" of interface as initialized, too */ + H5D_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__init_interface() */ +} /* end H5D__init_package() */ /*------------------------------------------------------------------------- - * Function: H5D_term_interface + * Function: H5D_top_term_package * - * Purpose: Terminate this interface. + * Purpose: Close the "top" of the interface, releasing IDs, etc. * * Return: Success: Positive if anything was done that might * affect other interfaces; zero otherwise. - * * Failure: Negative. * - * Programmer: Robb Matzke - * Friday, November 20, 1998 + * Programmer: Quincey Koziol + * Sunday, September 13, 2015 * *------------------------------------------------------------------------- */ int -H5D_term_interface(void) +H5D_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5D_top_package_initialize_s) { if(H5I_nmembers(H5I_DATASET) > 0) { /* The dataset API uses the "force" flag set to true because it * is using the "file objects" (H5FO) API functions to track open @@ -256,24 +258,55 @@ H5D_term_interface(void) (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close public interface */ - n += H5D__term_pub_interface(); - /* Close deprecated interface */ - n += H5D__term_deprec_interface(); + /* Mark closed */ + if(0 == n) + H5D_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5D_top_term_package() */ - /* Destroy the dataset object id group */ - (void)H5I_dec_type_ref(H5I_DATASET); - n++; /*H5I*/ + +/*------------------------------------------------------------------------- + * Function: H5D_term_package + * + * Purpose: Terminate this interface. + * + * Note: Finishes shutting down the interface, after + * H5D_top_term_package() is called + * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. + * + * Programmer: Robb Matzke + * Friday, November 20, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5D_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_DATASET)); + HDassert(FALSE == H5D_top_package_initialize_s); - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Destroy the dataset object id group */ + n += (H5I_dec_type_ref(H5I_DATASET) > 0); + + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5D_term_interface() */ +} /* end H5D_term_package() */ /*-------------------------------------------------------------------------- @@ -350,8 +383,11 @@ H5D__get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache) if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function") - /* Get the data transform property */ - if(H5P_get(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop) < 0) + /* Look at the data transform property */ + /* (Note: 'peek', not 'get' - if this turns out to be a problem, we should + * add a H5D__free_dxpl_cache() routine. -QAK) + */ + if(H5P_peek(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve data transform info") done: @@ -424,7 +460,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_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 */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -549,7 +585,7 @@ H5D__new(hid_t dcpl_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 *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -931,12 +967,11 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") /* Error cleanup */ - if(ret_value < 0) { - if(dset->shared->layout.type == H5D_CHUNKED && layout_init) { - if(H5D__chunk_dest(file, dxpl_id, dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") - } /* end if */ - } /* end if */ + if(ret_value < 0) + if(layout_init) + /* Destroy the layout information for the dataset */ + if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__update_oh_info() */ @@ -971,8 +1006,12 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, H5P_genplist_t *dc_plist = NULL; /* New Property list */ 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 */ + hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */ + hbool_t fill_copied = FALSE; /* Flag to indicate that fill-value message was copied */ + hbool_t pline_copied = FALSE; /* Flag to indicate that pipeline message was copied */ + hbool_t efl_copied = FALSE; /* Flag to indicate that external file list message was copied */ H5G_loc_t dset_loc; /* Dataset location */ - H5D_t *ret_value; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1028,6 +1067,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, H5O_layout_t *layout; /* Dataset's layout information */ H5O_pline_t *pline; /* Dataset's I/O pipeline information */ H5O_fill_t *fill; /* Dataset's fill value info */ + H5O_efl_t *efl; /* Dataset's external file list info */ /* Check if the filters in the DCPL can be applied to this dataset */ if(H5Z_can_apply(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) @@ -1044,13 +1084,20 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Retrieve the properties we need */ pline = &new_dset->shared->dcpl_cache.pline; if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve pipeline filter") + pline_copied = TRUE; layout = &new_dset->shared->layout; if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve layout") + layout_copied = TRUE; fill = &new_dset->shared->dcpl_cache.fill; if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve fill value info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve fill value info") + fill_copied = TRUE; + efl = &new_dset->shared->dcpl_cache.efl; + if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve external file list") + efl_copied = TRUE; /* Check that chunked layout is used if filters are enabled */ if(pline->nused > 0 && H5D_CHUNKED != layout->type) @@ -1067,10 +1114,6 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* If MPI VFD is used, no filter support yet. */ if(H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI) && pline->nused > 0) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet") - - /* Get the dataset's external file list information */ - if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, &new_dset->shared->dcpl_cache.efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve external file list") } /* end if */ /* Set the latest version of the layout, pline & fill messages, if requested */ @@ -1116,10 +1159,21 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, done: if(!ret_value && new_dset && new_dset->shared) { if(new_dset->shared) { - if(new_dset->shared->layout.type == H5D_CHUNKED && layout_init) { - if(H5D__chunk_dest(file, dxpl_id, new_dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy chunk cache") - } /* end if */ + if(layout_init) + if(new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy layout info") + if(pline_copied) + if(H5O_msg_reset(H5O_PLINE_ID, &new_dset->shared->dcpl_cache.pline) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset I/O pipeline info") + if(layout_copied) + if(H5O_msg_reset(H5O_LAYOUT_ID, &new_dset->shared->layout) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset layout info") + if(fill_copied) + if(H5O_msg_reset(H5O_FILL_ID, &new_dset->shared->dcpl_cache.fill) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset fill-value info") + if(efl_copied) + if(H5O_msg_reset(H5O_EFL_ID, &new_dset->shared->dcpl_cache.efl) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info") if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace") if(new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0) @@ -1169,7 +1223,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id, H5O_loc_t oloc; /* Dataset object location */ H5O_type_t obj_type; /* Type of object at location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ - H5D_t *ret_value; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1229,7 +1283,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) { H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; - H5D_t *ret_value; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1454,9 +1508,9 @@ done: if(H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc)) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") if(dataset->shared) { - if(dataset->shared->layout.type == H5D_CHUNKED && layout_init) - if(H5D__chunk_dest(dataset->oloc.file, dxpl_id, dataset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") + if(layout_init) + if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") if(dataset->shared->space && H5S_close(dataset->shared->space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") if(dataset->shared->type) { @@ -1546,16 +1600,10 @@ H5D_close(H5D_t *dataset) dataset->shared->cache.chunk.single_chunk_info = H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info); dataset->shared->cache.chunk.single_chunk_info = NULL; } /* end if */ - - /* Flush and destroy chunks in the cache. Continue to close even if - * it fails. */ - if(H5D__chunk_dest(dataset->oloc.file, H5AC_dxpl_id, dataset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") break; case H5D_COMPACT: - /* Free the buffer for the raw data for compact datasets */ - dataset->shared->layout.storage.u.compact.buf = H5MM_xfree(dataset->shared->layout.storage.u.compact.buf); + /* Nothing special to do (info freed in the layout destroy) */ break; case H5D_VIRTUAL: @@ -1595,11 +1643,22 @@ H5D_close(H5D_t *dataset) #endif /* NDEBUG */ } /* end switch */ /*lint !e788 All appropriate cases are covered */ + /* Destroy any cached layout information for the dataset */ + if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + + /* Release layout, fill-value, efl & pipeline messages */ + if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) + free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || + (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) || + (H5O_msg_reset(H5O_FILL_ID, &dataset->shared->dcpl_cache.fill) < 0) || + (H5O_msg_reset(H5O_EFL_ID, &dataset->shared->dcpl_cache.efl) < 0); + /* - * Release datatype, dataspace and creation property list -- there isn't - * much we can do if one of these fails, so we just continue. - */ - free_failed = (H5I_dec_ref(dataset->shared->type_id) < 0) || + * Release datatype, dataspace and creation property list -- there isn't + * much we can do if one of these fails, so we just continue. + */ + free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) || (H5S_close(dataset->shared->space) < 0) || (H5I_dec_ref(dataset->shared->dcpl_id) < 0); @@ -2102,7 +2161,7 @@ herr_t H5D__iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t op, void *operator_data) { - herr_t ret_value; + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2139,7 +2198,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf) { H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */ H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */ - herr_t ret_value; + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2180,7 +2239,7 @@ 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 @@ -2721,29 +2780,77 @@ H5D_get_create_plist(H5D_t *dset) { H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */ H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */ + H5O_layout_t copied_layout; /* Layout to tweak */ H5O_fill_t copied_fill; /* Fill value to tweak */ + H5O_efl_t copied_efl; /* External file list to tweak */ 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) /* Check args */ if(NULL == (dcpl_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") /* Copy the creation property list */ if((new_dcpl_id = H5P_copy_plist(dcpl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to copy the creation property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ if(H5O_get_create_plist(&dset->oloc, H5AC_ind_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info") + /* Get the layout property */ + if(H5P_peek(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout") + + /* Reset layout values set when dataset is created */ + copied_layout.ops = NULL; + switch(copied_layout.type) { + case H5D_COMPACT: + copied_layout.storage.u.compact.buf = H5MM_xfree(copied_layout.storage.u.compact.buf); + HDmemset(&copied_layout.storage.u.compact, 0, sizeof(copied_layout.storage.u.compact)); + break; + + case H5D_CONTIGUOUS: + copied_layout.storage.u.contig.addr = HADDR_UNDEF; + copied_layout.storage.u.contig.size = 0; + break; + + case H5D_CHUNKED: + /* Reset chunk size */ + copied_layout.u.chunk.size = 0; + + /* Reset index info, if the chunk ops are set */ + if(copied_layout.storage.u.chunk.ops) + /* Reset address and pointer of the array struct for the chunked storage index */ + if(H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") + + /* Reset chunk index ops */ + copied_layout.storage.u.chunk.ops = NULL; + break; + + case H5D_VIRTUAL: + copied_layout.storage.u.virt.serial_list_hobjid.addr = HADDR_UNDEF; + copied_layout.storage.u.virt.serial_list_hobjid.idx = 0; + break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + default: + HDassert(0 && "Unknown layout type!"); + } /* end switch */ + + /* Set back the (possibly modified) layout property to property list */ + if(H5P_poke(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set layout") + /* Get the fill value property */ - if(H5P_get(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + if(H5P_peek(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value") /* Check if there is a fill value, but no type yet */ if(copied_fill.buf != NULL && copied_fill.type == NULL) { @@ -2770,7 +2877,7 @@ H5D_get_create_plist(H5D_t *dset) src_id = H5I_register(H5I_DATATYPE, H5T_copy(dset->shared->type, H5T_COPY_ALL), FALSE); if(src_id < 0) { H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy/register datatype") } /* end if */ /* Allocate a background buffer */ @@ -2778,7 +2885,7 @@ H5D_get_create_plist(H5D_t *dset) if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") } /* end if */ /* Convert fill value */ @@ -2800,9 +2907,26 @@ H5D_get_create_plist(H5D_t *dset) } /* end if */ } /* end if */ - /* Set back the fill value property to property list */ - if(H5P_set(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property list fill value") + /* Set back the (possibly modified) fill value property to property list */ + if(H5P_poke(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set fill value") + + /* Get the fill value property */ + if(H5P_peek(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get external file list") + + /* Reset efl name_offset and heap_addr, these are the values when the dataset is created */ + if(copied_efl.slot) { + unsigned u; + + copied_efl.heap_addr = HADDR_UNDEF; + for(u = 0; u < copied_efl.nused; u++) + copied_efl.slot[u].name_offset = 0; + } /* end if */ + + /* Set back the (possibly modified) external file list property to property list */ + if(H5P_poke(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set external file list") /* Set the return value */ ret_value = new_dcpl_id; diff --git a/src/H5Dio.c b/src/H5Dio.c index 3126b92..c0aa83e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 15ea92a..ae478b2 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -137,7 +137,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 @@ -282,7 +282,6 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, } /* end if */ /* Store EFL file name offset */ - HDassert(0 == efl->slot[u].name_offset); efl->slot[u].name_offset = offset; } /* end for */ @@ -304,12 +303,11 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, done: /* Error cleanup */ - if(ret_value < 0) { - if(dset->shared->layout.type == H5D_CHUNKED && layout_init) { - if(H5D__chunk_dest(file, dxpl_id, dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") - } /* end if */ - } /* end if */ + if(ret_value < 0) + if(layout_init) + /* Destroy any cached layout information for the dataset */ + if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__layout_oh_create() */ @@ -381,6 +379,10 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t /* Sanity check that the layout operations are set up */ HDassert(dataset->shared->layout.ops); + /* Initialize the layout information for the dataset */ + if(dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dxpl_id, dataset, dapl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information") + /* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */ if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims--; @@ -391,9 +393,6 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims++; - /* Initialize the layout information for the dataset */ - if(dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dxpl_id, dataset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_oh_read() */ diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h new file mode 100644 index 0000000..9b0c411 --- /dev/null +++ b/src/H5Dmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5D package. Including this header means that the source file + * is part of the H5D package. + */ +#ifndef _H5Dmodule_H +#define _H5Dmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5D_MODULE +#define H5_MY_PKG H5D +#define H5_MY_PKG_ERR H5E_DATASET +#define H5_MY_PKG_INIT YES + +#endif /* _H5Dmodule_H */ + diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 289e12b..a5f34d1 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -27,7 +27,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /* suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -605,7 +605,8 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") /* Check the optional property list on what to do with collective chunk IO. */ - chunk_opt_mode = (H5FD_mpio_chunk_opt_t)H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME); + if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &chunk_opt_mode) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't get chunk optimization option") if(H5FD_MPIO_CHUNK_ONE_IO == chunk_opt_mode) io_option = H5D_ONE_LINK_CHUNK_IO; /*no opt*/ /* direct request to multi-chunk-io */ @@ -621,7 +622,9 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") - one_link_chunk_io_threshold = H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME); + /* Get the chunk optimization option */ + if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &one_link_chunk_io_threshold) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't get chunk optimization option") /* step 1: choose an IO option */ /* If the average number of chunk per process is greater than a threshold, we will do one link chunked IO. */ @@ -1698,7 +1701,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, /* Setup parameters */ H5_CHECKED_ASSIGN(total_chunks, int, fm->layout->u.chunk.nchunks, hsize_t); - percent_nproc_per_chunk = H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME); + if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &percent_nproc_per_chunk) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't get percent nproc per chunk") /* if ratio is 0, perform collective io */ if(0 == percent_nproc_per_chunk) { if(H5D__chunk_addrmap(io_info, chunk_addr) < 0) diff --git a/src/H5Doh.c b/src/H5Doh.c index 2e52102..f8a733d 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -108,7 +108,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 @@ -223,10 +223,10 @@ done: static hid_t H5O__dset_open(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref) { - H5D_t *dset = NULL; /* Dataset opened */ - htri_t isdapl; /* lapl_id is a dapl */ - hid_t dapl_id; /* dapl to use to open this dataset */ - hid_t ret_value; /* Return value */ + H5D_t *dset = NULL; /* Dataset opened */ + htri_t isdapl; /* lapl_id is a dapl */ + hid_t dapl_id; /* dapl to use to open this dataset */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -279,7 +279,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -327,7 +327,7 @@ static H5O_loc_t * H5O__dset_get_oloc(hid_t obj_id) { H5D_t *dset; /* Dataset opened */ - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 7f591b4..f07b8f0 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -21,7 +21,7 @@ * the H5D package. Source files outside the H5D package should * include H5Dprivate.h instead. */ -#ifndef H5D_PACKAGE +#if !(defined H5D_FRIEND || defined H5D_MODULE) #error "Do not include this file outside the H5D package!" #endif @@ -121,6 +121,7 @@ typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset, hid_t dxpl_id); typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm); +typedef herr_t (*H5D_layout_dest_func_t)(H5D_t *dataset, hid_t dxpl_id); /* Typedef for grouping layout I/O routines */ typedef struct H5D_layout_ops_t { @@ -138,6 +139,7 @@ typedef struct H5D_layout_ops_t { H5D_layout_writevv_func_t writevv; /* Low-level I/O routine for writing data */ H5D_layout_flush_func_t flush; /* Low-level I/O routine for flushing raw data */ H5D_layout_io_term_func_t io_term; /* I/O shutdown routine */ + H5D_layout_dest_func_t dest; /* Destroy layout info */ } H5D_layout_ops_t; /* Function pointers for either multiple or single block I/O access */ @@ -530,8 +532,6 @@ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1]; /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5D__term_pub_interface(void); -H5_DLL herr_t H5D__term_deprec_interface(void); H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id); H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, @@ -641,7 +641,6 @@ H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5_DLL herr_t H5D__chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, const H5O_pline_t *pline, hsize_t *btree_size); H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream); -H5_DLL herr_t H5D__chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *store); H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index d3a23eb..3b43aaf 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -189,8 +189,7 @@ H5_DLL herr_t H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx); H5_DLL herr_t H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_seg_t **parsed_name, size_t *static_strlen, size_t *nsubs); -H5_DLL void H5D_virtual_free_parsed_name( - H5O_storage_virtual_name_seg_t *name_seg); +H5_DLL herr_t H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg); /* Functions that operate on indexed storage */ H5_DLL herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 4b0846f..9902b7b 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ diff --git a/src/H5Dselect.c b/src/H5Dselect.c index 38f8bc4..ce6073c 100644 --- a/src/H5Dselect.c +++ b/src/H5Dselect.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index eef3c91..fd8ff71 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ #define H5D_TESTING /*suppress warning about H5D testing funcs*/ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index a611321..af9963d 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -41,7 +41,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /* Suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -1156,12 +1156,13 @@ done: * *------------------------------------------------------------------------- */ -void +herr_t H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg) { H5O_storage_virtual_name_seg_t *next_seg; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Walk name segments, freeing them */ while(name_seg) { @@ -1171,7 +1172,8 @@ H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg) name_seg = next_seg; } /* end while */ - FUNC_LEAVE_NOAPI_VOID +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_free_parsed_name() */ @@ -45,10 +45,7 @@ /* Module Setup */ /****************/ -#define H5E_PACKAGE /*suppress error about including H5Epkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E_init_interface +#include "H5Emodule.h" /* This source code file is part of the H5E module */ /***********/ @@ -83,6 +80,7 @@ /* Local Prototypes */ /********************/ /* Static function declarations */ +static herr_t H5E_set_default_auto(H5E_t *stk); static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name, const char *version); static herr_t H5E_unregister_class(H5E_cls_t *cls); @@ -100,6 +98,9 @@ static ssize_t H5E_get_num(const H5E_t *err_stack); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -173,45 +174,7 @@ done: /*-------------------------------------------------------------------------- - * Function: H5E_set_default_auto - * - * Purpose: Initialize "automatic" error stack reporting info to library - * default - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * - *-------------------------------------------------------------------------- - */ -static herr_t -H5E_set_default_auto(H5E_t *stk) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifndef H5_NO_DEPRECATED_SYMBOLS -#ifdef H5_USE_16_API_DEFAULT - stk->auto_op.vers = 1; -#else /* H5_USE_16_API */ - stk->auto_op.vers = 2; -#endif /* H5_USE_16_API_DEFAULT */ - - stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; - stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; - stk->auto_op.is_default = TRUE; -#else /* H5_NO_DEPRECATED_SYMBOLS */ - stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - stk->auto_data = NULL; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_default_auto() */ - - -/*-------------------------------------------------------------------------- - * Function: H5E_init_interface + * Function: H5E__init_package * * Purpose: Initialize interface-specific information * @@ -222,15 +185,15 @@ H5E_set_default_auto(H5E_t *stk) * *-------------------------------------------------------------------------- */ -static herr_t -H5E_init_interface(void) +herr_t +H5E__init_package(void) { H5E_cls_t *cls; /* Pointer to error class */ H5E_msg_t *msg; /* Pointer to new error message */ char lib_vers[128]; /* Buffer to constructu library version within */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize the atom group for the error class IDs */ if(H5I_register_type(H5I_ERRCLS_CLS) < 0) @@ -262,11 +225,11 @@ H5E_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_init_interface() */ +} /* end H5E__init_package() */ /*------------------------------------------------------------------------- - * Function: H5E_term_interface + * Function: H5E_term_package * * Purpose: Terminates the H5E interface * @@ -281,13 +244,13 @@ done: *------------------------------------------------------------------------- */ int -H5E_term_interface(void) +H5E_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { int64_t ncls, nmsg, nstk; /* Check if there are any open error stacks, classes or messages */ @@ -323,22 +286,57 @@ H5E_term_interface(void) n++; /*H5I*/ } /* end if */ else { - /* Close deprecated interface */ - n += H5E__term_deprec_interface(); - /* Destroy the error class, message, and stack id groups */ - (void)H5I_dec_type_ref(H5I_ERROR_STACK); - (void)H5I_dec_type_ref(H5I_ERROR_CLASS); - (void)H5I_dec_type_ref(H5I_ERROR_MSG); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5E_term_interface() */ +} /* end H5E_term_package() */ + + +/*-------------------------------------------------------------------------- + * Function: H5E_set_default_auto + * + * Purpose: Initialize "automatic" error stack reporting info to library + * default + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 1, 2007 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5E_set_default_auto(H5E_t *stk) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#ifndef H5_NO_DEPRECATED_SYMBOLS +#ifdef H5_USE_16_API_DEFAULT + stk->auto_op.vers = 1; +#else /* H5_USE_16_API */ + stk->auto_op.vers = 2; +#endif /* H5_USE_16_API_DEFAULT */ + + stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; + stk->auto_op.is_default = TRUE; +#else /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + stk->auto_data = NULL; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5E_set_default_auto() */ #ifdef H5_HAVE_THREADSAFE @@ -360,7 +358,7 @@ H5E_term_interface(void) H5E_t * H5E_get_stack(void) { - H5E_t *estack; + H5E_t *estack = NULL; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -371,7 +369,7 @@ H5E_get_stack(void) #ifdef H5_HAVE_WIN_THREADS estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ #else - estack = (H5E_t *)H5FL_MALLOC(H5E_t); + estack = (H5E_t *)HDmalloc(sizeof(H5E_t)); #endif /* H5_HAVE_WIN_THREADS */ HDassert(estack); @@ -475,8 +473,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 @@ -631,7 +629,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 = 0; /* Length of error class's name */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -812,8 +810,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 @@ -967,10 +965,10 @@ done: static H5E_t * 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 *current_stack; /* Pointer to the current error stack */ + H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */ + unsigned u; /* Local index variable */ + H5E_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -33,7 +33,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ @@ -79,6 +79,9 @@ typedef herr_t (*H5EA__unprotect_func_t)(void *thing, hid_t dxpl_id, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Extensible array client ID to class mapping */ /* Remember to add client ID to H5EA_cls_id_t in H5EAprivate.h when adding a new diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 8a05282..e9c93d4 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 9c3ce6d..ef45881 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 5d188c2..15bad43 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index 24be87a..cd20bba 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index e30bbac..eff4b54 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 364b443..3f49d0d 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAint.c b/src/H5EAint.c index 12a9cda..9f910d0 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAmodule.h b/src/H5EAmodule.h new file mode 100644 index 0000000..405b232 --- /dev/null +++ b/src/H5EAmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5EA package. Including this header means that the source file + * is part of the H5EA package. + */ +#ifndef _H5EAmodule_H +#define _H5EAmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5EA_MODULE +#define H5_MY_PKG H5EA +#define H5_MY_PKG_ERR H5E_EARRAY +#define H5_MY_PKG_INIT NO + +#endif /* _H5EAmodule_H */ + diff --git a/src/H5EApkg.h b/src/H5EApkg.h index d328c05..3af1b2c 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -21,7 +21,7 @@ * the H5EA package. Source files outside the H5EA package should * include H5EAprivate.h instead. */ -#if !(defined(H5EA_PACKAGE) | defined(H5EA_MODULE)) +#if !(defined(H5EA_FRIEND) | defined(H5EA_MODULE)) #error "Do not include this file outside the H5EA package!" #endif @@ -39,16 +39,6 @@ /* Package Private Macros */ /**************************/ -/* If this package header is being included in one of the H5EA modules, define - * the proper control macros for the generic FUNC_ENTER/LEAVE and error - * reporting macros. - */ -#ifdef H5EA_MODULE -#define H5_MY_PKG H5EA -#define H5_MY_PKG_ERR H5E_EARRAY -#define H5_MY_PKG_INIT NO -#endif /* H5EA_MODULE */ - /* Fill value for extensible array test class */ #ifdef H5EA_TESTING #define H5EA_TEST_FILL ((uint64_t)ULLONG_MAX) diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index 33f34c9..7753f0e 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAstat.c b/src/H5EAstat.c index 8a26e34..0c27681 100644 --- a/src/H5EAstat.c +++ b/src/H5EAstat.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index b3942ca..905aa7f 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -24,7 +24,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ #define H5EA_TESTING diff --git a/src/H5Edefin.h b/src/H5Edefin.h deleted file mode 100644 index 066c35d..0000000 --- a/src/H5Edefin.h +++ /dev/null @@ -1,223 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* 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_FUNC_g = FAIL; /* Function entry/exit */ -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_RS_g = FAIL; /* Reference Counted Strings */ -hid_t H5E_FARRAY_g = FAIL; /* Fixed Array */ -hid_t H5E_HEAP_g = FAIL; /* Heap */ -hid_t H5E_ATTR_g = FAIL; /* Attribute */ -hid_t H5E_IO_g = FAIL; /* Low-level I/O */ -hid_t H5E_EFL_g = FAIL; /* External file list */ -hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */ -hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */ -hid_t H5E_DATASET_g = FAIL; /* Dataset */ -hid_t H5E_STORAGE_g = FAIL; /* Data storage */ -hid_t H5E_LINK_g = FAIL; /* Links */ -hid_t H5E_PLIST_g = FAIL; /* Property lists */ -hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ -hid_t H5E_OHDR_g = FAIL; /* Object header */ -hid_t H5E_ATOM_g = FAIL; /* Object atom */ -hid_t H5E_NONE_MAJOR_g = FAIL; /* No error */ -hid_t H5E_SLIST_g = FAIL; /* Skip Lists */ -hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */ -hid_t H5E_EARRAY_g = FAIL; /* Extensible Array */ -hid_t H5E_PLINE_g = FAIL; /* Data filters */ -hid_t H5E_ERROR_g = FAIL; /* Error API */ -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 */ - -/* 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 */ - -/* 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 */ - -/* 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 */ - -/* 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 */ - -/* 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 */ - -/* 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 */ - -/* System level errors */ -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 */ - -/* 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 */ - -/* 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 */ - -/* 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 */ - -/* 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_CANTTAG_g = FAIL; /* Unable to tag metadata in the 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_CANTDEPEND_g = FAIL; /* Unable to create a flush dependency */ -hid_t H5E_CANTUNDEPEND_g = FAIL; /* Unable to destroy a flush dependency */ -hid_t H5E_CANTNOTIFY_g = FAIL; /* Unable to notify object about action */ - -/* 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 */ - -/* 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 */ - -/* 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_CANTAPPEND_g = FAIL; /* Can't append object */ - -/* 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 */ - -/* 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 */ - -/* Datatype conversion errors */ -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 6a83745..1a13c01 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5E_PACKAGE /*suppress error about including H5Epkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E__init_deprec_interface +#include "H5Emodule.h" /* This source code file is part of the H5E module */ /***********/ @@ -82,51 +79,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5E__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5E__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5E_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5E__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5E_init()) -} /* H5E__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5E__term_deprec_interface -- Terminate interface -USAGE - herr_t H5E__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5E__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5E__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Einit.h b/src/H5Einit.h deleted file mode 100644 index 35049b2..0000000 --- a/src/H5Einit.h +++ /dev/null @@ -1,845 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_err -- do not edit */ -/* Add new errors to H5err.txt file */ - - -#ifndef _H5Einit_H -#define _H5Einit_H - -/*********************/ -/* Major error codes */ -/*********************/ - -assert(H5E_FUNC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibilty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SOHM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SYM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PLUGIN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_VFL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_INTERNAL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BTREE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_REFERENCE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "References"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATASPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_RESOURCE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_RS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FARRAY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Fixed Array"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_HEAP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ATTR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Attribute"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_IO_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_EFL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_TST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FSPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATASET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_STORAGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_LINK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Links"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PLIST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATATYPE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Datatype"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OHDR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(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) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NONE_MAJOR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "No error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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") -assert(H5E_SLIST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ARGS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_EARRAY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Extensible Array"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PLINE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Error API"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CACHE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_SEEKERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_READERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Read failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_WRITEERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Write failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CLOSEERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Close failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OVERFLOW_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FCNTL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_NOSPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTALLOC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOPY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTFREE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALREADYEXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLOCK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNLOCK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTGC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTGETSIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OBJOPEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object is already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTRESTORE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't restore condition"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRESTORE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOMPUTE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compute value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOMPUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTEXTEND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't extend heap's space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTEXTEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTATTACH_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't attach object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTATTACH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUPDATE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't update object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUPDATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTOPERATE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't operate on object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTINIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALREADYINIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRELEASE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTGET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DUPCLASS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SETDISALLOWED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTMERGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREVIVE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSHRINK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_LINKCOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_VERSION_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALIGNMENT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADMESG_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDELETE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADITER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Iteration failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADITER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTPACK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRESET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRENAME_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to rename object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_SYSERRSTR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "System error message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_NOFILTER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CALLBACK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANAPPLY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SETLOCAL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOENCODER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTFILTER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTOPENOBJ_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCLOSEOBJ_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_COMPLEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PATH_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with path to object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_NONE_MINOR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "No error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_OPENERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open directory or file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_FILEEXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FILEOPEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCREATE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTOPENFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCLOSEFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTHDF5_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_TRUNCATED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_MOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File mount error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(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) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADGROUP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREGISTER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to register new 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) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTINC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDEC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOIDS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTFLUSH_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSERIALIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTTAG_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to tag metadata in the cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTTAG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLOAD_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PROTECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTCACHED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SYSTEM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Internal error detected"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYSTEM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTINS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert metadata into cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTPROTECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to protect metadata"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNPROTECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unprotect metadata"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTPIN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to pin cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNPIN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to un-pin cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTMARKDIRTY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as dirty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMARKDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDIRTY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark metadata as dirty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTEXPUNGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to expunge a metadata cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTEXPUNGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRESIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to resize a metadata cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRESIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDEPEND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create a flush dependency"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDEPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNDEPEND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to destroy a flush dependency"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNDEPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTNOTIFY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to notify object about action"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTNOTIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Link related errors */ -assert(H5E_TRAVERSE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Link traversal failure"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TRAVERSE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NLINKS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Too many soft links in path"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTREGISTERED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Link class not registered"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTMOVE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSORT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_MPI_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_MPIERRSTR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRECV_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTCLIP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't clip hyperslab region"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLIP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't count elements"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSELECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't select hyperslab"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTNEXT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move to next iterator location"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTNEXT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADSELECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Invalid selection"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOMPARE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTAPPEND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't append object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTAPPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Argument errors */ -assert(H5E_UNINITIALIZED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_UNSUPPORTED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADTYPE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADRANGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADVALUE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_NOTFOUND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object not found"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTFOUND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_EXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTENCODE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to encode value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTENCODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDECODE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decode value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDECODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSPLIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to split node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSPLIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREDISTRIBUTE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to redistribute records"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREDISTRIBUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSWAP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to swap records"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSWAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTINSERT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINSERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLIST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to list node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTMODIFY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to modify record"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREMOVE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 */ -assert(H5E_CANTCONVERT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADSIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -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 07d1e46..6e84a09 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5E_PACKAGE /*suppress error about including H5Epkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E_init_int_interface +#include "H5Emodule.h" /* This source code file is part of the H5E module */ /***********/ @@ -117,27 +114,6 @@ int H5E_mpi_error_str_len; -/*-------------------------------------------------------------------------- -NAME - H5E_init_int_interface -- Initialize interface-specific information -USAGE - herr_t H5E_init_int_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5E_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5E_init_int_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5E_init()) -} /* H5E_init_int_interface() */ - - /*------------------------------------------------------------------------- * Function: H5E_get_msg * @@ -154,7 +130,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 diff --git a/src/H5Emodule.h b/src/H5Emodule.h new file mode 100644 index 0000000..d624409 --- /dev/null +++ b/src/H5Emodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5E package. Including this header means that the source file + * is part of the H5E package. + */ +#ifndef _H5Emodule_H +#define _H5Emodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5E_MODULE +#define H5_MY_PKG H5E +#define H5_MY_PKG_ERR H5E_ERROR +#define H5_MY_PKG_INIT YES + +#endif /* _H5Emodule_H */ + + diff --git a/src/H5Epkg.h b/src/H5Epkg.h index bfaaf9d..3af653a 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -21,7 +21,7 @@ * the H5E package. Source files outside the H5E package should * include H5Eprivate.h instead. */ -#ifndef H5E_PACKAGE +#if !(defined H5E_FRIEND || defined H5E_MODULE) #error "Do not include this file outside the H5E package!" #endif diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h deleted file mode 100644 index 8b60079..0000000 --- a/src/H5Epubgen.h +++ /dev/null @@ -1,382 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_err -- do not edit */ -/* Add new errors to H5err.txt file */ - - -#ifndef _H5Epubgen_H -#define _H5Epubgen_H - -/*********************/ -/* Major error codes */ -/*********************/ - -#define H5E_FUNC (H5OPEN H5E_FUNC_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_RS (H5OPEN H5E_RS_g) -#define H5E_FARRAY (H5OPEN H5E_FARRAY_g) -#define H5E_HEAP (H5OPEN H5E_HEAP_g) -#define H5E_ATTR (H5OPEN H5E_ATTR_g) -#define H5E_IO (H5OPEN H5E_IO_g) -#define H5E_EFL (H5OPEN H5E_EFL_g) -#define H5E_TST (H5OPEN H5E_TST_g) -#define H5E_FSPACE (H5OPEN H5E_FSPACE_g) -#define H5E_DATASET (H5OPEN H5E_DATASET_g) -#define H5E_STORAGE (H5OPEN H5E_STORAGE_g) -#define H5E_LINK (H5OPEN H5E_LINK_g) -#define H5E_PLIST (H5OPEN H5E_PLIST_g) -#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) -#define H5E_OHDR (H5OPEN H5E_OHDR_g) -#define H5E_ATOM (H5OPEN H5E_ATOM_g) -#define H5E_NONE_MAJOR (H5OPEN H5E_NONE_MAJOR_g) -#define H5E_SLIST (H5OPEN H5E_SLIST_g) -#define H5E_ARGS (H5OPEN H5E_ARGS_g) -#define H5E_EARRAY (H5OPEN H5E_EARRAY_g) -#define H5E_PLINE (H5OPEN H5E_PLINE_g) -#define H5E_ERROR (H5OPEN H5E_ERROR_g) -#define H5E_CACHE (H5OPEN H5E_CACHE_g) -H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ -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_RS_g; /* Reference Counted Strings */ -H5_DLLVAR hid_t H5E_FARRAY_g; /* Fixed Array */ -H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ -H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */ -H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */ -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_FSPACE_g; /* Free Space Manager */ -H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */ -H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ -H5_DLLVAR hid_t H5E_LINK_g; /* Links */ -H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */ -H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ -H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ -H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ -H5_DLLVAR hid_t H5E_NONE_MAJOR_g; /* No error */ -H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */ -H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */ -H5_DLLVAR hid_t H5E_EARRAY_g; /* Extensible Array */ -H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */ -H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ -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 */ - -/* 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) -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 */ -H5_DLLVAR hid_t H5E_CANTFREE_g; /* Unable to free object */ -H5_DLLVAR hid_t H5E_ALREADYEXISTS_g; /* Object already exists */ -H5_DLLVAR hid_t H5E_CANTLOCK_g; /* Unable to lock object */ -H5_DLLVAR hid_t H5E_CANTUNLOCK_g; /* Unable to unlock object */ -H5_DLLVAR hid_t H5E_CANTGC_g; /* Unable to garbage collect */ -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 */ - -/* 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 */ - -/* 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) -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 */ - -/* 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 */ - -/* System level errors */ -#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 */ - -/* 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 */ - -/* 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 */ - -/* 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) -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 */ -H5_DLLVAR hid_t H5E_CANTOPENFILE_g; /* Unable to open file */ -H5_DLLVAR hid_t H5E_CANTCLOSEFILE_g; /* Unable to close file */ -H5_DLLVAR hid_t H5E_NOTHDF5_g; /* Not an HDF5 file */ -H5_DLLVAR hid_t H5E_BADFILE_g; /* Bad file ID accessed */ -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 */ - -/* Cache related errors */ -#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) -#define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g) -#define H5E_CANTTAG (H5OPEN H5E_CANTTAG_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_CANTDEPEND (H5OPEN H5E_CANTDEPEND_g) -#define H5E_CANTUNDEPEND (H5OPEN H5E_CANTUNDEPEND_g) -#define H5E_CANTNOTIFY (H5OPEN H5E_CANTNOTIFY_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_CANTTAG_g; /* Unable to tag metadata in the cache */ -H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */ -H5_DLLVAR hid_t H5E_PROTECT_g; /* Protected metadata error */ -H5_DLLVAR hid_t H5E_NOTCACHED_g; /* Metadata not currently cached */ -H5_DLLVAR hid_t H5E_SYSTEM_g; /* Internal error detected */ -H5_DLLVAR hid_t H5E_CANTINS_g; /* Unable to insert metadata into cache */ -H5_DLLVAR hid_t H5E_CANTPROTECT_g; /* Unable to protect metadata */ -H5_DLLVAR hid_t H5E_CANTUNPROTECT_g; /* Unable to unprotect metadata */ -H5_DLLVAR hid_t H5E_CANTPIN_g; /* Unable to pin cache entry */ -H5_DLLVAR hid_t H5E_CANTUNPIN_g; /* Unable to un-pin cache entry */ -H5_DLLVAR hid_t H5E_CANTMARKDIRTY_g; /* Unable to mark a pinned entry as dirty */ -H5_DLLVAR hid_t H5E_CANTDIRTY_g; /* Unable to mark metadata as dirty */ -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 */ -H5_DLLVAR hid_t H5E_CANTDEPEND_g; /* Unable to create a flush dependency */ -H5_DLLVAR hid_t H5E_CANTUNDEPEND_g; /* Unable to destroy a flush dependency */ -H5_DLLVAR hid_t H5E_CANTNOTIFY_g; /* Unable to notify object about action */ - -/* 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) -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 */ -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 */ - -/* 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) -#define H5E_CANTAPPEND (H5OPEN H5E_CANTAPPEND_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 */ -H5_DLLVAR hid_t H5E_CANTAPPEND_g; /* Can't append object */ - -/* 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) -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 */ -H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */ -H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */ - -/* B-tree related errors */ -#define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g) -#define H5E_EXISTS (H5OPEN H5E_EXISTS_g) -#define H5E_CANTENCODE (H5OPEN H5E_CANTENCODE_g) -#define H5E_CANTDECODE (H5OPEN H5E_CANTDECODE_g) -#define H5E_CANTSPLIT (H5OPEN H5E_CANTSPLIT_g) -#define H5E_CANTREDISTRIBUTE (H5OPEN H5E_CANTREDISTRIBUTE_g) -#define H5E_CANTSWAP (H5OPEN H5E_CANTSWAP_g) -#define H5E_CANTINSERT (H5OPEN H5E_CANTINSERT_g) -#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_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 */ - -/* 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 */ - -#endif /* H5Epubgen_H */ diff --git a/src/H5Eterm.h b/src/H5Eterm.h deleted file mode 100644 index bf39a6b..0000000 --- a/src/H5Eterm.h +++ /dev/null @@ -1,225 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* 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_FUNC_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_RS_g= -H5E_FARRAY_g= -H5E_HEAP_g= -H5E_ATTR_g= -H5E_IO_g= -H5E_EFL_g= -H5E_TST_g= -H5E_FSPACE_g= -H5E_DATASET_g= -H5E_STORAGE_g= -H5E_LINK_g= -H5E_PLIST_g= -H5E_DATATYPE_g= -H5E_OHDR_g= -H5E_ATOM_g= -H5E_NONE_MAJOR_g= -H5E_SLIST_g= -H5E_ARGS_g= -H5E_EARRAY_g= -H5E_PLINE_g= -H5E_ERROR_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_CANTTAG_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= -H5E_CANTDEPEND_g= -H5E_CANTUNDEPEND_g= -H5E_CANTNOTIFY_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= -H5E_CANTAPPEND_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 */ @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F__init_pub_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -66,6 +63,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -88,21 +88,21 @@ static const H5I_class_t H5I_FILE_CLS[1] = {{ /*-------------------------------------------------------------------------- NAME - H5F__init_pub_interface -- Initialize interface-specific information + H5F__init_package -- Initialize interface-specific information USAGE - herr_t H5F__init_pub_interface() + herr_t H5F__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). + Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5F__init_pub_interface(void) +herr_t +H5F__init_package(void) { - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* * Initialize the atom group for the file IDs. @@ -110,40 +110,13 @@ H5F__init_pub_interface(void) if(H5I_register_type(H5I_FILE_CLS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") - ret_value = H5F_init(); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5F__init_pub_interface() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_init - * - * Purpose: Initialize the interface from some other layer. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Robb Matzke - * Wednesday, December 16, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5F_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_init() */ +} /* H5F__init_package() */ /*------------------------------------------------------------------------- - * Function: H5F_term_interface + * Function: H5F_term_package * * Purpose: Terminate this interface: free all memory and reset global * variables to their initial values. Release all ID groups @@ -161,13 +134,13 @@ done: *------------------------------------------------------------------------- */ int -H5F_term_interface(void) +H5F_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { if(H5I_nmembers(H5I_FILE) > 0) { (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); n++; /*H5I*/ @@ -176,20 +149,17 @@ H5F_term_interface(void) /* Make certain we've cleaned up all the shared file objects */ H5F_sfile_assert_num(0); - /* Close deprecated interface */ - n += H5F__term_deprec_interface(); - /* Destroy the file object id group */ - (void)H5I_dec_type_ref(H5I_FILE); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_FILE) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5F_term_interface() */ +} /* end H5F_term_package() */ /*------------------------------------------------------------------------- @@ -29,7 +29,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ /* Other Packages Used */ @@ -70,6 +70,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Fixed array client ID to class mapping */ /* Remember to add client ID to H5FA_cls_id_t in H5FAprivate.h when adding a new diff --git a/src/H5FAcache.c b/src/H5FAcache.c index b95da40..f3396be 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 6a84fc9..2f8fda2 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index e1ea3ac..00eb398 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c index 42dafeb..71b618c 100644 --- a/src/H5FAdblock.c +++ b/src/H5FAdblock.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 9083a52..49d22f3 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAmodule.h b/src/H5FAmodule.h new file mode 100644 index 0000000..e46b071 --- /dev/null +++ b/src/H5FAmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FA package. Including this header means that the source file + * is part of the H5FA package. + */ +#ifndef _H5FAmodule_H +#define _H5FAmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FA_MODULE +#define H5_MY_PKG H5FA +#define H5_MY_PKG_ERR H5E_FARRAY +#define H5_MY_PKG_INIT NO + +#endif /* _H5FAmodule_H */ + diff --git a/src/H5FApkg.h b/src/H5FApkg.h index bed9c83..ddf3a07 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -20,7 +20,7 @@ * the H5FA package. Source files outside the H5FA package should * include H5FAprivate.h instead. */ -#if !(defined(H5FA_PACKAGE) | defined(H5FA_MODULE)) +#if !(defined(H5FA_FRIEND) | defined(H5FA_MODULE)) #error "Do not include this file outside the H5FA package!" #endif @@ -43,16 +43,6 @@ /* #define H5FA_DEBUG */ -/* If this package header is being included in one of the H5FA modules, define - * the proper control macros for the generic FUNC_ENTER/LEAVE and error - * reporting macros. - */ -#ifdef H5FA_MODULE -#define H5_MY_PKG H5FA -#define H5_MY_PKG_ERR H5E_FARRAY -#define H5_MY_PKG_INIT NO -#endif /* H5FA_MODULE */ - /* Fill value for fixed array test class */ #ifdef H5FA_TESTING #define H5FA_TEST_FILL ((uint64_t)ULLONG_MAX) diff --git a/src/H5FAstat.c b/src/H5FAstat.c index bed6c6e..4ded4c1 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index acb2d06..528f550 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -24,7 +24,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ #define H5FA_TESTING @@ -28,11 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5FD_PACKAGE /*suppress error about including H5FDpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_init_interface +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ @@ -65,12 +62,7 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FD_pl_copy(void *(*copy_func)(const void *), size_t pl_size, - const void *old_pl, void **copied_pl); -static herr_t H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), - void *pl); static herr_t H5FD_free_cls(H5FD_class_t *cls); -static herr_t H5FD_fapl_copy(hid_t driver_id, const void *fapl, void **copied_fapl); static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/); static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/); @@ -78,6 +70,9 @@ static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*o /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -113,53 +108,24 @@ static const H5I_class_t H5I_VFL_CLS[1] = {{ /*------------------------------------------------------------------------- - * Function: H5FD_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, January 3, 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5FD_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_init() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD_init_interface + * Function: H5FD__init_package * * Purpose: Initialize the virtual file layer. * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Robb Matzke * Monday, July 26, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -H5FD_init_interface(void) +herr_t +H5FD__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE if(H5I_register_type(H5I_VFL_CLS) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") @@ -169,11 +135,11 @@ H5FD_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_init_interface() */ +} /* end H5FD__init_package() */ /*------------------------------------------------------------------------- - * Function: H5FD_term_interface + * Function: H5FD_term_package * * Purpose: Terminate this interface: free all memory and reset global * variables to their initial values. Release all ID groups @@ -182,40 +148,37 @@ done: * 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: - * *------------------------------------------------------------------------- */ int -H5FD_term_interface(void) +H5FD_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { if(H5I_nmembers(H5I_VFL) > 0) { (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); n++; /*H5I*/ } /* end if */ else { /* Destroy the VFL driver id group */ - (void)H5I_dec_type_ref(H5I_VFL); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_VFL) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5FD_term_interface() */ +} /* end H5FD_term_package() */ /*------------------------------------------------------------------------- @@ -223,7 +186,7 @@ H5FD_term_interface(void) * * 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). + * virtual file layer object identifiers (cf H5FD__init_package). * * Return: Success: Non-negative * @@ -350,7 +313,7 @@ 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) @@ -450,16 +413,17 @@ H5FD_get_class(hid_t id) ret_value = (H5FD_class_t *)H5I_object(id); else { H5P_genplist_t *plist; /* Property list pointer */ - hid_t driver_id = -1; /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") if(TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID") - ret_value = H5FD_get_class(driver_id); + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") + ret_value = H5FD_get_class(driver_prop.driver_id); } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id or file access property list") @@ -614,96 +578,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_pl_copy - * - * Purpose: Copies the driver-specific part of the a property list. - * This is common code, used by both the dataset transfer and - * file access property list routines. - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, October 23, 2003 - * - * Modifications: - * Pedro Vicente Nunes, Wednesday, July 26, 2006 - * added a HGOTO_ERROR call in the case the copy function returns NULL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_pl_copy(void *(*copy_func)(const void *), size_t pl_size, const void *old_pl, void **copied_pl) -{ - void *new_pl = NULL; /* Copy of property list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Copy old pl, if one exists */ - if(old_pl) { - /* Allow the driver to copy or do it ourselves */ - if(copy_func) { - new_pl = (copy_func)(old_pl); - if(new_pl==NULL) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list copy failed") - } else if(pl_size>0) { - if((new_pl = H5MM_malloc(pl_size))==NULL) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list allocation failed") - HDmemcpy(new_pl, old_pl, pl_size); - } else - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "no way to copy driver property list") - } /* end if */ - - /* Set copied value */ - *copied_pl=new_pl; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_pl_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD_pl_close - * - * Purpose: Closes a driver for a property list - * This is common code, used by both the dataset transfer and - * file access property list routines. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, October 23, 2003 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Allow driver to free or do it ourselves */ - if(pl && free_func) { - if((free_func)(pl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed") - } /* end if */ - else - H5MM_xfree(pl); - - /* Decrement reference count for driver */ - if(H5I_dec_ref(driver_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_pl_close() */ - - -/*------------------------------------------------------------------------- * Function: H5FD_fapl_get * * Purpose: Gets the file access property list associated with a file. @@ -725,8 +599,6 @@ done: * Programmer: Robb Matzke * Friday, August 13, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -747,88 +619,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_open - * - * Purpose: Mark a driver as used by a file access property list - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, October 23, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info) -{ - void *copied_driver_info = NULL; /* Temporary VFL driver info */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Increment the reference count on driver and copy driver info */ - if(H5I_inc_ref(driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") - if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver info") - - /* Set the driver properties for the list */ - if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver ID") - if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &copied_driver_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver info") - copied_driver_info = NULL; - -done: - if(ret_value < 0) - if(copied_driver_info && H5FD_fapl_close(driver_id, copied_driver_info) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_fapl_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD_fapl_copy - * - * Purpose: Copies the driver-specific part of the file access property - * list. - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Robb Matzke - * Tuesday, August 3, 1999 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_fapl_copy(hid_t driver_id, const void *old_fapl, void **copied_fapl) -{ - H5FD_class_t *driver; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") - - /* Copy the file access property list */ - if(H5FD_pl_copy(driver->fapl_copy, driver->fapl_size, old_fapl, copied_fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver file access property list") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- * Function: H5FD_fapl_close * * Purpose: Closes a driver for a dataset transfer property list @@ -839,26 +629,32 @@ done: * Programmer: Robb Matzke * Tuesday, August 3, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5FD_fapl_close(hid_t driver_id, void *fapl) +H5FD_fapl_close(hid_t driver_id, const void *driver_info) { - H5FD_class_t *driver = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check args */ if(driver_id > 0) { + H5FD_class_t *driver; + + /* Retrieve the driver for the ID */ if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") - /* Close the driver for the property list */ - if(H5FD_pl_close(driver_id, driver->fapl_free, fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed") + /* Allow driver to free info or do it ourselves */ + if(driver_info) { + if(driver->fapl_free) { + if((driver->fapl_free)((void *)driver_info) < 0) /* Casting away const OK -QAK */ + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") + } /* end if */ + else + H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ + } /* end if */ } /* end if */ done: @@ -970,11 +766,11 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_class_t *driver; /* VFD for file */ H5FD_t *file = NULL; /* VFD file struct */ - hid_t driver_id = -1; /* VFD ID */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ 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) @@ -987,11 +783,11 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") /* Get the VFD to open the file with */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID") + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") /* Get driver info */ - if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) + if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") if(NULL == driver->open) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") @@ -1000,7 +796,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_driver_query(driver, &driver_flags); /* Get initial file image info */ - if(H5P_get(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) + if(H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file image info") /* If an image is provided, make sure the driver supports this feature */ @@ -1019,7 +815,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) * Fill in public fields. We must increment the reference count on the * driver ID to prevent it from being freed while this file is open. */ - file->driver_id = driver_id; + file->driver_id = driver_prop.driver_id; if(H5I_inc_ref(file->driver_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") file->cls = driver; @@ -1189,7 +985,7 @@ done: 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*/ @@ -1602,7 +1398,7 @@ done: 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) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index e553f6b..17ec07c 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -22,8 +22,7 @@ * access to small, temporary hdf5 files. */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_core_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -122,57 +121,57 @@ typedef struct H5FD_core_fapl_t { (size_t)((A)+(Z))<(size_t)(A)) /* Prototypes */ -static herr_t H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end); -static herr_t H5FD_core_destroy_dirty_list(H5FD_core_t *file); -static herr_t H5FD_core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size); -static herr_t H5FD_core_term(void); -static void *H5FD_core_fapl_get(H5FD_t *_file); -static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end); +static herr_t H5FD__core_destroy_dirty_list(H5FD_core_t *file); +static herr_t H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size); +static herr_t H5FD__core_term(void); +static void *H5FD__core_fapl_get(H5FD_t *_file); +static H5FD_t *H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_core_close(H5FD_t *_file); -static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_core_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__core_close(H5FD_t *_file); +static int H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__core_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__core_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__core_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__core_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); -static herr_t H5FD_core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_core_g = { "core", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_core_term, /* terminate */ + H5FD__core_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ sizeof(H5FD_core_fapl_t), /* fapl_size */ - H5FD_core_fapl_get, /* fapl_get */ + H5FD__core_fapl_get, /* fapl_get */ NULL, /* fapl_copy */ NULL, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_core_open, /* open */ - H5FD_core_close, /* close */ - H5FD_core_cmp, /* cmp */ - H5FD_core_query, /* query */ + H5FD__core_open, /* open */ + H5FD__core_close, /* close */ + H5FD__core_cmp, /* cmp */ + H5FD__core_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_core_get_eoa, /* get_eoa */ - H5FD_core_set_eoa, /* set_eoa */ - H5FD_core_get_eof, /* get_eof */ - H5FD_core_get_handle, /* get_handle */ - H5FD_core_read, /* read */ - H5FD_core_write, /* write */ - H5FD_core_flush, /* flush */ - H5FD_core_truncate, /* truncate */ + H5FD__core_get_eoa, /* get_eoa */ + H5FD__core_set_eoa, /* set_eoa */ + H5FD__core_get_eof, /* get_eof */ + H5FD__core_get_handle, /* get_handle */ + H5FD__core_read, /* read */ + H5FD__core_write, /* write */ + H5FD__core_flush, /* flush */ + H5FD__core_truncate, /* truncate */ NULL, /* lock */ NULL, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ @@ -183,7 +182,7 @@ H5FL_DEFINE(H5FD_core_region_t); /*------------------------------------------------------------------------- - * Function: H5FD_core_add_dirty_region + * Function: H5FD__core_add_dirty_region * * Purpose: Add a new dirty region to the list for later flushing * to the backing store. @@ -193,7 +192,7 @@ H5FL_DEFINE(H5FD_core_region_t); *------------------------------------------------------------------------- */ static herr_t -H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) +H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) { H5FD_core_region_t *b_item = NULL; H5FD_core_region_t *a_item = NULL; @@ -206,7 +205,7 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) hbool_t was_adjusted = FALSE; #endif - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); HDassert(file->dirty_list); @@ -310,11 +309,11 @@ if(was_adjusted) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_add_dirty_region() */ +} /* end H5FD__core_add_dirty_region() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_destroy_dirty_list + * Function: H5FD__core_destroy_dirty_list * * Purpose: Completely destroy the dirty list. * @@ -323,11 +322,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_destroy_dirty_list(H5FD_core_t *file) +H5FD__core_destroy_dirty_list(H5FD_core_t *file) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -352,11 +351,11 @@ if(count != 0) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_destroy_dirty_list() */ +} /* end H5FD__core_destroy_dirty_list() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_write_to_bstore + * Function: H5FD__core_write_to_bstore * * Purpose: Write data to the backing store. * @@ -364,7 +363,8 @@ done: * *------------------------------------------------------------------------- */ -static herr_t H5FD_core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) +static herr_t +H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) { unsigned char *ptr = file->mem + addr; /* mutable pointer into the * buffer (can't change mem) @@ -420,12 +420,11 @@ fprintf(stderr, "bytes wrote: %lu\n", bytes_wrote); done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_core_write_to_bstore() */ +} /* end H5FD__core_write_to_bstore() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_init_interface + * Function: H5FD__init_package * * Purpose: Initializes any interface-specific data or routines. * @@ -434,7 +433,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; @@ -445,7 +444,7 @@ H5FD_core_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_core_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -465,23 +464,23 @@ done: 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) if(H5I_VFL != H5I_get_type(H5FD_CORE_g)) - H5FD_CORE_g = H5FD_register(&H5FD_core_g,sizeof(H5FD_class_t),FALSE); + H5FD_CORE_g = H5FD_register(&H5FD_core_g, sizeof(H5FD_class_t), FALSE); /* Set return value */ ret_value = H5FD_CORE_g; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_core_init() */ /*--------------------------------------------------------------------------- - * Function: H5FD_core_term + * Function: H5FD__core_term * * Purpose: Shut down the VFD * @@ -493,15 +492,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_core_term(void) +H5FD__core_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_CORE_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_core_term() */ +} /* end H5FD__core_term() */ /*------------------------------------------------------------------------- @@ -535,11 +534,11 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) fa.increment = increment; fa.backing_store = backing_store; - ret_value= H5P_set_driver(plist, H5FD_CORE, &fa); + ret_value = H5P_set_driver(plist, H5FD_CORE, &fa); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_fapl_core() */ /*------------------------------------------------------------------------- @@ -557,8 +556,8 @@ 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 */ + const H5FD_core_fapl_t *fa; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -566,28 +565,27 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_stor if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5FD_CORE != H5P_get_driver(plist)) + if(H5FD_CORE != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - if (increment) + if(increment) *increment = fa->increment; - if (backing_store) + if(backing_store) *backing_store = fa->backing_store; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_core() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_fapl_get + * Function: H5FD__core_fapl_get * * Purpose: Returns a copy of the file access properties. * * Return: Success: Ptr to new file access properties. - * * Failure: NULL * * Programmer: Robb Matzke @@ -596,13 +594,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_core_fapl_get(H5FD_t *_file) +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 + FUNC_ENTER_STATIC if(NULL == (fa = (H5FD_core_fapl_t *)H5MM_calloc(sizeof(H5FD_core_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -615,18 +613,17 @@ H5FD_core_fapl_get(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__core_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_open + * Function: H5FD___core_open * * Purpose: Create memory as an HDF5 file. * * 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 @@ -635,7 +632,7 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { int o_flags; H5FD_core_t *file = NULL; @@ -647,9 +644,9 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) 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 + FUNC_ENTER_STATIC /* Check arguments */ if(!name || !*name) @@ -661,7 +658,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HDassert(H5P_DEFAULT != fapl_id); if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") /* Build the open flags */ @@ -671,7 +668,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(H5F_ACC_EXCL & flags) o_flags |= O_EXCL; /* Retrieve initial file image info */ - if(H5P_get(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) + if(H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial file image info") /* If the file image exists and this is an open, make sure the file doesn't exist */ @@ -864,11 +861,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_open() */ +} /* end H5FD__core_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_close + * Function: H5FD__core_close * * Purpose: Closes the file. * @@ -880,20 +877,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_close(H5FD_t *_file) +H5FD__core_close(H5FD_t *_file) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Flush any changed buffers */ - if(H5FD_core_flush(_file, (hid_t)-1, TRUE) < 0) + if(H5FD__core_flush(_file, (hid_t)-1, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush core vfd backing store") /* Destroy the dirty region list */ if(file->dirty_list) - if(H5FD_core_destroy_dirty_list(file) != SUCCEED) + if(H5FD__core_destroy_dirty_list(file) != SUCCEED) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free core vfd dirty region list") /* Release resources */ @@ -915,11 +912,11 @@ H5FD_core_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_close() */ +} /* end H5FD__core_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_cmp + * Function: H5FD__core_cmp * * Purpose: Compares two files belonging to this driver by name. If one * file doesn't have a name then it is less than the other file. @@ -927,7 +924,6 @@ done: * address. * * Return: Success: A value like strcmp() - * * Failure: never fails (arguments were checked by the * caller). * @@ -937,13 +933,13 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_core_t *f1 = (const H5FD_core_t*)_f1; const H5FD_core_t *f2 = (const H5FD_core_t*)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(f1->fd >= 0 && f2->fd >= 0) { /* Compare low level file information for backing store */ @@ -994,11 +990,11 @@ H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_cmp() */ +} /* end H5FD__core_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_query + * Function: H5FD__core_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1011,11 +1007,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) +H5FD__core_query(const H5FD_t * _file, unsigned long *flags /* out */) { const H5FD_core_t *file = (const H5FD_core_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -1033,11 +1029,11 @@ H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_core_query() */ +} /* end H5FD__core_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_get_eoa + * Function: H5FD__core_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 @@ -1051,18 +1047,18 @@ H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__core_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_core_t *file = (const H5FD_core_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) -} +} /* end H5FD__core_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_set_eoa + * Function: H5FD__core_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 @@ -1076,12 +1072,12 @@ H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(ADDR_OVERFLOW(addr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "address overflow") @@ -1090,11 +1086,11 @@ H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_set_eoa() */ +} /* end H5FD__core_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_get_eof + * Function: H5FD__core_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the size of the underlying memory or the HDF5 @@ -1110,18 +1106,18 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__core_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_core_t *file = (const H5FD_core_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eof) -} +} /* end H5FD__core_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_get_handle + * Function: H5FD__core_get_handle * * Purpose: Gets the file handle of CORE file driver. * @@ -1133,12 +1129,12 @@ H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) { H5FD_core_t *file = (H5FD_core_t *)_file; /* core VFD info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ if(!file_handle) @@ -1177,11 +1173,11 @@ H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_get_handle() */ +} /* end H5FD__core_get_handle() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_read + * Function: H5FD__core_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -1189,7 +1185,6 @@ done: * * Return: Success: SUCCEED. Result is stored in caller-supplied * buffer BUF. - * * Failure: FAIL, Contents of buffer BUF are undefined. * * Programmer: Robb Matzke @@ -1198,13 +1193,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__core_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*/) { H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1240,11 +1235,11 @@ H5FD_core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__core_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_write + * Function: H5FD__core_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1258,13 +1253,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1310,7 +1305,8 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if(file->dirty_list) { haddr_t start = addr; haddr_t end = addr + (haddr_t)size - 1; - if(H5FD_core_add_dirty_region(file, start, end) != SUCCEED) + + if(H5FD__core_add_dirty_region(file, start, end) != SUCCEED) HGOTO_ERROR(H5E_VFL, H5E_CANTINSERT, FAIL, "unable to add core VFD dirty region during write call - addresses: start=%llu end=%llu", start, end) } @@ -1322,11 +1318,11 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_write() */ +} /* end H5FD__core_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_flush + * Function: H5FD__core_flush * * Purpose: Flushes the file to backing store if there is any and if the * dirty flag is set. @@ -1339,12 +1335,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UNUSED closing) +H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UNUSED closing) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Write to backing store */ if (file->dirty && file->fd >= 0 && file->backing_store) { @@ -1371,7 +1367,7 @@ H5FD_core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UN #ifdef DER fprintf(stderr, "(%llu, %llu : %lu)\n", item->start, item->end, size); #endif - if(H5FD_core_write_to_bstore(file, item->start, size) != SUCCEED) + 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 */ @@ -1385,24 +1381,23 @@ if(file->eoa > file->eof) fprintf(stderr, "*** EOA BADNESS ***\n"); fprintf(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) + 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 */ + } /* end else */ file->dirty = FALSE; } done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__core_flush() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_truncate + * Function: H5FD__core_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1437,13 +1432,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_core_t *file = (H5FD_core_t*)_file; size_t new_eof; /* New size of memory buffer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1523,5 +1518,5 @@ fprintf(stderr, "OLD: Truncated to: %llu\n", file->eoa); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_truncate() */ +} /* end H5FD__core_truncate() */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index f4ee910..de64923 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -22,12 +22,8 @@ * buffer. The main system support this feature is Linux. */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_direct_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ -/* For system function posix_memalign - Commented it out because copper isn't able to compile - * this file. */ -/* #define _XOPEN_SOURCE 600 */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -182,10 +178,9 @@ H5FL_DEFINE_STATIC(H5FD_direct_t); /*-------------------------------------------------------------------------- NAME - H5FD_direct_init_interface -- Initialize interface-specific information + H5FD__init_package -- Initialize interface-specific information USAGE - herr_t H5FD_direct_init_interface() - + herr_t H5FD__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -194,18 +189,18 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5FD_direct_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_direct_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize direct VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_direct_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -236,7 +231,7 @@ H5FD_direct_init(void) H5FD_DIRECT_g = H5FD_register(&H5FD_direct_g,sizeof(H5FD_class_t),FALSE); /* Set return value */ - ret_value=H5FD_DIRECT_g; + ret_value = H5FD_DIRECT_g; done: FUNC_LEAVE_NOAPI(ret_value) @@ -279,8 +274,6 @@ H5FD_direct_term(void) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -297,17 +290,17 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if(boundary != 0) - fa.mboundary = boundary; + fa.mboundary = boundary; else - fa.mboundary = MBOUNDARY_DEF; + fa.mboundary = MBOUNDARY_DEF; if(block_size != 0) - fa.fbsize = block_size; + fa.fbsize = block_size; else - fa.fbsize = FBSIZE_DEF; + fa.fbsize = FBSIZE_DEF; if(cbuf_size != 0) - fa.cbsize = cbuf_size; + fa.cbsize = cbuf_size; else - fa.cbsize = CBSIZE_DEF; + fa.cbsize = CBSIZE_DEF; /* Set the default to be true for data alignment */ fa.must_align = TRUE; @@ -316,7 +309,7 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu if(fa.cbsize % fa.fbsize != 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size") - ret_value= H5P_set_driver(plist, H5FD_DIRECT, &fa); + ret_value = H5P_set_driver(plist, H5FD_DIRECT, &fa); done: FUNC_LEAVE_API(ret_value) @@ -336,37 +329,35 @@ 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 */ + 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); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - if (H5FD_DIRECT!=H5P_get_driver(plist)) + if(H5FD_DIRECT != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if (NULL==(fa=H5P_get_driver_info(plist))) + if(NULL == (fa = H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - if (boundary) + if(boundary) *boundary = fa->mboundary; - if (block_size) - *block_size = fa->fbsize; + if(block_size) + *block_size = fa->fbsize; if (cbuf_size) - *cbuf_size = fa->cbsize; + *cbuf_size = fa->cbsize; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_direct() */ /*------------------------------------------------------------------------- @@ -507,7 +498,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5FD_direct_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (H5FD_direct_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") file->fd = fd; diff --git a/src/H5FDdrvr_module.h b/src/H5FDdrvr_module.h new file mode 100644 index 0000000..8bb83a1 --- /dev/null +++ b/src/H5FDdrvr_module.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FD driver package. Including this header means that the source file + * is part of the H5FD driver package. + */ +#ifndef _H5FDdrvr_module_H +#define _H5FDdrvr_module_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5_MY_PKG H5FD +#define H5_MY_PKG_ERR H5E_FILE +#define H5_MY_PKG_INIT YES +#define H5_PKG_SINGLE_SOURCE + +#endif /* _H5FDdrvr_module_H */ + diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 9edbc72..7a35612 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -34,8 +34,7 @@ * */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_family_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -147,10 +146,9 @@ static const H5FD_class_t H5FD_family_g = { /*-------------------------------------------------------------------------- NAME - H5FD_family_init_interface -- Initialize interface-specific information + H5FD__init_package -- Initialize interface-specific information USAGE - herr_t H5FD_family_init_interface() - + herr_t H5FD__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -159,18 +157,18 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5FD_family_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_family_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize family VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_family_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -267,7 +265,6 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) FUNC_ENTER_API(FAIL) H5TRACE3("e", "ihi", fapl_id, msize, memb_fapl_id); - /* Check arguments */ if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") @@ -277,16 +274,13 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) if(TRUE != H5P_isa_class(memb_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - /* - * Initialize driver specific information. No need to copy it into the FA - * struct since all members will be copied by H5P_set_driver(). - */ + /* Initialize driver specific information. */ fa.memb_size = msize; fa.memb_fapl_id = memb_fapl_id; if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - ret_value= H5P_set_driver(plist, H5FD_FAMILY, &fa); + ret_value = H5P_set_driver(plist, H5FD_FAMILY, &fa); done: FUNC_LEAVE_API(ret_value) @@ -316,21 +310,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize/*out*/, - hid_t *memb_fapl_id/*out*/) +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 */ + 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); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - if(H5FD_FAMILY != H5P_get_driver(plist)) + if(H5FD_FAMILY != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") if(msize) *msize = fa->memb_size; @@ -368,7 +361,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -414,7 +407,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -595,12 +588,8 @@ H5FD_family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsi 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 */ + 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. */ @@ -626,23 +615,6 @@ done: * 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. - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -666,7 +638,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, /* Initialize file from file access properties */ if(NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") - if(H5P_FILE_ACCESS_DEFAULT==fapl_id) { + if(H5P_FILE_ACCESS_DEFAULT == fapl_id) { file->memb_fapl_id = H5P_FILE_ACCESS_DEFAULT; if(H5I_inc_ref(file->memb_fapl_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") @@ -676,11 +648,11 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, } /* end if */ else { H5P_genplist_t *plist; /* Property list pointer */ - H5FD_family_fapl_t *fa; + 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") - if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") /* Check for new family file size. It's used by h5repart only. */ @@ -693,8 +665,8 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, file->repart_members = TRUE; } /* end if */ - if(fa->memb_fapl_id==H5P_FILE_ACCESS_DEFAULT) { - if(H5I_inc_ref(fa->memb_fapl_id, FALSE)<0) + if(fa->memb_fapl_id == H5P_FILE_ACCESS_DEFAULT) { + if(H5I_inc_ref(fa->memb_fapl_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") file->memb_fapl_id = fa->memb_fapl_id; } /* end if */ @@ -1048,7 +1020,7 @@ H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) 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 */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1102,7 +1074,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 diff --git a/src/H5FDint.c b/src/H5FDint.c index 13bc68a..e7cb2c0 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5FD_PACKAGE /*suppress error about including H5FDpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_int_init_interface +#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ @@ -80,28 +77,6 @@ -/*-------------------------------------------------------------------------- -NAME - H5FD_int_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_int_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5FD_int_init_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5FD_init()) -} /* H5FD_int_init_interface() */ - - /*------------------------------------------------------------------------- * Function: H5FD_locate_signature * @@ -325,7 +300,7 @@ done: 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) @@ -367,7 +342,7 @@ done: haddr_t H5FD_get_eof(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) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index e8695c5..eb2c0e3 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -26,8 +26,7 @@ * With custom modifications... */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_log_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -221,7 +220,7 @@ H5FL_DEFINE_STATIC(H5FD_log_t); /*------------------------------------------------------------------------- - * Function: H5FD_log_init_interface + * Function: H5FD__init_package * * Purpose: Initializes any interface-specific data or routines. * @@ -230,18 +229,18 @@ H5FL_DEFINE_STATIC(H5FD_log_t); *------------------------------------------------------------------------- */ static herr_t -H5FD_log_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_log_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize log VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_log_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -261,7 +260,7 @@ done: 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) @@ -361,7 +360,7 @@ static void * H5FD_log_fapl_get(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -390,7 +389,7 @@ H5FD_log_fapl_copy(const void *_old_fa) { const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa; H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -471,7 +470,7 @@ 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 */ + 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 @@ -483,7 +482,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) struct timeval stat_timeval_diff; #endif /* H5_HAVE_GETTIMEOFDAY */ h5_stat_t sb; - H5FD_t *ret_value; /* Return value */ + H5FD_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -510,7 +509,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") #ifdef H5_HAVE_GETTIMEOFDAY @@ -922,7 +921,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 diff --git a/src/H5FDmodule.h b/src/H5FDmodule.h new file mode 100644 index 0000000..6358e86 --- /dev/null +++ b/src/H5FDmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FD package. Including this header means that the source file + * is part of the H5FD package. + */ +#ifndef _H5FDmodule_H +#define _H5FDmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FD_MODULE +#define H5_MY_PKG H5FD +#define H5_MY_PKG_ERR H5E_VFL +#define H5_MY_PKG_INIT YES + +#endif /* _H5FDmodule_H */ + diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 86a5d39..fdc4eca 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -452,24 +452,13 @@ done: * Programmer: Robb Matzke * Monday, August 9, 1999 * - * Modifications: - * - * Quincey Koziol - 2002/06/17 - * Removed 'disp' parameter, read & write routines will use - * the address of the dataset in MPI_File_set_view() calls, as - * necessary. - * - * Quincey Koziol - 2002/06/17 - * Changed to set temporary properties in a dxpl, instead of - * flags in the file struct, which will make this more threadsafe. - * *------------------------------------------------------------------------- */ herr_t H5FD_mpi_setup_collective(hid_t dxpl_id, MPI_Datatype *btype, MPI_Datatype *ftype) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5f36d2a..b3ef1f2 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -21,8 +21,7 @@ * */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_mpio_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -167,10 +166,9 @@ static int H5FD_mpio_Debug[256] = /*-------------------------------------------------------------------------- NAME - H5FD_mpio_init_interface -- Initialize interface-specific information + H5FD__init_package -- Initialize interface-specific information USAGE - herr_t H5FD_mpio_init_interface() - + herr_t H5FD__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -179,18 +177,18 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5FD_mpio_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_mpio_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mpio VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_mpio_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -304,33 +302,6 @@ H5FD_mpio_term(void) * 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.) - * *------------------------------------------------------------------------- */ herr_t @@ -357,11 +328,11 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) fa.info = info; /* duplication is done during driver setting. */ - ret_value= H5P_set_driver(plist, H5FD_MPIO, &fa); + ret_value = H5P_set_driver(plist, H5FD_MPIO, &fa); done: FUNC_LEAVE_API(ret_value) -} +} /* H5Pset_fapl_mpio() */ /*------------------------------------------------------------------------- @@ -386,71 +357,60 @@ done: * 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. - * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) { - H5FD_mpio_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm_tmp=MPI_COMM_NULL; - int mpi_code; /* mpi return code */ - herr_t ret_value=SUCCEED; /* Return value */ + const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ + MPI_Comm comm_tmp = MPI_COMM_NULL; + hbool_t comm_copied = FALSE; /* MPI Comm has been duplicated */ + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, comm, info); if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") - if(H5FD_MPIO != H5P_get_driver(plist)) + if(H5FD_MPIO != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fa = (H5FD_mpio_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") /* Store the duplicated communicator in a temporary variable for error */ - /* recovery in case the INFO duplication fails. We cannot attempt to */ - /* the value into *comm yet since if MPI_Comm_dup fails, we will end */ - /* up freeing whatever *comm holds and that could be invalid. */ - if (comm){ - if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_tmp))) + /* recovery in case the INFO duplication fails. */ + if(comm) { + if(MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_tmp))) HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) - } + comm_copied = TRUE; + } /* end if */ - if (info){ - if (MPI_INFO_NULL != fa->info){ - if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(fa->info, info))) + if(info) { + 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 */ - if (comm) + /* 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) + if(comm_copied) MPI_Comm_free(&comm_tmp); - } + FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_mpio() */ /*------------------------------------------------------------------------- @@ -965,32 +925,6 @@ done: * Programmer: * 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 * @@ -1005,11 +939,11 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, int mpi_size; /* Total number of MPI processes */ int mpi_code; /* mpi return code */ MPI_Offset size; - const H5FD_mpio_fapl_t *fa=NULL; + const H5FD_mpio_fapl_t *fa = NULL; H5FD_mpio_fapl_t _fa; H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm_dup=MPI_COMM_NULL; - MPI_Info info_dup=MPI_INFO_NULL; + MPI_Comm comm_dup = MPI_COMM_NULL; + MPI_Info info_dup = MPI_INFO_NULL; H5FD_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1024,39 +958,42 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, /* Obtain a pointer to mpio-specific file access properties */ 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)) { + if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) { _fa.comm = MPI_COMM_SELF; /*default*/ _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; - } else { - if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist))) + } /* end if */ + else { + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_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)) + 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 */ - mpi_amode = (flags&H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; - if (flags&H5F_ACC_CREAT) mpi_amode |= MPI_MODE_CREATE; - if (flags&H5F_ACC_EXCL) mpi_amode |= MPI_MODE_EXCL; + mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; + if(flags & H5F_ACC_CREAT) + mpi_amode |= MPI_MODE_CREATE; + if(flags & H5F_ACC_EXCL) + mpi_amode |= MPI_MODE_EXCL; #ifdef H5FDmpio_DEBUG /* Check for debug commands in the info parameter */ { - char debug_str[128]; - int flag, i; - if (MPI_INFO_NULL != info_dup) { - MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str)-1, debug_str, &flag); - if (flag) { - fprintf(stdout, "H5FD_mpio debug flags=%s\n", debug_str ); - for (i=0; - debug_str[i]/*end of string*/ && i<128/*just in case*/; - ++i) { + if(MPI_INFO_NULL != info_dup) { + char debug_str[128]; + int flag; + + MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); + if(flag) { + int i; + + fprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str); + for(i = 0; debug_str[i]/*end of string*/ && i < 128/*just in case*/; ++i) H5FD_mpio_Debug[(int)debug_str[i]] = 1; - } } } } @@ -1523,21 +1460,21 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had use_view_this_time = TRUE; /* prepare for a full-blown xfer using btype, ftype, and disp */ - if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") /* * Set the file view when we are using MPI derived types */ - if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) /* When using types, use the address as the displacement for * MPI_File_set_view and reset the address for the read to zero */ - mpi_off=0; + mpi_off = 0; } /* end if */ } /* end if */ @@ -1553,7 +1490,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had HDassert(plist); /* get the transfer mode from the dxpl */ - if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode)<0) + if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { @@ -2128,7 +2065,7 @@ H5FD_mpio_communicator(const H5FD_t *_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/H5FDpkg.h b/src/H5FDpkg.h index 7c0988e..ef33cf1 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -21,7 +21,7 @@ * the H5FD package. Source files outside the H5FD package should * include H5FDprivate.h instead. */ -#ifndef H5FD_PACKAGE +#if !(defined H5FD_FRIEND || defined H5FD_MODULE) #error "Do not include this file outside the H5FD package!" #endif @@ -52,7 +52,6 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5FD_init(void); H5_DLL haddr_t H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, hsize_t size, haddr_t *align_addr, hsize_t *align_size); H5_DLL herr_t H5FD_free_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 0a7fe6c..412bbef 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -90,6 +90,12 @@ typedef struct { } \ } +/* Define structure to hold driver ID & info for FAPLs */ +typedef struct { + hid_t driver_id; /* Driver's ID */ + const void *driver_info; /* Driver info, for open callbacks */ +} H5FD_driver_prop_t; + /*****************************/ /* Library Private Variables */ @@ -111,8 +117,7 @@ H5_DLL hsize_t H5FD_sb_size(H5FD_t *file); H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf); H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf); H5_DLL void *H5FD_fapl_get(H5FD_t *file); -H5_DLL herr_t H5FD_fapl_open(struct H5P_genplist_t *plist, hid_t driver_id, const void *driver_info); -H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, void *fapl); +H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl); H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref); H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 10e2a66..34527df 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -25,8 +25,7 @@ * application to the same file). */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_sec2_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -179,7 +178,7 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t); /*------------------------------------------------------------------------- - * Function: H5FD_sec2_init_interface + * Function: H5FD__init_package * * Purpose: Initializes any interface-specific data or routines. * @@ -188,18 +187,18 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t); *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_sec2_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize sec2 VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_sec2_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -219,7 +218,7 @@ done: 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) @@ -316,7 +315,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 diff --git a/src/H5FDspace.c b/src/H5FDspace.c index deb2153..edc83e6 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5FD_PACKAGE /*suppress error about including H5FDpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_space_init_interface +#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ @@ -86,28 +83,6 @@ H5FL_DEFINE(H5FD_free_t); -/*-------------------------------------------------------------------------- -NAME - H5FD_space_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_space_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5FD_space_init_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5FD_init()) -} /* H5FD_space_init_interface() */ - - /*------------------------------------------------------------------------- * Function: H5FD_extend * @@ -129,7 +104,7 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, hbool_t new_block, hsize_t size, hadd hsize_t orig_size = size; /* Original allocation size */ haddr_t eoa; /* Address of end-of-allocated space */ hsize_t extra; /* Extra space to allocate, to align request */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -197,7 +172,7 @@ done: haddr_t H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5FD_ALLOC_DEBUG @@ -253,7 +228,7 @@ haddr_t H5FD_alloc(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -27,8 +27,7 @@ * move frequently accessed free lists to the head of the queue. */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FL_init_interface +#include "H5FLmodule.h" /* This source code file is part of the H5FL module */ /* #define H5FL_DEBUG */ @@ -117,6 +116,9 @@ struct H5FL_fac_node_t { struct H5FL_fac_node_t *next; /* Pointer to next block in free list */ }; +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* The head of the list of factory things to garbage collect */ static H5FL_fac_gc_list_t H5FL_fac_gc_head={0,NULL}; @@ -130,14 +132,18 @@ static H5FL_track_t *H5FL_out_head_g = NULL; #endif /* H5FL_TRACK */ /* Forward declarations of local static functions */ -static herr_t H5FL_reg_gc(void); -static herr_t H5FL_reg_gc_list(H5FL_reg_head_t *head); -static herr_t H5FL_arr_gc(void); -static herr_t H5FL_arr_gc_list(H5FL_arr_head_t *head); -static herr_t H5FL_blk_gc(void); -static herr_t H5FL_blk_gc_list(H5FL_blk_head_t *head); -static herr_t H5FL_fac_gc(void); -static herr_t H5FL_fac_gc_list(H5FL_fac_head_t *head); +static herr_t H5FL__reg_gc(void); +static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head); +static int H5FL__reg_term(void); +static herr_t H5FL__arr_gc(void); +static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head); +static int H5FL__arr_term(void); +static herr_t H5FL__blk_gc(void); +static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head); +static int H5FL__blk_term(void); +static herr_t H5FL__fac_gc(void); +static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head); +static int H5FL__fac_term_all(void); /* Declare a free list to manage the H5FL_blk_node_t struct */ H5FL_DEFINE(H5FL_blk_node_t); @@ -150,26 +156,66 @@ H5FL_DEFINE(H5FL_fac_head_t); /*-------------------------------------------------------------------------- -NAME - H5FL_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FL_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. - + NAME + H5FL_term_package + PURPOSE + Terminate various H5FL objects + USAGE + void H5FL_term_package() + RETURNS + Success: Positive if any action might have caused a change in some + other interface; zero otherwise. + Failure: Negative + DESCRIPTION + Release any resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + EXAMPLES + REVISION LOG --------------------------------------------------------------------------*/ -static herr_t -H5FL_init_interface(void) +int +H5FL_term_package(void) { + int n = 0; + FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Nothing currently... */ + if(H5_PKG_INIT_VAR) { + /* Garbage collect any nodes on the free lists */ + (void)H5FL_garbage_coll(); - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FL_init_interface() */ + /* Shut down the various kinds of free lists */ + n += H5FL__reg_term(); + n += H5FL__fac_term_all(); + n += H5FL__arr_term(); + n += H5FL__blk_term(); + + /* Mark interface closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + +#ifdef H5FL_TRACK + /* If we haven't freed all the allocated memory, dump out the list now */ + if(n > 0 && H5FL_out_head_g) { + H5FL_track_t *trk = H5FL_out_head_g; + + /* Dump information about all the outstanding allocations */ + while(trk != NULL) { + /* Print information about the outstanding block */ + HDfprintf(stderr,"%s: Outstanding allocation:\n", FUNC); + HDfprintf(stderr,"\tPtr: %p, File: %s, Function: %s, Line: %d\n", (((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line); + H5CS_print_stack(trk->stack, stderr); + + /* Advance to next node */ + trk = trk->next; + } /* end while */ + } /* end if */ +#endif /* H5FL_TRACK */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5FL_term_package() */ /*------------------------------------------------------------------------- @@ -191,7 +237,7 @@ H5FL_init_interface(void) static void * H5FL_malloc(size_t mem_size) { - void *ret_value; /* return value*/ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -297,7 +343,6 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) /* Free tracking information about the allocation location */ H5CS_close_stack(trk->stack); - trk->stack = H5MM_xfree(trk->stack); trk->file = H5MM_xfree(trk->file); trk->func = H5MM_xfree(trk->func); @@ -337,12 +382,12 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) /* Check for exceeding free list memory use limits */ /* First check this particular list */ if(head->onlist * head->size > H5FL_reg_lst_mem_lim) - if(H5FL_reg_gc_list(head)<0) + if(H5FL__reg_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on regular free lists */ if(H5FL_reg_gc_head.mem_freed>H5FL_reg_glb_mem_lim) - if(H5FL_reg_gc()<0) + if(H5FL__reg_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -368,7 +413,7 @@ done: 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) @@ -405,8 +450,8 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t)); - H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack); + ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); + HDassert(((H5FL_track_t *)ret_value)->stack); ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file); ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func); ((H5FL_track_t *)ret_value)->line = call_line; @@ -445,7 +490,7 @@ done: 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) @@ -466,7 +511,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FL_reg_gc_list + * Function: H5FL__reg_gc_list * * Purpose: Garbage collect on a particular object free list * @@ -476,26 +521,25 @@ done: * Programmer: Quincey Koziol * Tuesday, July 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_reg_gc_list(H5FL_reg_head_t *head) +H5FL__reg_gc_list(H5FL_reg_head_t *head) { H5FL_reg_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - void *tmp; /* Temporary node pointer */ size_t total_mem; /* Total memory used on list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Calculate the total memory used on this list */ - total_mem=head->onlist*head->size; + total_mem = head->onlist * head->size; /* For each free list being garbage collected, walk through the nodes and free them */ - free_list=head->list; - while(free_list!=NULL) { - tmp=free_list->next; + free_list = head->list; + while(free_list != NULL) { + void *tmp; /* Temporary node pointer */ + + tmp = free_list->next; /* Decrement the count of nodes allocated and free the node */ head->allocated--; @@ -506,18 +550,18 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) } /* end while */ /* Indicate no free nodes on the free list */ - head->list=NULL; - head->onlist=0; + head->list = NULL; + head->onlist = 0; /* Decrement global count of free memory on "regular" lists */ - H5FL_reg_gc_head.mem_freed-=total_mem; + H5FL_reg_gc_head.mem_freed -= total_mem; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_reg_gc_list() */ +} /* end H5FL__reg_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_reg_gc + * Function: H5FL__reg_gc * * Purpose: Garbage collect on all the object free lists * @@ -534,30 +578,30 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) *------------------------------------------------------------------------- */ static herr_t -H5FL_reg_gc(void) +H5FL__reg_gc(void) { H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Walk through all the free lists, free()'ing the nodes */ - gc_node=H5FL_reg_gc_head.first; - while(gc_node!=NULL) { + gc_node = H5FL_reg_gc_head.first; + while(gc_node != NULL) { /* Release the free nodes on the list */ - if(H5FL_reg_gc_list(gc_node->list)<0) + if(H5FL__reg_gc_list(gc_node->list) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_node=gc_node->next; + gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists is recycled */ - HDassert(H5FL_reg_gc_head.mem_freed==0); + HDassert(H5FL_reg_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_reg_gc() */ +} /* end H5FL__reg_gc() */ /*-------------------------------------------------------------------------- @@ -566,7 +610,7 @@ done: PURPOSE Terminate various H5FL object free lists USAGE - int H5FL_term() + int H5FL_reg_term() RETURNS Success: Positive if any action might have caused a change in some other interface; zero otherwise. @@ -586,50 +630,46 @@ done: again to reclaim this layer's memory. --------------------------------------------------------------------------*/ static int -H5FL_reg_term(void) +H5FL__reg_term(void) { H5FL_reg_gc_node_t *left; /* pointer to garbage collection lists with work left */ - H5FL_reg_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + + /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ + left = NULL; + while(H5FL_reg_gc_head.first != NULL) { + H5FL_reg_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - if (H5_interface_initialize_g) { - /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ - left=NULL; - while(H5FL_reg_gc_head.first!=NULL) { - tmp=H5FL_reg_gc_head.first->next; + /* Get a copy of the next node */ + tmp = H5FL_reg_gc_head.first->next; #ifdef H5FL_DEBUG - printf("H5FL_reg_term: head->name=%s, head->allocated=%d\n", H5FL_reg_gc_head.first->list->name,(int)H5FL_reg_gc_head.first->list->allocated); +printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ - /* Check if the list has allocations outstanding */ - if(H5FL_reg_gc_head.first->list->allocated>0) { - /* Add free list to the list of nodes with allocations open still */ - H5FL_reg_gc_head.first->next=left; - left=H5FL_reg_gc_head.first; - } /* end if */ - /* No allocations left open for list, get rid of it */ - else { - /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ - H5FL_reg_gc_head.first->list->init=0; + /* Check if the list has allocations outstanding */ + if(H5FL_reg_gc_head.first->list->allocated > 0) { + /* Add free list to the list of nodes with allocations open still */ + H5FL_reg_gc_head.first->next = left; + left = H5FL_reg_gc_head.first; + } /* end if */ + /* No allocations left open for list, get rid of it */ + else { + /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ + H5FL_reg_gc_head.first->list->init = 0; - /* Free the node from the garbage collection list */ - H5MM_xfree(H5FL_reg_gc_head.first); - } /* end else */ + /* Free the node from the garbage collection list */ + H5MM_xfree(H5FL_reg_gc_head.first); + } /* end else */ - H5FL_reg_gc_head.first=tmp; - } /* end while */ + H5FL_reg_gc_head.first = tmp; + } /* end while */ - /* Point to the list of nodes left with allocations open, if any */ - H5FL_reg_gc_head.first=left; - if (!left) - H5_interface_initialize_g = 0; /*this layer has reached its initial state*/ - } + /* Point to the list of nodes left with allocations open, if any */ + H5FL_reg_gc_head.first = left; - /* Terminating this layer never affects other layers; rather, other layers affect - * the termination of this layer. */ - FUNC_LEAVE_NOAPI(0) -} /* end H5FL_reg_term() */ + FUNC_LEAVE_NOAPI(H5FL_reg_gc_head.first != NULL ? 1 : 0) +} /* end H5FL__reg_term() */ /*------------------------------------------------------------------------- @@ -654,7 +694,7 @@ H5FL_reg_term(void) 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 @@ -716,7 +756,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -809,21 +849,20 @@ done: 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) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if((free_list=H5FL_blk_find_list(&(head->head),size))!=NULL && free_list->list!=NULL) - ret_value=TRUE; + if((free_list = H5FL_blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL) + ret_value = TRUE; else - ret_value=FALSE; -done: + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_blk_free_block_avail() */ @@ -849,9 +888,9 @@ done: 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) @@ -897,8 +936,8 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t)); - H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack); + ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); + HDassert(((H5FL_track_t *)ret_value)->stack); ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file); ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func); ((H5FL_track_t *)ret_value)->line = call_line; @@ -941,7 +980,7 @@ done: 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) @@ -1001,7 +1040,6 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) /* Free tracking information about the allocation location */ H5CS_close_stack(trk->stack); - trk->stack = H5MM_xfree(trk->stack); trk->file = H5MM_xfree(trk->file); trk->func = H5MM_xfree(trk->func); @@ -1044,20 +1082,20 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) /* Increment the number of blocks on free list */ head->onlist++; - head->list_mem+=free_size; + head->list_mem += free_size; /* Increment the amount of "block" freed memory globally */ - H5FL_blk_gc_head.mem_freed+=free_size; + H5FL_blk_gc_head.mem_freed += free_size; /* Check for exceeding free list memory use limits */ /* First check this particular list */ - if(head->list_mem>H5FL_blk_lst_mem_lim) - if(H5FL_blk_gc_list(head)<0) + if(head->list_mem > H5FL_blk_lst_mem_lim) + if(H5FL__blk_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on block free lists */ - if(H5FL_blk_gc_head.mem_freed>H5FL_blk_glb_mem_lim) - if(H5FL_blk_gc()<0) + if(H5FL_blk_gc_head.mem_freed > H5FL_blk_glb_mem_lim) + if(H5FL__blk_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -1121,7 +1159,8 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ trk->func = H5MM_xfree(trk->func); /* Store new tracking information */ - H5CS_copy_stack(trk->stack); + trk->stack = H5CS_copy_stack(); + HDassert(trk->stack); trk->file = H5MM_strdup(call_file); trk->func = H5MM_strdup(call_func); trk->line = call_line; @@ -1140,7 +1179,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FL_blk_gc_list + * Function: H5FL__blk_gc_list * * Purpose: Garbage collect a priority queue * @@ -1150,34 +1189,33 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_blk_gc_list(H5FL_blk_head_t *head) +H5FL__blk_gc_list(H5FL_blk_head_t *head) { - H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ - void *next; /* Temp. ptr to the free list list node */ - void *temp; /* Temp. ptr to the free list page node */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Loop through all the nodes in the block free list queue */ - while(head->head!=NULL) { - temp=head->head->next; + while(head->head != NULL) { + H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ + void *temp; /* Temp. ptr to the free list page node */ + + temp = head->head->next; /* Loop through all the blocks in the free list, freeing them */ - list=head->head->list; - while(list!=NULL) { - next=list->next; + list = head->head->list; + while(list != NULL) { + void *next; /* Temp. ptr to the free list list node */ + + next = list->next; /* Decrement the number of blocks & memory allocated from this PQ */ head->allocated--; - head->list_mem-=head->head->size; + head->list_mem -= head->head->size; /* Decrement global count of free memory on "block" lists */ - H5FL_blk_gc_head.mem_freed-=head->head->size; + H5FL_blk_gc_head.mem_freed -= head->head->size; /* Free the block */ H5MM_free(list); @@ -1200,11 +1238,11 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) HDassert(0 == head->list_mem); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_blk_gc_list() */ +} /* end H5FL__blk_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_blk_gc + * Function: H5FL__blk_gc * * Purpose: Garbage collect on all the priority queues * @@ -1214,44 +1252,42 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_blk_gc(void) +H5FL__blk_gc(void) { H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_NOAPI_NOINIT /* Walk through all the free lists, free()'ing the nodes */ - gc_node=H5FL_blk_gc_head.first; - while(gc_node!=NULL) { + gc_node = H5FL_blk_gc_head.first; + while(gc_node != NULL) { /* For each free list being garbage collected, walk through the nodes and free them */ - if(H5FL_blk_gc_list(gc_node->pq)<0) + if(H5FL__blk_gc_list(gc_node->pq) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_node=gc_node->next; + gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists are recycled */ - HDassert(H5FL_blk_gc_head.mem_freed==0); + HDassert(H5FL_blk_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_blk_gc() */ +} /* end H5FL__blk_gc() */ /*-------------------------------------------------------------------------- NAME - H5FL_blk_term + H5FL__blk_term PURPOSE Terminate various H5FL_blk objects USAGE - void H5FL_blk_term() + void H5FL__blk_term() RETURNS Success: Positive if any action might have caused a change in some other interface; zero otherwise. @@ -1265,45 +1301,46 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5FL_blk_term(void) +H5FL__blk_term(void) { H5FL_blk_gc_node_t *left; /* pointer to garbage collection lists with work left */ - H5FL_blk_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ - left=NULL; - while(H5FL_blk_gc_head.first!=NULL) { - tmp=H5FL_blk_gc_head.first->next; + left = NULL; + while(H5FL_blk_gc_head.first != NULL) { + H5FL_blk_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + + 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); +printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ - if(H5FL_blk_gc_head.first->pq->allocated>0) { + if(H5FL_blk_gc_head.first->pq->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ - H5FL_blk_gc_head.first->next=left; - left=H5FL_blk_gc_head.first; + H5FL_blk_gc_head.first->next = left; + left = H5FL_blk_gc_head.first; } /* end if */ /* No allocations left open for list, get rid of it */ else { /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ - H5FL_blk_gc_head.first->pq->init=0; + H5FL_blk_gc_head.first->pq->init = 0; /* Free the node from the garbage collection list */ H5MM_free(H5FL_blk_gc_head.first); } /* end else */ - H5FL_blk_gc_head.first=tmp; + H5FL_blk_gc_head.first = tmp; } /* end while */ /* Point to the list of nodes left with allocations open, if any */ - H5FL_blk_gc_head.first=left; + H5FL_blk_gc_head.first = left; - FUNC_LEAVE_NOAPI(H5FL_blk_gc_head.first!=NULL ? 1 : 0) -} /* end H5FL_blk_term() */ + FUNC_LEAVE_NOAPI(H5FL_blk_gc_head.first != NULL ? 1 : 0) +} /* end H5FL__blk_term() */ /*------------------------------------------------------------------------- @@ -1422,13 +1459,13 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) /* Check for exceeding free list memory use limits */ /* First check this particular list */ - if(head->list_mem>H5FL_arr_lst_mem_lim) - if(H5FL_arr_gc_list(head)<0) + if(head->list_mem > H5FL_arr_lst_mem_lim) + if(H5FL__arr_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on array free lists */ - if(H5FL_arr_gc_head.mem_freed>H5FL_arr_glb_mem_lim) - if(H5FL_arr_gc()<0) + if(H5FL_arr_gc_head.mem_freed > H5FL_arr_glb_mem_lim) + if(H5FL__arr_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -1455,8 +1492,8 @@ 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 */ + size_t mem_size; /* Size of memory block being recycled */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1529,7 +1566,7 @@ done: 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) @@ -1567,51 +1604,50 @@ done: 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) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(new_elem); /* Check if we are really allocating the object */ - if(obj==NULL) - ret_value=H5FL_arr_malloc(head,new_elem); + if(obj == NULL) + ret_value = H5FL_arr_malloc(head, new_elem); else { H5FL_arr_list_t *temp; /* Temp. ptr to the new free list node allocated */ /* Sanity check that the number of elements is supported */ - HDassert((int)new_elem<=head->maxelem); + HDassert((int)new_elem <= head->maxelem); /* Get the pointer to the info header in front of the block to free */ - temp=(H5FL_arr_list_t *)((unsigned char *)obj-sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_arr_list_t *)((unsigned char *)obj - sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Check if the size is really changing */ - if(temp->nelem!=new_elem) { + if(temp->nelem != new_elem) { size_t blk_size; /* Size of block */ /* Get the new array of objects */ - ret_value=H5FL_arr_malloc(head,new_elem); + ret_value = H5FL_arr_malloc(head, new_elem); /* Copy the appropriate amount of elements */ - blk_size = head->list_arr[ MIN(temp->nelem, new_elem) ].size; - HDmemcpy(ret_value,obj,blk_size); + blk_size = head->list_arr[MIN(temp->nelem, new_elem)].size; + HDmemcpy(ret_value, obj, blk_size); /* Free the old block */ - H5FL_arr_free(head,obj); + H5FL_arr_free(head, obj); } /* end if */ else - ret_value=obj; + ret_value = obj; } /* end else */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_arr_realloc() */ /*------------------------------------------------------------------------- - * Function: H5FL_arr_gc_list + * Function: H5FL__arr_gc_list * * Purpose: Garbage collect on an array object free list * @@ -1621,29 +1657,29 @@ done: * Programmer: Quincey Koziol * Tuesday, July 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_arr_gc_list(H5FL_arr_head_t *head) +H5FL__arr_gc_list(H5FL_arr_head_t *head) { - H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */ - void *tmp; /* Temporary node pointer */ unsigned u; /* Counter for array of free lists */ - size_t total_mem; /* Total memory used on list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Walk through the array of free lists */ - for(u=0; u<(unsigned)head->maxelem; u++) { - if(head->list_arr[u].onlist>0) { + for(u = 0; u < (unsigned)head->maxelem; u++) { + if(head->list_arr[u].onlist > 0) { + H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */ + size_t total_mem; /* Total memory used on list */ + /* Calculate the total memory used on this list */ - total_mem=head->list_arr[u].onlist*head->list_arr[u].size; + total_mem = head->list_arr[u].onlist * head->list_arr[u].size; /* For each free list being garbage collected, walk through the nodes and free them */ - arr_free_list=head->list_arr[u].list; - while(arr_free_list!=NULL) { + arr_free_list = head->list_arr[u].list; + while(arr_free_list != NULL) { + void *tmp; /* Temporary node pointer */ + tmp = arr_free_list->next; /* Decrement the count of nodes allocated and free the node */ @@ -1658,22 +1694,22 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) head->list_arr[u].onlist = 0; /* Decrement count of free memory on this "array" list */ - head->list_mem-=total_mem; + head->list_mem -= total_mem; /* Decrement global count of free memory on "array" lists */ - H5FL_arr_gc_head.mem_freed-=total_mem; + H5FL_arr_gc_head.mem_freed -= total_mem; } /* end if */ } /* end for */ /* Double check that all the memory on this list is recycled */ - HDassert(head->list_mem==0); + HDassert(head->list_mem == 0); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_arr_gc_list() */ +} /* end H5FL__arr_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_arr_gc + * Function: H5FL__arr_gc * * Purpose: Garbage collect on all the array object free lists * @@ -1683,44 +1719,42 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_arr_gc(void) +H5FL__arr_gc(void) { H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Walk through all the free lists, free()'ing the nodes */ - gc_arr_node=H5FL_arr_gc_head.first; - while(gc_arr_node!=NULL) { + gc_arr_node = H5FL_arr_gc_head.first; + while(gc_arr_node != NULL) { /* Release the free nodes on the list */ - if(H5FL_arr_gc_list(gc_arr_node->list)<0) + if(H5FL__arr_gc_list(gc_arr_node->list) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_arr_node=gc_arr_node->next; + gc_arr_node = gc_arr_node->next; } /* end while */ /* Double check that all the memory on the free lists are recycled */ - HDassert(H5FL_arr_gc_head.mem_freed==0); + HDassert(H5FL_arr_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_arr_gc() */ +} /* end H5FL__arr_gc() */ /*-------------------------------------------------------------------------- NAME - H5FL_arr_term + H5FL__arr_term PURPOSE Terminate various H5FL array object free lists USAGE - int H5FL_arr_term() + int H5FL__arr_term() RETURNS Success: Positive if any action might have caused a change in some other interface; zero otherwise. @@ -1734,26 +1768,27 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5FL_arr_term(void) +H5FL__arr_term(void) { H5FL_gc_arr_node_t *left; /* pointer to garbage collection lists with work left */ - H5FL_gc_arr_node_t *tmp; /* Temporary pointer to a garbage collection node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ - left=NULL; - while(H5FL_arr_gc_head.first!=NULL) { - tmp=H5FL_arr_gc_head.first->next; + left = NULL; + while(H5FL_arr_gc_head.first != NULL) { + H5FL_gc_arr_node_t *tmp; /* Temporary pointer to a garbage collection node */ + + tmp = H5FL_arr_gc_head.first->next; /* 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); +printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ - if(H5FL_arr_gc_head.first->list->allocated>0) { + if(H5FL_arr_gc_head.first->list->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ - H5FL_arr_gc_head.first->next=left; - left=H5FL_arr_gc_head.first; + H5FL_arr_gc_head.first->next = left; + left = H5FL_arr_gc_head.first; } /* end if */ /* No allocations left open for list, get rid of it */ else { @@ -1761,20 +1796,20 @@ printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.fi H5MM_xfree(H5FL_arr_gc_head.first->list->list_arr); /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ - H5FL_arr_gc_head.first->list->init=0; + H5FL_arr_gc_head.first->list->init = 0; /* Free the node from the garbage collection list */ H5MM_free(H5FL_arr_gc_head.first); } /* end else */ - H5FL_arr_gc_head.first=tmp; + H5FL_arr_gc_head.first = tmp; } /* end while */ /* Point to the list of nodes left with allocations open, if any */ - H5FL_arr_gc_head.first=left; + H5FL_arr_gc_head.first = left; - FUNC_LEAVE_NOAPI(H5FL_arr_gc_head.first!=NULL ? 1 : 0) -} /* end H5FL_arr_term() */ + FUNC_LEAVE_NOAPI(H5FL_arr_gc_head.first != NULL ? 1 : 0) +} /* end H5FL__arr_term() */ /*------------------------------------------------------------------------- @@ -1831,18 +1866,17 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) 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) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(elem); /* Use block routine */ - ret_value=H5FL_blk_malloc(&(head->queue),head->size*elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_malloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_malloc() */ @@ -1865,18 +1899,17 @@ done: 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) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(elem); /* Use block routine */ - ret_value=H5FL_blk_calloc(&(head->queue),head->size*elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_calloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_calloc() */ @@ -1899,18 +1932,17 @@ done: 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) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(new_elem); /* Use block routine */ - ret_value=H5FL_blk_realloc(&(head->queue),obj,head->size*new_elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_realloc(&(head->queue), obj, head->size * new_elem H5FL_TRACK_INFO_INT); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_realloc() */ @@ -1936,9 +1968,9 @@ done: 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) @@ -2013,7 +2045,7 @@ done: void * H5FL_fac_free(H5FL_fac_head_t *head, void *obj) { - void *ret_value=NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ /* NOINIT OK here because this must be called after H5FL_fac_init -NAF */ FUNC_ENTER_NOAPI_NOINIT @@ -2028,7 +2060,6 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) /* Free tracking information about the allocation location */ H5CS_close_stack(trk->stack); - trk->stack = H5MM_xfree(trk->stack); trk->file = H5MM_xfree(trk->file); trk->func = H5MM_xfree(trk->func); @@ -2054,26 +2085,26 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) HDassert(head->init); /* Link into the free list */ - ((H5FL_fac_node_t *)obj)->next=head->list; + ((H5FL_fac_node_t *)obj)->next = head->list; /* Point free list at the node freed */ - head->list=(H5FL_fac_node_t *)obj; + head->list = (H5FL_fac_node_t *)obj; /* Increment the number of blocks on free list */ head->onlist++; /* Increment the amount of "factory" freed memory globally */ - H5FL_fac_gc_head.mem_freed+=head->size; + H5FL_fac_gc_head.mem_freed += head->size; /* Check for exceeding free list memory use limits */ /* First check this particular list */ if(head->onlist * head->size > H5FL_fac_lst_mem_lim) - if(H5FL_fac_gc_list(head)<0) + if(H5FL__fac_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on factory free lists */ if(H5FL_fac_gc_head.mem_freed > H5FL_fac_glb_mem_lim) - if(H5FL_fac_gc()<0) + if(H5FL__fac_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -2102,7 +2133,7 @@ done: void * H5FL_fac_malloc(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 @@ -2136,8 +2167,8 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t)); - H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack); + ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); + HDassert(((H5FL_track_t *)ret_value)->stack); ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file); ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func); ((H5FL_track_t *)ret_value)->line = call_line; @@ -2179,7 +2210,7 @@ done: 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 @@ -2198,9 +2229,10 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_fac_calloc() */ + /*------------------------------------------------------------------------- - * Function: H5FL_fac_gc_list + * Function: H5FL__fac_gc_list * * Purpose: Garbage collect on a particular factory free list * @@ -2210,26 +2242,25 @@ done: * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_fac_gc_list(H5FL_fac_head_t *head) +H5FL__fac_gc_list(H5FL_fac_head_t *head) { H5FL_fac_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - void *tmp; /* Temporary node pointer */ size_t total_mem; /* Total memory used on list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Calculate the total memory used on this list */ - total_mem=head->onlist*head->size; + total_mem = head->onlist * head->size; /* For each free list being garbage collected, walk through the nodes and free them */ - free_list=head->list; - while(free_list!=NULL) { - tmp=free_list->next; + free_list = head->list; + while(free_list != NULL) { + void *tmp; /* Temporary node pointer */ + + tmp = free_list->next; /* Decrement the count of nodes allocated and free the node */ head->allocated--; @@ -2240,18 +2271,18 @@ H5FL_fac_gc_list(H5FL_fac_head_t *head) } /* end while */ /* Indicate no free nodes on the free list */ - head->list=NULL; - head->onlist=0; + head->list = NULL; + head->onlist = 0; /* Decrement global count of free memory on "factory" lists */ - H5FL_fac_gc_head.mem_freed-=total_mem; + H5FL_fac_gc_head.mem_freed -= total_mem; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_fac_gc_list() */ +} /* end H5FL__fac_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_fac_gc + * Function: H5FL__fac_gc * * Purpose: Garbage collect on all the factory free lists * @@ -2261,35 +2292,33 @@ H5FL_fac_gc_list(H5FL_fac_head_t *head) * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_fac_gc(void) +H5FL__fac_gc(void) { H5FL_fac_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_NOAPI_NOINIT /* Walk through all the free lists, free()'ing the nodes */ - gc_node=H5FL_fac_gc_head.first; - while(gc_node!=NULL) { + gc_node = H5FL_fac_gc_head.first; + while(gc_node != NULL) { /* Release the free nodes on the list */ - if(H5FL_fac_gc_list(gc_node->list)<0) + if(H5FL__fac_gc_list(gc_node->list) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_node=gc_node->next; + gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists is recycled */ - HDassert(H5FL_fac_gc_head.mem_freed==0); + HDassert(H5FL_fac_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_fac_gc() */ +} /* end H5FL__fac_gc() */ /*------------------------------------------------------------------------- @@ -2323,11 +2352,11 @@ H5FL_fac_term(H5FL_fac_head_t *factory) HDassert(factory); /* Garbage collect all the blocks in the factory's free list */ - if(H5FL_fac_gc_list(factory)<0) + if(H5FL__fac_gc_list(factory) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of factory failed") /* Verify that all the blocks have been freed */ - if(factory->allocated>0) + if(factory->allocated > 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "factory still has objects allocated") /* Unlink block free list for factory from global free list */ @@ -2358,7 +2387,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FL_fac_term_all + * Function: H5FL__fac_term_all * * Purpose: Terminate all block factories * @@ -2368,23 +2397,21 @@ done: * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FL_fac_term_all(void) +H5FL__fac_term_all(void) { - H5FL_fac_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the nodes on the garbage collection list */ while(H5FL_fac_gc_head.first != NULL) { - tmp=H5FL_fac_gc_head.first->next; + H5FL_fac_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + + tmp = H5FL_fac_gc_head.first->next; #ifdef H5FL_DEBUG -printf("H5FL_fac_term: head->size=%d, head->allocated=%d\n", (int)H5FL_fac_gc_head.first->list->size,(int)H5FL_fac_gc_head.first->list->allocated); +printf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* The list cannot have any allocations outstanding */ @@ -2400,7 +2427,7 @@ printf("H5FL_fac_term: head->size=%d, head->allocated=%d\n", (int)H5FL_fac_gc_he } /* end while */ FUNC_LEAVE_NOAPI(0) -} /* end H5FL_fac_term_all() */ +} /* end H5FL__fac_term_all() */ /*------------------------------------------------------------------------- @@ -2426,20 +2453,20 @@ H5FL_garbage_coll(void) FUNC_ENTER_NOAPI(FAIL) /* Garbage collect the free lists for array objects */ - if(H5FL_arr_gc()<0) + if(H5FL__arr_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect array objects") /* Garbage collect free lists for blocks */ - if(H5FL_blk_gc()<0) + if(H5FL__blk_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect block objects") /* Garbage collect the free lists for regular objects */ - if(H5FL_reg_gc()<0) + if(H5FL__reg_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect regular objects") /* Garbage collect the free lists for factory objects */ - if(H5FL_fac_gc()<0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect regular objects") + if(H5FL__fac_gc() < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect factory objects") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2482,82 +2509,28 @@ H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_l int arr_list_lim, int blk_global_lim, int blk_list_lim, int fac_global_lim, int fac_list_lim) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOERR /* Set the limit variables */ /* limit on all regular free lists */ - H5FL_reg_glb_mem_lim=(reg_global_lim==-1 ? UINT_MAX : (size_t)reg_global_lim); + H5FL_reg_glb_mem_lim = (reg_global_lim == -1 ? UINT_MAX : (size_t)reg_global_lim); /* limit on each regular free list */ - H5FL_reg_lst_mem_lim=(reg_list_lim==-1 ? UINT_MAX : (size_t)reg_list_lim); + H5FL_reg_lst_mem_lim = (reg_list_lim == -1 ? UINT_MAX : (size_t)reg_list_lim); /* limit on all array free lists */ - H5FL_arr_glb_mem_lim=(arr_global_lim==-1 ? UINT_MAX : (size_t)arr_global_lim); + H5FL_arr_glb_mem_lim = (arr_global_lim == -1 ? UINT_MAX : (size_t)arr_global_lim); /* limit on each array free list */ - H5FL_arr_lst_mem_lim=(arr_list_lim==-1 ? UINT_MAX : (size_t)arr_list_lim); + H5FL_arr_lst_mem_lim = (arr_list_lim == -1 ? UINT_MAX : (size_t)arr_list_lim); /* limit on all block free lists */ - H5FL_blk_glb_mem_lim=(blk_global_lim==-1 ? UINT_MAX : (size_t)blk_global_lim); + H5FL_blk_glb_mem_lim = (blk_global_lim == -1 ? UINT_MAX : (size_t)blk_global_lim); /* limit on each block free list */ - H5FL_blk_lst_mem_lim=(blk_list_lim==-1 ? UINT_MAX : (size_t)blk_list_lim); + H5FL_blk_lst_mem_lim = (blk_list_lim == -1 ? UINT_MAX : (size_t)blk_list_lim); /* limit on all factory free lists */ - H5FL_fac_glb_mem_lim=(fac_global_lim==-1 ? UINT_MAX : (size_t)fac_global_lim); + H5FL_fac_glb_mem_lim = (fac_global_lim == -1 ? UINT_MAX : (size_t)fac_global_lim); /* limit on each factory free list */ - H5FL_fac_lst_mem_lim=(fac_list_lim==-1 ? UINT_MAX : (size_t)fac_list_lim); + H5FL_fac_lst_mem_lim = (fac_list_lim == -1 ? UINT_MAX : (size_t)fac_list_lim); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_set_free_list_limits() */ - -/*-------------------------------------------------------------------------- - NAME - H5FL_term_interface - PURPOSE - Terminate various H5FL objects - USAGE - void H5FL_term_interface() - RETURNS - Success: Positive if any action might have caused a change in some - other interface; zero otherwise. - Failure: Negative - DESCRIPTION - Release any resources allocated. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Can't report errors... - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -int -H5FL_term_interface(void) -{ - int ret_value=0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Garbage collect any nodes on the free lists */ - (void)H5FL_garbage_coll(); - - ret_value=H5FL_reg_term()+H5FL_fac_term_all()+H5FL_arr_term()+H5FL_blk_term(); - -#ifdef H5FL_TRACK - /* If we haven't freed all the allocated memory, dump out the list now */ - if(ret_value > 0 && H5FL_out_head_g) { - H5FL_track_t *trk = H5FL_out_head_g; - - /* Dump information about all the outstanding allocations */ - while(trk != NULL) { - /* Print information about the outstanding block */ - HDfprintf(stderr,"%s: Outstanding allocation:\n", "H5FL_term_interface"); - HDfprintf(stderr,"\tFile: %s, Function: %s, Line: %d\n", trk->file, trk->func, trk->line); - H5CS_print_stack(trk->stack, stderr); - - /* Advance to next node */ - trk = trk->next; - } /* end while */ - } /* end if */ -#endif /* H5FL_TRACK */ - - FUNC_LEAVE_NOAPI(ret_value) -} - diff --git a/src/H5FLmodule.h b/src/H5FLmodule.h new file mode 100644 index 0000000..cfa585c --- /dev/null +++ b/src/H5FLmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FL package. Including this header means that the source file + * is part of the H5FL package. + */ +#ifndef _H5FLmodule_H +#define _H5FLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FL_MODULE +#define H5_MY_PKG H5FL +#define H5_MY_PKG_ERR H5E_RESOURCE +#define H5_MY_PKG_INIT NO + +#endif /* _H5FLmodule_H */ + @@ -21,7 +21,7 @@ * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Eprivate.h" /* Error handling */ @@ -27,7 +27,8 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ + /***********/ /* Headers */ @@ -38,6 +39,7 @@ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ + /****************/ /* Local Macros */ /****************/ @@ -66,6 +68,9 @@ static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5FS_section_class_t sequence information */ H5FL_SEQ_DEFINE(H5FS_section_class_t); @@ -107,7 +112,7 @@ H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr, const H5FS_create_t *fs_c uint16_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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG @@ -196,7 +201,7 @@ H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, uint16_t nclasses, { 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG @@ -602,7 +607,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes { H5FS_t *fspace = NULL; /* Free space manager */ size_t u; /* Local index variable */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5FScache.c b/src/H5FScache.c index 455a96e..25a16e0 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ + /***********/ /* Headers */ @@ -41,6 +42,7 @@ #include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ + /****************/ /* Local Macros */ /****************/ @@ -210,7 +212,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned nclasses; /* Number of section classes */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -840,8 +842,8 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, size_t old_sect_size; /* Old section size */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum */ - uint32_t computed_chksum; /* Computed metadata checksum */ - void * ret_value; /* Return value */ + uint32_t computed_chksum; /* Computed metadata checksum */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index de66ebd..7303b73 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -28,10 +28,11 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ #define H5HF_DEBUGGING /* Need access to fractal heap debugging routines */ #define H5MF_DEBUGGING /* Need access to file space debugging routines */ + /***********/ /* Headers */ /***********/ @@ -41,6 +42,7 @@ #include "H5HFprivate.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ + /****************/ /* Local Macros */ /****************/ diff --git a/src/H5FSmodule.h b/src/H5FSmodule.h new file mode 100644 index 0000000..b435b79 --- /dev/null +++ b/src/H5FSmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FS package. Including this header means that the source file + * is part of the H5FS package. + */ +#ifndef _H5FSmodule_H +#define _H5FSmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FS_MODULE +#define H5_MY_PKG H5FS +#define H5_MY_PKG_ERR H5E_FSPACE +#define H5_MY_PKG_INIT NO + +#endif /* _H5FSmodule_H */ + diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 2c1eba7..b0df9e6 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -21,7 +21,7 @@ * the H5FS package. Source files outside the H5FS package should * include H5FSprivate.h instead. */ -#ifndef H5FS_PACKAGE +#if !(defined H5FS_FRIEND || defined H5FS_MODULE) #error "Do not include this file outside the H5FS package!" #endif diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 0b47f51..d447160 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ /***********/ @@ -126,8 +126,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 diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 66c5495..390eb9f 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -22,7 +22,8 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ + /***********/ /* Headers */ @@ -31,6 +32,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* Free-space manager */ + /****************/ /* Local Macros */ /****************/ diff --git a/src/H5FStest.c b/src/H5FStest.c index 63ba94c..f96ee75 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -22,9 +22,10 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ #define H5FS_TESTING /*suppress warning about H5FS testing funcs */ + /***********/ /* Headers */ /***********/ @@ -32,6 +33,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* Free-space manager */ + /****************/ /* Local Macros */ /****************/ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 99f83bd..53f51ad 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -30,7 +30,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c index 36f0a93..32c73b0 100644 --- a/src/H5Fcwfs.c +++ b/src/H5Fcwfs.c @@ -35,7 +35,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -260,8 +260,9 @@ herr_t H5F_cwfs_advance_heap(H5F_t *f, H5HG_heap_t *heap, hbool_t add_heap) { unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(f); @@ -281,7 +282,8 @@ H5F_cwfs_advance_heap(H5F_t *f, H5HG_heap_t *heap, hbool_t add_heap) f->shared->cwfs[f->shared->ncwfs - 1] = heap; } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5F_cwfs_advance_heap() */ @@ -302,8 +304,9 @@ herr_t H5F_cwfs_remove_heap(H5F_file_t *shared, H5HG_heap_t *heap) { unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(shared); @@ -318,6 +321,7 @@ H5F_cwfs_remove_heap(H5F_file_t *shared, H5HG_heap_t *heap) } /* end if */ } /* end for */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5F_cwfs_remove_heap() */ diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 93da900..11accc6 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -19,8 +19,8 @@ * Purpose: File object debugging functions. */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 7e2ea17..d16e2d4 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F__init_deprec_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -82,51 +79,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5F__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5F__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5F__term_deprec_interface -- Terminate interface -USAGE - herr_t H5F__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5F__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5F__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 9916002..5e3deb1 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -26,7 +26,7 @@ *------------------------------------------------------------------------- */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ @@ -92,7 +92,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -162,8 +162,7 @@ H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if(!efc) { - if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, - dxpl_id))) + if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") /* Increment the number of open objects to prevent the file from being @@ -235,8 +234,7 @@ H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, } /* end if */ else { /* Cannot cache file, just open file and return */ - if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, - dxpl_id))) + if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") /* Increment the number of open objects to prevent the file from @@ -257,8 +255,7 @@ H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Open the file */ - if(NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id, - dxpl_id))) + if(NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") open_file = TRUE; diff --git a/src/H5Ffake.c b/src/H5Ffake.c index af048bc..e191003 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -13,10 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_fake_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ @@ -27,28 +24,6 @@ /* PRIVATE PROTOTYPES */ -/*-------------------------------------------------------------------------- -NAME - H5F_init_fake_interface -- Initialize interface-specific information -USAGE - herr_t H5F_init_fake_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F_init_fake_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F_init_fake_interface() */ - - /*------------------------------------------------------------------------- * Function: H5F_fake_alloc * @@ -70,7 +45,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Fint.c b/src/H5Fint.c index 0e77349..2412559 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -103,30 +100,6 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- - * Function: H5F_init_interface - * - * Purpose: Initialize interface-specific information. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5F_init_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_init_interface() */ - - -/*------------------------------------------------------------------------- * Function: H5F_get_access_plist * * Purpose: Returns a copy of the file access property list of the @@ -154,9 +127,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) { H5P_genplist_t *new_plist; /* New property list */ H5P_genplist_t *old_plist; /* Old property list */ - void *driver_info=NULL; - unsigned efc_size = 0; - hid_t ret_value = SUCCEED; + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ + unsigned efc_size = 0; + hid_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -199,32 +173,26 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) 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") - /* - * 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") - - /* 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") - 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") + /* Prepare the driver property */ + driver_prop.driver_id = f->shared->lf->driver_id; + driver_prop.driver_info = H5FD_fapl_get(f->shared->lf); + driver_prop_copied = TRUE; - /* 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") + /* Set the driver property */ + if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID & info") /* 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) { + 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") - } else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) { + 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") - } done: + /* Release the copy of the driver info, if it was set up */ + if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_access_plist() */ @@ -533,7 +501,7 @@ 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -581,7 +549,7 @@ done: 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, *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -955,7 +923,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_class_t *drvr; /*file driver class info */ H5P_genplist_t *a_plist; /*file access property list */ H5F_close_degree_t fc_degree; /*file close degree */ - H5F_t *ret_value; /*actual return value */ + H5F_t *ret_value = NULL; /*actual return value */ FUNC_ENTER_NOAPI(NULL) @@ -1454,7 +1422,7 @@ done: 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 @@ -1978,7 +1946,7 @@ 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 */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Fio.c b/src/H5Fio.c index 763bd69..04c4055 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h new file mode 100644 index 0000000..4bb2506 --- /dev/null +++ b/src/H5Fmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5F package. Including this header means that the source file + * is part of the H5F package. + */ +#ifndef _H5Fmodule_H +#define _H5Fmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5F_MODULE +#define H5_MY_PKG H5F +#define H5_MY_PKG_ERR H5E_FILE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Fmodule_H */ + diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 643eba5..99fa4f2 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -13,10 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_mount_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ @@ -36,28 +33,6 @@ static herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id); static void H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); -/*-------------------------------------------------------------------------- -NAME - H5F_init_mount_interface -- Initialize interface-specific information -USAGE - herr_t H5F_init_mount_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F_init_mount_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F_init_mount_interface() */ - - /*------------------------------------------------------------------------- * Function: H5F_close_mounts * @@ -439,7 +414,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 diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 39b8dfa..fe2a774 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 175fa88..2255085 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -21,7 +21,7 @@ * the H5F package. Source files outside the H5F package should * include H5Fprivate.h instead. */ -#ifndef H5F_PACKAGE +#if !(defined H5F_FRIEND || defined H5F_MODULE) #error "Do not include this file outside the H5F package!" #endif @@ -333,8 +333,6 @@ H5_DLLVAR const H5AC_class_t H5AC_DRVRINFO[1]; /******************************/ /* General routines */ -H5_DLL herr_t H5F_init(void); -H5_DLL herr_t H5F__term_deprec_interface(void); H5F_t *H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); herr_t H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 36d7429..658d123 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -270,7 +270,7 @@ ((O1) >= (O2) && (O1) < ((O2) + (L2)))) /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5F_PACKAGE +#ifdef H5F_MODULE #define H5F_INTENT(F) ((F)->shared->flags) #define H5F_OPEN_NAME(F) ((F)->open_name) #define H5F_ACTUAL_NAME(F) ((F)->actual_name) @@ -312,7 +312,7 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL) #define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR))) -#else /* H5F_PACKAGE */ +#else /* H5F_MODULE */ #define H5F_INTENT(F) (H5F_get_intent(F)) #define H5F_OPEN_NAME(F) (H5F_get_open_name(F)) #define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F)) @@ -354,7 +354,7 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC))) #define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F)) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR))) -#endif /* H5F_PACKAGE */ +#endif /* H5F_MODULE */ /* Macros to encode/decode offset/length's for storing in the file */ @@ -442,8 +442,7 @@ #define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size" /* Maximum sieve buffer size (when data sieving is allowed by file driver) */ #define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ #define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ -#define H5F_ACS_FILE_DRV_ID_NAME "driver_id" /* File driver ID */ -#define H5F_ACS_FILE_DRV_INFO_NAME "driver_info" /* File driver info */ +#define H5F_ACS_FILE_DRV_NAME "driver-id/info" /* File driver ID & info */ #define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ @@ -667,9 +666,6 @@ H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t **pp, haddr_t addr); H5_DLL void H5F_addr_decode(const H5F_t *f, const uint8_t **pp, haddr_t *addr_p); H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *addr_p); -/* File access property list callbacks */ -H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); - /* Shared file list related routines */ H5_DLL void H5F_sfile_assert_num(unsigned n); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 6290614..05667ac 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -968,7 +968,7 @@ done: 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) diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index a1c6976..4fb9cd9 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index d353d4f..50f6b06 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_super_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -77,28 +74,6 @@ H5FL_DEFINE(H5F_super_t); -/*-------------------------------------------------------------------------- -NAME - H5F_init_super_interface -- Initialize interface-specific information -USAGE - herr_t H5F_init_super_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F_init_super_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F_init_super_interface() */ - - /*------------------------------------------------------------------------- * Function: H5F_super_ext_create * diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 477f58f..c2c7bc9 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /***********/ @@ -199,7 +199,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, unsigned super_vers; /* Superblock version */ uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */ uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */ - H5F_super_t *ret_value; /* Return value */ + H5F_super_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -824,7 +824,7 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ char drv_name[9]; /* Name of driver */ unsigned drv_vers; /* Version of driver info block */ - H5O_drvinfo_t *ret_value; /* Return value */ + H5O_drvinfo_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 73b00a6..b741e0d 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -28,12 +28,12 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ #define H5F_TESTING /*suppress warning about H5F testing funcs*/ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ -#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING /*suppress warning about H5G testing funcs*/ +#define H5SM_FRIEND /*suppress error about including H5SMpkg */ +#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ /***********/ @@ -79,10 +79,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G_init_interface +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -120,6 +117,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -138,36 +138,13 @@ static const H5I_class_t H5I_GROUP_CLS[1] = {{ (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5G_top_package_initialize_s = FALSE; - -/*------------------------------------------------------------------------- - * Function: H5G__init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, November 11, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__init() */ /*------------------------------------------------------------------------- - * Function: H5G_init_interface + * Function: H5G__init_package * * Purpose: Initializes the H5G interface. * @@ -177,7 +154,7 @@ done: * Monday, January 5, 1998 * * Notes: The group creation properties are registered in the property - * list interface initialization routine (H5P_init_interface) + * list interface initialization routine (H5P_init_package) * so that the file creation property class can inherit from it * correctly. (Which allows the file creation property list to * control the group creation properties of the root group of @@ -185,64 +162,100 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5G_init_interface(void) +herr_t +H5G__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize the atom group for the group IDs */ if(H5I_register_type(H5I_GROUP_CLS) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Mark "top" of interface as initialized, too */ + H5G_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_init_interface() */ +} /* end H5G__init_package() */ /*------------------------------------------------------------------------- - * Function: H5G_term_interface + * Function: H5G_top_term_package * - * Purpose: Terminates the H5G interface + * Purpose: Close the "top" of the interface, releasing IDs, etc. * * Return: Success: Positive if anything is done that might * affect other interfaces; zero otherwise. - * * Failure: Negative. * - * Programmer: Robb Matzke - * Monday, January 5, 1998 + * Programmer: Quincey Koziol + * Sunday, September 13, 2015 * *------------------------------------------------------------------------- */ int -H5G_term_interface(void) +H5G_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5G_top_package_initialize_s) { if(H5I_nmembers(H5I_GROUP) > 0) { (void)H5I_clear_type(H5I_GROUP, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close deprecated interface */ - n += H5G__term_deprec_interface(); - /* Destroy the group object id group */ - (void)H5I_dec_type_ref(H5I_GROUP); - n++; /*H5I*/ + /* Mark closed */ + if(0 == n) + H5G_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5G_top_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_term_package + * + * Purpose: Terminates the H5G interface + * + * Note: Finishes shutting down the interface, after + * H5G_top_term_package() is called + * + * Return: Success: Positive if anything is done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. + * + * Programmer: Robb Matzke + * Monday, January 5, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5G_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_GROUP)); + HDassert(FALSE == H5G_top_package_initialize_s); + + /* Destroy the group object id group */ + n += (H5I_dec_type_ref(H5I_GROUP) > 0); - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5G_term_interface() */ +} /* end H5G_term_package() */ /*------------------------------------------------------------------------- diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 31db886..104e6b3 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -232,7 +232,7 @@ H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -420,7 +420,7 @@ H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Gcache.c b/src/H5Gcache.c index f765b41..e7d44b5 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -178,7 +178,7 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, H5F_t *f = (H5F_t *)_udata; /* User data for callback */ H5G_node_t *sym = NULL; /* Symbol table node created */ const uint8_t *image = (const uint8_t *)_image; /* Pointer to image to deserialize */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 89e79cc..41ca4f5 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -23,7 +23,7 @@ * *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /* Packages needed by this file... */ @@ -224,8 +224,8 @@ 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 @@ -411,7 +411,7 @@ H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *li H5G_lib_iterate_t op, void *op_data) { H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -503,7 +503,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, { H5G_iter_lkp_t udata; /* User data for iteration callback */ H5O_mesg_operator_t op; /* Message operator */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -598,7 +598,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t * hsize_t idx) { H5G_link_table_t ltable = {0, NULL}; /* Link table */ - H5G_obj_t ret_value; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 285355f..ab0547b 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -29,7 +29,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ /* Headers */ @@ -540,7 +540,7 @@ H5G__dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -991,7 +991,7 @@ H5G__dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, 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 @@ -1197,7 +1197,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, 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 @@ -1836,8 +1836,8 @@ 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 4e3572e..e0bc78e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G__init_deprec_interface +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -106,51 +103,6 @@ static H5G_obj_t H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5G__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5G__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5G__init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5G__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5G__init()) -} /* H5G__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5G__term_deprec_interface -- Terminate interface -USAGE - herr_t H5G__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5G__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5G__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- @@ -168,7 +120,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 @@ -1164,7 +1116,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - H5G_obj_t ret_value; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oloc->addr, H5G_UNKNOWN) diff --git a/src/H5Gent.c b/src/H5Gent.c index 3809933..8df8414 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -22,7 +22,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ diff --git a/src/H5Gint.c b/src/H5Gint.c index 04b21a5..ea8288c 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G_init_int_interface +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -119,34 +116,6 @@ H5FL_DEFINE(H5_obj_t); -/*-------------------------------------------------------------------------- -NAME - H5G_init_int_interface -- Initialize interface-specific information -USAGE - herr_t H5G_init_int_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5G__init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5G_init_int_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Funnel all work to H5G__init() */ - if(H5G__init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "interface initialization failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_init_int_interface() */ - - /*------------------------------------------------------------------------- * Function: H5G__create_named * @@ -167,7 +136,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_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 */ + H5G_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -225,7 +194,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 @@ -302,7 +271,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, 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 @@ -363,7 +332,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -814,7 +783,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, 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 */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1084,7 +1053,7 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, 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 */ + 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 8b258b5..5a195c8 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -159,7 +159,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 @@ -194,7 +194,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 diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 677cc25..eb8cd78 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -649,7 +649,7 @@ 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -913,7 +913,7 @@ 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 */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h new file mode 100644 index 0000000..52ac067 --- /dev/null +++ b/src/H5Gmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5G package. Including this header means that the source file + * is part of the H5G package. + */ +#ifndef _H5Gmodule_H +#define _H5Gmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5G_MODULE +#define H5_MY_PKG H5G +#define H5_MY_PKG_ERR H5E_SYM +#define H5_MY_PKG_INIT YES + +#endif /* _H5Gmodule_H */ + diff --git a/src/H5Gname.c b/src/H5Gname.c index bbeddb6..aff9d31 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -166,7 +166,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -297,7 +297,7 @@ H5G_build_fullpath(const char *prefix, const char *name) 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 */ + H5RS_str_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -354,7 +354,7 @@ 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; + H5RS_str_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -565,7 +565,7 @@ 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 ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1292,7 +1292,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * 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 */ + ssize_t ret_value = -1; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index cbb9a8e..e25a17e 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -31,7 +31,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -404,7 +404,7 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; const char *s1, *s2; const char *base; /* Base of heap */ - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Gobj.c b/src/H5Gobj.c index c1f05b7..f7782a6 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -156,7 +156,7 @@ H5G__obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") /* Get the pipeline property */ - if(H5P_get(gc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(gc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") /* Call the "real" group creation routine now */ @@ -320,8 +320,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_TAG(dxpl_id, grp_oloc->addr, FAIL) @@ -666,7 +666,7 @@ H5G__obj_iterate(const H5O_loc_t *grp_oloc, { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) @@ -813,7 +813,7 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oloc->addr, FAIL) diff --git a/src/H5Goh.c b/src/H5Goh.c index 1a0f112..c516713 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -107,7 +107,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 @@ -177,7 +177,7 @@ 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 ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -213,7 +213,7 @@ 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 */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -254,7 +254,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -302,7 +302,7 @@ static H5O_loc_t * H5O_group_get_oloc(hid_t obj_id) { H5G_t *grp; /* Group opened */ - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 7346b41..1457e62 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -21,7 +21,7 @@ * only within the H5G package. Source files outside the * H5G package should include H5Gprivate.h instead. */ -#ifndef H5G_PACKAGE +#if !(defined H5G_FRIEND || defined H5G_MODULE) #error "Do not include this file outside the H5G package!" #endif @@ -351,8 +351,6 @@ H5_DLL herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, /* * Utility functions */ -H5_DLL herr_t H5G__init(void); -H5_DLL herr_t H5G__term_deprec_interface(void); H5_DLL const char *H5G__component(const char *name, size_t *size_p); /* diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 130c742..baf4209 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -101,11 +101,11 @@ } /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5G_PACKAGE +#ifdef H5G_MODULE #define H5G_MOUNTED(G) ((G)->shared->mounted) -#else /* H5G_PACKAGE */ +#else /* H5G_MODULE */ #define H5G_MOUNTED(G) (H5G_mounted(G)) -#endif /* H5G_PACKAGE */ +#endif /* H5G_MODULE */ /* * During name lookups (see H5G_traverse()) we sometimes want information about diff --git a/src/H5Groot.c b/src/H5Groot.c index 5ec9d3a..ba25f31 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 08188ae..7f4b8df 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -22,7 +22,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -533,7 +533,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, 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 */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, oloc->addr, FAIL) @@ -751,7 +751,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)); @@ -874,7 +874,7 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1191,7 +1191,7 @@ 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 */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, oloc->addr, H5G_UNKNOWN) diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 1c0adea..a8796fb 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ #define H5G_TESTING /*suppress warning about H5G testing funcs*/ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 1c654bb..5121f45 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -33,7 +33,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -68,6 +69,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -153,7 +157,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -220,7 +224,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index cb1ec77..2f3d0e4 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -196,7 +196,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -762,7 +762,7 @@ H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1; const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -985,7 +985,7 @@ H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1; const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5HFcache.c b/src/H5HFcache.c index ec8d9a6..4f3dfc3 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -401,7 +401,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ uint8_t heap_flags; /* Status flags for heap */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -905,7 +905,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1590,7 +1590,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, H5HF_direct_t *dblock = NULL; /* Direct block info */ const uint8_t *image; /* Pointer into raw data buffer */ haddr_t heap_addr; /* Address of heap header in the file */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1924,7 +1924,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_direct_t *dblock = (H5HF_direct_t *)_thing; /* Direct block info */ H5HF_indirect_t *par_iblock; /* Parent indirect block */ - unsigned par_entry; /* Entry in parent indirect block */ + unsigned par_entry = 0; /* Entry in parent indirect block */ void *write_buf; /* Pointer to buffer to write out */ size_t write_size; /* Size of buffer to write out */ uint8_t *image; /* Pointer into raw data buffer */ @@ -2224,6 +2224,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, else { /* the direct block's parent is an indirect block */ /* Sanity check */ HDassert(par_iblock); + HDassert(par_iblock->ents); HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); /* Allocate 'normal' space for the direct block */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 736b98d..40191e5 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ #define H5HF_DEBUGGING /* Need access to fractal heap debugging routines */ /***********/ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 5dd5b0c..9461fc0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -447,7 +448,7 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, { 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index c523396..3ceb6f5 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -240,7 +241,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 @@ -274,7 +275,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 @@ -310,7 +311,7 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, 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 */ + hsize_t acc_span_size = 0; /* Accumulated span size */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 340940f..6560756 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -110,7 +111,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -342,7 +343,7 @@ 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 */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -533,7 +534,7 @@ H5HF_hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) { 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_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 04cd425..888af48 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -261,7 +261,7 @@ 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 ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 547aaf0..29f4662 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -1171,7 +1172,7 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, 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 diff --git a/src/H5HFiter.c b/src/H5HFiter.c index 262a9ee..55a8532 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ diff --git a/src/H5HFman.c b/src/H5HFman.c index cfbcd87..cff4395 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ diff --git a/src/H5HFmodule.h b/src/H5HFmodule.h new file mode 100644 index 0000000..e3274ce --- /dev/null +++ b/src/H5HFmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5HF package. Including this header means that the source file + * is part of the H5HF package. + */ +#ifndef _H5HFmodule_H +#define _H5HFmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5HF_MODULE +#define H5_MY_PKG H5HF +#define H5_MY_PKG_ERR H5E_HEAP +#define H5_MY_PKG_INIT NO + +#endif /* _H5HFmodule_H */ + diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 685c83a..7a6794e 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -21,7 +21,7 @@ * the H5HF package. Source files outside the H5HF package should * include H5HFprivate.h instead. */ -#ifndef H5HF_PACKAGE +#if !(defined H5HF_FRIEND || defined H5HF_MODULE) #error "Do not include this file outside the H5HF package!" #endif diff --git a/src/H5HFsection.c b/src/H5HFsection.c index c997119..070bc3e 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -25,7 +25,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -407,8 +408,8 @@ 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 @@ -489,7 +490,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -866,7 +867,7 @@ H5HF_sect_single_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags) { H5HF_free_section_t *new_sect; /* New section */ - H5FS_section_info_t *ret_value; /* Return value */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1261,7 +1262,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1513,7 +1514,7 @@ done: H5HF_indirect_t * H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) { - H5HF_indirect_t *ret_value; /* Return value */ + H5HF_indirect_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1675,7 +1676,7 @@ H5HF_sect_row_deserialize(const H5FS_section_class_t *cls, hid_t dxpl_id, unsigned *des_flags) { H5HF_hdr_t *hdr; /* Fractal heap header */ - H5FS_section_info_t *ret_value; /* Return value */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2102,7 +2103,7 @@ H5HF_sect_row_debug(const H5FS_section_info_t *_sect, static hsize_t H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) { - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2133,7 +2134,7 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) static H5HF_free_section_t * H5HF_sect_indirect_top(H5HF_free_section_t *sect) { - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2242,7 +2243,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2313,7 +2314,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -3945,7 +3946,7 @@ H5HF_sect_indirect_deserialize(H5HF_hdr_t *hdr, hid_t dxpl_id, 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 */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 7fb0dd4..20057e4 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -216,7 +217,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 diff --git a/src/H5HFstat.c b/src/H5HFstat.c index b0e1987..303b1f4 100644 --- a/src/H5HFstat.c +++ b/src/H5HFstat.c @@ -24,7 +24,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index c2e9cb0..4ec7149 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -24,9 +24,10 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ #define H5HF_TESTING /*suppress warning about H5HF testing funcs*/ + /***********/ /* Headers */ /***********/ @@ -244,7 +245,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 @@ -275,7 +276,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 @@ -306,7 +307,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 @@ -341,7 +342,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 @@ -374,7 +375,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 @@ -406,7 +407,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 27ab443..8c321bc 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /* suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -41,7 +41,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ @@ -91,6 +91,9 @@ static haddr_t H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5HG_heap_t struct */ H5FL_DEFINE(H5HG_heap_t); @@ -249,7 +252,7 @@ H5HG_heap_t * H5HG_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) { H5HG_heap_t *heap; /* Global heap */ - H5HG_heap_t *ret_value; /* Return value */ + H5HG_heap_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -299,7 +302,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) size_t idx; uint8_t *p; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -612,7 +615,7 @@ H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/, size_t size; /* Size of the heap object */ uint8_t *p; /* Pointer to object in heap buffer */ void *orig_object = object; /* Keep a copy of the original object pointer */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__GLOBALHEAP_TAG, NULL) @@ -684,7 +687,7 @@ H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) { H5HG_heap_t *heap = NULL; unsigned heap_flags = H5AC__NO_FLAGS_SET; - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__GLOBALHEAP_TAG, FAIL) diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 5c6bee1..c1eb8d9 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ @@ -161,7 +161,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, H5F_t *f = (H5F_t *)_udata; /* File pointer -- obtained from user data */ H5HG_heap_t *heap = NULL; /* New global heap */ uint8_t *image; /* Pointer to image to decode */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index c79aac8..6013de5 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ diff --git a/src/H5HGmodule.h b/src/H5HGmodule.h new file mode 100644 index 0000000..aa34f29 --- /dev/null +++ b/src/H5HGmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5HG package. Including this header means that the source file + * is part of the H5HG package. + */ +#ifndef _H5HGmodule_H +#define _H5HGmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5HG_MODULE +#define H5_MY_PKG H5HG +#define H5_MY_PKG_ERR H5E_HEAP +#define H5_MY_PKG_INIT NO + +#endif /* _H5HGmodule_H */ + diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 9137e7b..ffbf7c6 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -21,7 +21,7 @@ * only within the H5HG package. Source files outside the * H5HG package should include H5HGprivate.h instead. */ -#ifndef H5HG_PACKAGE +#if !(defined H5HG_FRIEND || defined H5HG_MODULE) #error "Do not include this file outside the H5HG package!" #endif diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index ad0da76..0c0aa69 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -44,15 +44,15 @@ typedef struct H5HG_heap_t H5HG_heap_t; #define H5HG_MAXSIZE 65536 /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5HG_PACKAGE +#ifdef H5HG_MODULE #define H5HG_ADDR(H) ((H)->addr) #define H5HG_SIZE(H) ((H)->size) #define H5HG_FREE_SIZE(H) ((H)->obj[0].size) -#else /* H5HG_PACKAGE */ +#else /* H5HG_MODULE */ #define H5HG_ADDR(H) (H5HG_get_addr(H)) #define H5HG_SIZE(H) (H5HG_get_size(H)) #define H5HG_FREE_SIZE(H) (H5HG_get_free_size(H)) -#endif /* H5HG_PACKAGE */ +#endif /* H5HG_MODULE */ /* Main global heap routines */ diff --git a/src/H5HGquery.c b/src/H5HGquery.c index a1b3777..d07edcc 100644 --- a/src/H5HGquery.c +++ b/src/H5HGquery.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ @@ -29,7 +29,7 @@ /* Module Setup */ /****************/ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ /***********/ @@ -71,6 +71,9 @@ static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5HL_free_t struct */ H5FL_DEFINE(H5HL_free_t); @@ -115,7 +118,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) { H5HL_t *heap = NULL; /* Heap created */ H5HL_prfx_t *prfx = NULL; /* Heap prefix */ - hsize_t total_size; /* Total heap size on disk */ + hsize_t total_size = 0; /* Total heap size on disk */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -446,10 +449,10 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ H5HL_dblk_t *dblk = NULL; /* Local heap data block */ - H5HL_t *heap; /* Heap data structure */ + H5HL_t *heap = NULL; /* Heap data structure */ unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */ unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */ - H5HL_t *ret_value; /* Return value */ + H5HL_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -511,11 +514,11 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) done: /* Release the prefix from the cache, now pinned */ - if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) + if(prfx && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix") /* Release the data block from the cache, now pinned */ - if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) + if(dblk && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block") FUNC_LEAVE_NOAPI(ret_value) @@ -700,7 +703,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * size_t offset = 0; size_t need_size; hbool_t found; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(UFAIL) @@ -1062,7 +1065,7 @@ done: herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) { - H5HL_t *heap; /* Local heap to delete */ + H5HL_t *heap = NULL; /* Local heap to delete */ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ H5HL_dblk_t *dblk = NULL; /* Local heap data block */ @@ -1114,11 +1117,11 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) done: /* Release the data block from the cache, now deleted */ - if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) + if(dblk && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block") /* Release the prefix from the cache, now deleted */ - if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) + if(prfx && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 2054e34..42fe1c7 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ /***********/ @@ -311,7 +311,7 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into decoding buffer */ H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -682,7 +682,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, { H5HL_dblk_t *dblk = NULL; /* Local heap data block deserialized */ H5HL_cache_dblk_ud_t *udata = (H5HL_cache_dblk_ud_t *)_udata; /* User data for callback */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index edddd65..3620511 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -18,7 +18,8 @@ * * Purpose: Local Heap object debugging functions. */ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ + +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5HLint.c b/src/H5HLint.c index d5238eb..bbf579d 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ /***********/ @@ -102,7 +102,7 @@ H5HL_t * H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) { H5HL_t *heap = NULL; /* New local heap */ - H5HL_t *ret_value; /* Return value */ + H5HL_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -129,7 +129,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HL_inc_rc + * Function: H5HL__inc_rc * * Purpose: Increment ref. count on heap * @@ -143,9 +143,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_inc_rc(H5HL_t *heap) +H5HL__inc_rc(H5HL_t *heap) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check arguments */ HDassert(heap); @@ -154,11 +154,11 @@ H5HL_inc_rc(H5HL_t *heap) heap->rc++; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HL_inc_rc() */ +} /* end H5HL__inc_rc() */ /*------------------------------------------------------------------------- - * Function: H5HL_dec_rc + * Function: H5HL__dec_rc * * Purpose: Decrement ref. count on heap * @@ -172,9 +172,9 @@ H5HL_inc_rc(H5HL_t *heap) *------------------------------------------------------------------------- */ static herr_t -H5HL_dec_rc(H5HL_t *heap) +H5HL__dec_rc(H5HL_t *heap) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check arguments */ HDassert(heap); @@ -187,7 +187,7 @@ H5HL_dec_rc(H5HL_t *heap) H5HL_dest(heap); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HL_dec_rc() */ +} /* end H5HL__dec_rc() */ /*------------------------------------------------------------------------- @@ -250,7 +250,7 @@ H5HL_prfx_t * H5HL_prfx_new(H5HL_t *heap) { H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ - H5HL_prfx_t *ret_value; /* Return value */ + H5HL_prfx_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -262,7 +262,7 @@ H5HL_prfx_new(H5HL_t *heap) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Increment ref. count on heap data structure */ - if(H5HL_inc_rc(heap) < 0) + if(H5HL__inc_rc(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") /* Link the heap & the prefix */ @@ -307,7 +307,7 @@ H5HL_prfx_dest(H5HL_prfx_t *prfx) prfx->heap->prfx = NULL; /* Decrement ref. count on heap data structure */ - if(H5HL_dec_rc(prfx->heap) < 0) + if(H5HL__dec_rc(prfx->heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") /* Unlink heap from prefix */ @@ -340,7 +340,7 @@ H5HL_dblk_t * H5HL_dblk_new(H5HL_t *heap) { H5HL_dblk_t *dblk = NULL; /* New local heap data block */ - H5HL_dblk_t *ret_value; /* Return value */ + H5HL_dblk_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -352,7 +352,7 @@ H5HL_dblk_new(H5HL_t *heap) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Increment ref. count on heap data structure */ - if(H5HL_inc_rc(heap) < 0) + if(H5HL__inc_rc(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") /* Link the heap & the data block */ @@ -401,7 +401,7 @@ H5HL_dblk_dest(H5HL_dblk_t *dblk) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix") /* Decrement ref. count on heap data structure */ - if(H5HL_dec_rc(dblk->heap) < 0) + if(H5HL__dec_rc(dblk->heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") /* Unlink heap from data block */ diff --git a/src/H5HLmodule.h b/src/H5HLmodule.h new file mode 100644 index 0000000..b38c077 --- /dev/null +++ b/src/H5HLmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5HL package. Including this header means that the source file + * is part of the H5HL package. + */ +#ifndef _H5HLmodule_H +#define _H5HLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5HL_MODULE +#define H5_MY_PKG H5HL +#define H5_MY_PKG_ERR H5E_HEAP +#define H5_MY_PKG_INIT NO + +#endif /* _H5HLmodule_H */ + diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 75c9959..6e35add 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -21,7 +21,7 @@ * only within the H5HL package. Source files outside the * H5HL package should include H5HLprivate.h instead. */ -#ifndef H5HL_PACKAGE +#if !(defined H5HL_FRIEND || defined H5HL_MODULE) #error "Do not include this file outside the H5HL package!" #endif @@ -35,10 +35,7 @@ * 5/18/04 - Expanded to allow registration of new types at run-time */ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5I_init_interface +#include "H5Imodule.h" /* This source code file is part of the H5I module */ #include "H5private.h" /* Generic Functions */ @@ -55,7 +52,7 @@ #ifndef H5I_DEBUG_OUTPUT #include "H5Gprivate.h" /* Groups */ #else /* H5I_DEBUG_OUTPUT */ -#define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #include "H5Gpkg.h" /* Groups */ #include "H5Dprivate.h" /* Datasets */ #include "H5Tprivate.h" /* Datatypes */ @@ -106,6 +103,9 @@ typedef struct { hbool_t app_ref; /* Whether this is an appl. ref. call */ } H5I_clear_type_ud_t; +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*-------------------- Locally scoped variables -----------------------------*/ /* Array of pointers to atomic types */ @@ -141,29 +141,8 @@ static herr_t H5I__debug(H5I_type_t type); #endif /* H5I_DEBUG_OUTPUT */ -/*-------------------------------------------------------------------------- -NAME - H5I_init_interface -- Initialize interface-specific information -USAGE - herr_t H5I_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. - ---------------------------------------------------------------------------*/ -static herr_t -H5I_init_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5I_init_interface() */ - - /*------------------------------------------------------------------------- - * Function: H5I_term_interface + * Function: H5I_term_package * * Purpose: Terminate the H5I interface: release all memory, reset all * global variables to initial values. This only happens if all @@ -179,20 +158,20 @@ H5I_init_interface(void) *------------------------------------------------------------------------- */ int -H5I_term_interface(void) +H5I_term_package(void) { - H5I_id_type_t *type_ptr; - H5I_type_t type; - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { + H5I_id_type_t *type_ptr; /* Pointer to ID type */ + H5I_type_t type; /* Type of ID */ + /* How many types are still being used? */ - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) { + for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; - } /* end for */ /* If no types are used then clean up */ if(0 == n) { @@ -202,16 +181,18 @@ H5I_term_interface(void) HDassert(NULL == type_ptr->ids); type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; + n++; } /* end if */ } /* end for */ - } /* end if */ - /* Mark interface closed */ - H5_interface_initialize_g = 0; + /* Mark interface closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5I_term_interface() */ +} /* end H5I_term_package() */ /*------------------------------------------------------------------------- @@ -238,9 +219,9 @@ H5I_term_interface(void) 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); @@ -290,10 +271,9 @@ 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() */ @@ -467,8 +447,8 @@ done: int64_t H5I_nmembers(H5I_type_t type) { - H5I_id_type_t *type_ptr = NULL; - int64_t ret_value; + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + int64_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -504,7 +484,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); @@ -625,7 +605,6 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__clear_type_cb() */ @@ -649,7 +628,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) 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); @@ -731,7 +710,7 @@ done: 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); @@ -826,8 +805,8 @@ done: 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) @@ -866,7 +845,7 @@ H5I_object(hid_t id) H5I_id_info_t *id_ptr; /*ptr to the new atom */ void *ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR /* General lookup of the ID */ if(NULL != (id_ptr = H5I__find_id(id))) { @@ -875,7 +854,6 @@ H5I_object(hid_t id) ret_value = (void *)id_ptr->obj_ptr; } /* end if */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end if */ @@ -900,7 +878,7 @@ done: 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); @@ -939,7 +917,7 @@ 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 */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR HDassert(id_type >= 1 && id_type < H5I_next_type); @@ -950,7 +928,6 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) ret_value = (void *)id_ptr->obj_ptr; } /* end if */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ @@ -974,16 +951,15 @@ done: 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) + FUNC_ENTER_NOAPI_NOERR if(id > 0) ret_value = H5I_TYPE(id); HDassert(ret_value >= H5I_BADID && ret_value < H5I_next_type); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type() */ @@ -1006,7 +982,7 @@ done: H5I_type_t H5Iget_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE1("It", "i", id); @@ -1041,7 +1017,7 @@ done: 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); @@ -1108,8 +1084,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 @@ -1149,9 +1125,9 @@ done: 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) @@ -1190,7 +1166,7 @@ done: int H5Idec_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("Is", "i", id); @@ -1228,8 +1204,8 @@ done: 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) @@ -1298,8 +1274,8 @@ 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) @@ -1346,7 +1322,7 @@ done: 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) @@ -1424,8 +1400,8 @@ done: 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) @@ -1499,8 +1475,8 @@ done: 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) @@ -1574,8 +1550,8 @@ done: 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 @@ -1658,8 +1634,8 @@ done: 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 = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1747,7 +1723,7 @@ 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 */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1825,7 +1801,7 @@ static int H5I__search_cb(void *obj, hid_t id, void *_udata) { H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */ - int ret_value; /* Callback return value */ + int ret_value = -1; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -2013,7 +1989,7 @@ 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_id_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -2130,7 +2106,7 @@ 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 */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Imodule.h b/src/H5Imodule.h new file mode 100644 index 0000000..19cc9a4 --- /dev/null +++ b/src/H5Imodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5I package. Including this header means that the source file + * is part of the H5I package. + */ +#ifndef _H5Imodule_H +#define _H5Imodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5I_MODULE +#define H5_MY_PKG H5I +#define H5_MY_PKG_ERR H5E_ATOM +#define H5_MY_PKG_INIT NO + +#endif /* _H5Imodule_H */ + diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 1666b76..0a6ae8c 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -21,7 +21,7 @@ * the H5I package. Source files outside the H5I package should * include H5Iprivate.h instead. */ -#ifndef H5I_PACKAGE +#if !(defined H5I_FRIEND || defined H5I_MODULE) #error "Do not include this file outside the H5I package!" #endif diff --git a/src/H5Itest.c b/src/H5Itest.c index 5236e8d..9d451c6 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ +#include "H5Imodule.h" /* This source code file is part of the H5I module */ #define H5I_TESTING /*suppress warning about H5I testing funcs*/ @@ -80,7 +80,7 @@ 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 */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -17,10 +17,8 @@ /* Module Setup */ /****************/ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ +#include "H5Lmodule.h" /* This source code file is part of the H5L module */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5L_init_interface /***********/ /* Headers */ @@ -191,6 +189,9 @@ static herr_t H5L_get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -235,7 +236,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_init_interface + * Function: H5L__init_package * * Purpose: Initialize information specific to H5L interface. * @@ -246,12 +247,12 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5L_init_interface(void) +herr_t +H5L__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize user-defined link classes */ if(H5L_register_external() < 0) @@ -259,13 +260,13 @@ H5L_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_init_interface() */ +} /* end H5L_init_package() */ /*------------------------------------------------------------------------- - * Function: H5L_term_interface + * Function: H5L_term_package * - * Purpose: Terminate any resources allocated in H5L_init_interface. + * Purpose: Terminate any resources allocated in H5L__init_package. * * Return: Non-negative on success/Negative on failure * @@ -275,21 +276,27 @@ done: *------------------------------------------------------------------------- */ int -H5L_term_interface(void) +H5L_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Free the table of link types */ - H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); - H5L_table_used_g = H5L_table_alloc_g = 0; + if(H5_PKG_INIT_VAR) { + /* Free the table of link types */ + if(H5L_table_g) { + H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); + H5L_table_used_g = H5L_table_alloc_g = 0; + n++; + } /* end if */ - /* Mark the interface as uninitialized */ - H5_interface_initialize_g = 0; + /* Mark the interface as uninitialized */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* H5L_term_interface() */ +} /* H5L_term_package() */ /*------------------------------------------------------------------------- @@ -2756,7 +2763,7 @@ static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { hbool_t exists = FALSE; /* Whether the link exists in the group */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2913,7 +2920,7 @@ done: hid_t H5L_get_default_lcpl(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 08d401e..139c5e6 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -13,12 +13,17 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ +/****************/ +/* Module Setup */ +/****************/ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5L_init_extern_interface +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#include "H5Lmodule.h" /* This source code file is part of the H5L module */ + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ @@ -29,13 +34,52 @@ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ + +/****************/ +/* Local Macros */ +/****************/ + +/* Version of external link format */ +#define H5L_EXT_VERSION 0 + +/* Valid flags for external links */ +#define H5L_EXT_FLAGS_ALL 0 + +/* Size of local link name buffer for traversing external links */ +#define H5L_EXT_TRAVERSE_BUF_SIZE 256 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + static hid_t H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id); static ssize_t H5L_extern_query(const char H5_ATTR_UNUSED * link_name, const void *udata, size_t udata_size, void * buf /*out*/, size_t buf_size); + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + /* Default External Link link class */ -const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ +static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ H5L_TYPE_EXTERNAL, /* Link type id number */ "external", /* Link name for debugging */ @@ -47,41 +91,9 @@ const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ H5L_extern_query /* Query callback */ }}; -/* Version of external link format */ -#define H5L_EXT_VERSION 0 - -/* Valid flags for external links */ -#define H5L_EXT_FLAGS_ALL 0 - -/* Size of local link name buffer for traversing external links */ -#define H5L_EXT_TRAVERSE_BUF_SIZE 256 /*-------------------------------------------------------------------------- -NAME - H5L_init_extern_interface -- Initialize interface-specific information -USAGE - herr_t H5L_init_extern_interface() - -RETURNS - Non-negative on success/Negative on failure - -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5L_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5L_init_extern_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5L_init()) -} /* H5L_init_extern_interface() */ - - - -/*-------------------------------------------------------------------------- * Function: H5L_getenv_prefix_name -- * * Purpose: Get the first pathname in the list of pathnames stored in ENV_PREFIX, @@ -210,7 +222,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, 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) @@ -254,7 +266,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") /* Get callback_info */ - if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info)<0) + 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") /* Get file access property list */ @@ -279,7 +291,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check if we need to allocate larger buffer */ if((size_t)group_name_len > sizeof(local_group_name)) { if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len))) - HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %Zu", group_name_len) + HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) } /* end if */ else parent_group_name = local_group_name; @@ -378,7 +390,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* try searching from property list */ if(ext_file == NULL) { - if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) + if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") if(my_prefix) { if(H5L_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h new file mode 100644 index 0000000..e665c81 --- /dev/null +++ b/src/H5Lmodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5L package. Including this header means that the source file + * is part of the H5L package. + */ +#ifndef _H5Lmodule_H +#define _H5Lmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5L_MODULE +#define H5_MY_PKG H5L +#define H5_MY_PKG_ERR H5E_LINK +#define H5_MY_PKG_INIT YES + +#endif /* _H5Lmodule_H */ + + diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h index 2e931f5..bb8534b 100644 --- a/src/H5Lpkg.h +++ b/src/H5Lpkg.h @@ -21,7 +21,7 @@ * only within the H5L package. Source files outside the * H5L package should include H5Lprivate.h instead. */ -#ifndef H5L_PACKAGE +#if !(defined H5L_FRIEND || defined H5L_MODULE) #error "Do not include this file outside the H5L package!" #endif @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ @@ -92,6 +92,9 @@ static herr_t H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -436,7 +439,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size) H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG @@ -571,7 +574,7 @@ haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size) { haddr_t eoa; /* End of allocated space in the file */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG @@ -796,7 +799,7 @@ H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type, haddr_t addr, H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ haddr_t end; /* End of block to extend */ H5FD_mem_t map_type; /* Mapped type */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) #ifdef H5MF_ALLOC_DEBUG @@ -1029,7 +1032,7 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, H5MF_sect_ud_t udata; /* User data for callback */ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) #ifdef H5MF_ALLOC_DEBUG @@ -1411,7 +1414,7 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t start_type, end_type; /* Memory types to iterate over */ H5FD_mem_t ty; /* Memory type for iteration */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index c5a7b49..40f3ac0 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -25,8 +25,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ @@ -97,7 +97,7 @@ static herr_t H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, 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 @@ -158,7 +158,7 @@ H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, 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 @@ -871,7 +871,7 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id) { htri_t ma_status; /* Whether the metadata aggregator can shrink the EOA */ htri_t sda_status; /* Whether the small data aggregator can shrink the EOA */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 3a664ef..59da9e8 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ #define H5MF_DEBUGGING /* Need access to file space debugging routines */ diff --git a/src/H5MFmodule.h b/src/H5MFmodule.h new file mode 100644 index 0000000..6e5f8ad --- /dev/null +++ b/src/H5MFmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5MF package. Including this header means that the source file + * is part of the H5MF package. + */ +#ifndef _H5MFmodule_H +#define _H5MFmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5MF_MODULE +#define H5_MY_PKG H5MF +#define H5_MY_PKG_ERR H5E_RESOURCE +#define H5_MY_PKG_INIT NO + +#endif /* _H5MFmodule_H */ + diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 2071a0a..1a62710 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -21,7 +21,7 @@ * the H5MF package. Source files outside the H5MF package should * include H5MFprivate.h instead. */ -#ifndef H5MF_PACKAGE +#if !(defined H5MF_FRIEND || defined H5MF_MODULE) #error "Do not include this file outside the H5MF package!" #endif diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 20b9984..f333356 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -25,8 +25,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ @@ -132,7 +132,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -178,7 +178,7 @@ H5MF_sect_simple_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, 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 */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -219,7 +219,7 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1, { 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -300,7 +300,7 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -519,7 +519,7 @@ H5MF_sect_simple_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, static H5FS_section_info_t * H5MF_sect_simple_split(H5FS_section_info_t *sect, hsize_t frag_size) { - H5MF_free_section_t *ret_value; /* Return value */ + H5MF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -29,7 +29,7 @@ *------------------------------------------------------------------------- */ -#define H5MP_PACKAGE /*suppress error about including H5MPpkg */ +#include "H5MPmodule.h" /* This source code file is part of the H5MP module */ /* Private headers */ #include "H5private.h" /* Generic Functions */ @@ -63,6 +63,9 @@ /* Package Variable Definitions */ /********************************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /********************/ /* Static Variables */ @@ -90,7 +93,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -141,7 +144,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -212,7 +215,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) diff --git a/src/H5MPmodule.h b/src/H5MPmodule.h new file mode 100644 index 0000000..ca6c405 --- /dev/null +++ b/src/H5MPmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5MP package. Including this header means that the source file + * is part of the H5MP package. + */ +#ifndef _H5MPmodule_H +#define _H5MPmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5MP_MODULE +#define H5_MY_PKG H5MP +#define H5_MY_PKG_ERR H5E_RESOURCE +#define H5_MY_PKG_INIT NO + +#endif /* _H5MPmodule_H */ + diff --git a/src/H5MPpkg.h b/src/H5MPpkg.h index 5a0b1f8..e724146 100644 --- a/src/H5MPpkg.h +++ b/src/H5MPpkg.h @@ -21,7 +21,7 @@ * the H5MP package. Source files outside the H5MP package should * include H5MPprivate.h instead. */ -#ifndef H5MP_PACKAGE +#if !(defined H5MP_FRIEND || defined H5MP_MODULE) #error "Do not include this file outside the H5MP package!" #endif diff --git a/src/H5MPtest.c b/src/H5MPtest.c index ccbd140..3f218db 100644 --- a/src/H5MPtest.c +++ b/src/H5MPtest.c @@ -19,7 +19,7 @@ * Purpose: Memory pool testing functions. */ -#define H5MP_PACKAGE /*suppress error about including H5MPpkg */ +#include "H5MPmodule.h" /* This source code file is part of the H5MP module */ #define H5MP_TESTING /*include H5MP testing funcs*/ /* Private headers */ @@ -28,10 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5O_init_interface /***********/ /* Headers */ @@ -94,6 +92,9 @@ static const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Header message ID to class mapping */ /* Remember to increment H5O_MSG_TYPES in H5Opkg.h when adding a new @@ -178,7 +179,7 @@ static const H5O_obj_class_t *const H5O_obj_class_g[] = { /*------------------------------------------------------------------------- - * Function: H5O_init_interface + * Function: H5O__init_package * * Purpose: Initialize information specific to H5O interface. * @@ -187,16 +188,12 @@ static const H5O_obj_class_t *const H5O_obj_class_g[] = { * Programmer: Quincey Koziol * Thursday, January 18, 2007 * - * Changes: JRM -- 12/12/07 - * Added santity check verifying that H5O_msg_class_g - * is big enough. - * *------------------------------------------------------------------------- */ -static herr_t -H5O_init_interface(void) +herr_t +H5O__init_package(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* H5O interface sanity checks */ HDcompile_assert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g)); @@ -205,7 +202,7 @@ H5O_init_interface(void) HDcompile_assert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_init_interface() */ +} /* end H5O__init_package() */ /*------------------------------------------------------------------------- @@ -247,7 +244,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) /* 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_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -313,18 +310,18 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* 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_OHDR, H5E_NOTFOUND, FAIL, "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_OHDR, H5E_CANTOPENOBJ, FAIL, "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_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_idx() */ @@ -394,7 +391,7 @@ 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_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -453,7 +450,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, /* Link to the object */ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -614,7 +611,7 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", TRUE, oinfo/*out*/, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -658,7 +655,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap /* Retrieve the object's information */ if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -718,17 +715,17 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* 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_OHDR, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the object's information */ if(H5O_get_info(obj_loc.oloc, H5AC_ind_dxpl_id, TRUE, oinfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: /* Release the object location */ if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx() */ @@ -766,7 +763,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -813,7 +810,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, name, comment, lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -851,7 +848,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) /* 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_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -897,7 +894,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf /* 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_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -955,7 +952,7 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, /* Call internal object visitation routine */ if((ret_value = H5O_visit(obj_id, ".", idx_type, order, op, op_data, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1021,7 +1018,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Call internal object visitation routine */ if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1365,17 +1362,17 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) /* Find the object's location */ if(H5G_loc_find(loc, name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Open the object */ if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, app_ref)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: 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_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_name() */ @@ -1398,7 +1395,7 @@ hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref) { const H5O_obj_class_t *obj_class; /* Class of object for location */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1494,7 +1491,7 @@ int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted) { haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1610,7 +1607,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) { H5O_t *oh = NULL; hbool_t deleted = FALSE; /* Whether the object was deleted */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL) @@ -1661,7 +1658,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, unsigned prot_flags) H5O_cache_ud_t udata; /* User data for protecting object header */ H5O_cont_msgs_t cont_msg_info; /* Continuation message info */ unsigned file_intent; /* R/W intent on file */ - H5O_t *ret_value; /* Return value */ + H5O_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, NULL) @@ -1880,8 +1877,8 @@ done: H5O_t * H5O_pin(const H5O_loc_t *loc, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header */ - H5O_t *ret_value; /* Return value */ + H5O_t *oh = NULL; /* Object header */ + H5O_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2375,7 +2372,7 @@ const H5O_obj_class_t * H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id) { H5O_t *oh = NULL; /* Object header for location */ - const H5O_obj_class_t *ret_value; /* Return value */ + const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, NULL) @@ -2412,7 +2409,7 @@ static const H5O_obj_class_t * H5O_obj_class_real(H5O_t *oh) { size_t i; /* Local index variable */ - const H5O_obj_class_t *ret_value; /* Return value */ + const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2454,7 +2451,7 @@ done: H5O_loc_t * H5O_get_loc(hid_t object_id) { - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -3274,7 +3271,7 @@ H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ H5O_info_t oinfo; /* Object info struct */ hid_t obj_id = (-1); /* ID of object */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 4949b23..c5f692d 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -24,8 +24,9 @@ *------------------------------------------------------------------------- */ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Apkg.h" /* Attributes */ @@ -110,7 +111,7 @@ H5O_ainfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o { H5O_ainfo_t *ainfo = NULL; /* Attribute info */ unsigned char flags; /* Flags for encoding attribute info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -239,7 +240,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -279,7 +280,7 @@ 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 */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -408,7 +409,7 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, { 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 diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index e9d4f85..3d930f0 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -515,7 +516,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, 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 */ @@ -1458,7 +1459,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh) hbool_t curr_chk_dirtied = FALSE; /* Flags for unprotecting curr chunk */ hbool_t packed_msg; /* Flag to indicate that messages were packed */ hbool_t did_packing = FALSE; /* Whether any messages were packed */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1742,7 +1743,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 @@ -1877,7 +1878,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 diff --git a/src/H5Oattr.c b/src/H5Oattr.c index fd7fcda..9cbcdc4 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -13,9 +13,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5A_PACKAGE /*prevent warning from including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5S_FRIEND /*suppress error about including H5Spkg */ #include "H5private.h" /* Generic Functions */ @@ -129,7 +129,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED H5S_extent_t *extent; /*extent dimensionality information */ size_t name_len; /*attribute name length */ unsigned flags = 0; /* Attribute flags */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -380,7 +380,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 @@ -496,10 +496,6 @@ H5O_attr_reset(void H5_ATTR_UNUSED *_mesg) * Programmer: Quincey Koziol * Thursday, November 18, 2004 * - * Modification:Raymond Lu - * 4 June 2008 - * Let this function call H5A_close in turn. - * *------------------------------------------------------------------------- */ static herr_t @@ -652,7 +648,7 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_t void *native_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata, hid_t dxpl_id) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 52f414b..9b494a1 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -28,8 +28,9 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -474,7 +475,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) H5A_t *exist_attr = NULL; /* Existing opened attribute object */ H5A_t *opened_attr = NULL; /* Newly opened attribute object */ htri_t found_open_attr = FALSE; /* Whether opened object is found */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, NULL) @@ -616,7 +617,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5A_t *exist_attr = NULL; /* Existing opened attribute object */ H5A_t *opened_attr = NULL; /* Newly opened attribute object */ htri_t found_open_attr = FALSE; /* Whether opened object is found */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1272,7 +1273,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh = NULL; /* Pointer to actual object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL) @@ -1357,7 +1358,7 @@ H5O_attr_iterate(hid_t loc_id, hid_t dxpl_id, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { H5G_loc_t loc; /* Object location */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1837,7 +1838,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL) @@ -1992,7 +1993,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ hsize_t nattrs; /* Number of attributes */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Obogus.c b/src/H5Obogus.c index b368ab6..de205f6 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -28,7 +28,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 802f23a..ac6fe37 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -21,7 +21,8 @@ * information in the superblock extension. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -83,7 +84,7 @@ H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_btreek_t *mesg; /* Native message */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -165,7 +166,7 @@ H5O_btreek_copy(const void *_mesg, void *_dest) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; H5O_btreek_t *dest = (H5O_btreek_t *)_dest; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 3c64131..945d12e 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ /***********/ @@ -741,9 +741,9 @@ static void * H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t *dirty) { - H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ + H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index bb82ad1..8abe660 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -149,7 +150,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_TAG(dxpl_id, oh->cache_info.addr, NULL) diff --git a/src/H5Ocont.c b/src/H5Ocont.c index a139654..63002c5 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -27,7 +27,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -94,7 +95,7 @@ H5O_cont_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, const uint8_t *p) { H5O_cont_t *cont = NULL; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -174,7 +175,7 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con static size_t H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 66322da..e641d70 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -1084,7 +1085,7 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object copy flag") /* Retrieve the marge committed datatype list */ - if(H5P_get(ocpy_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) + if(H5P_peek(ocpy_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed datatype list") /* Get callback info */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index bd789c5..d9d4b8b 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -247,8 +248,8 @@ H5O_assert(const H5O_t *oh) herr_t H5O_debug_id(unsigned type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 73cb7cc..2fdf494 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -21,7 +21,8 @@ * in the superblock extension. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -84,7 +85,7 @@ 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, const uint8_t *p) { H5O_drvinfo_t *mesg; /* Native message */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -181,7 +182,7 @@ 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; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -228,7 +229,7 @@ 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; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 622a18e..cee6e1e 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -13,8 +13,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5T_PACKAGE /*prevent warning from including H5Tpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5T_FRIEND /*prevent warning from including H5Tpkg */ + #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -35,7 +36,7 @@ static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, static void *H5O_dtype_copy(const void *_mesg, void *_dest); static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset(void *_mesg); -static herr_t H5O_dtype_free(void *_mesg); +static herr_t H5O__dtype_free(void *_mesg); static herr_t H5O_dtype_set_share(void *_mesg, const H5O_shared_t *sh); static htri_t H5O_dtype_can_share(const void *_mesg); static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, @@ -101,7 +102,7 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ H5O_dtype_copy, /* copy the native value */ H5O_dtype_shared_size, /* size of raw message */ H5O_dtype_reset, /* reset method */ - H5O_dtype_free, /* free method */ + H5O__dtype_free, /* free method */ H5O_dtype_shared_delete, /* file delete method */ H5O_dtype_shared_link, /* link method */ H5O_dtype_set_share, /* set share method */ @@ -1093,7 +1094,7 @@ H5O_dtype_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o unsigned *ioflags/*in,out*/, const uint8_t *p) { H5T_t *dt = NULL; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1175,9 +1176,9 @@ done: static void * H5O_dtype_copy(const void *_src, void *_dst) { - const H5T_t *src = (const H5T_t *) _src; - H5T_t *dst; - void *ret_value; /* Return value */ + const H5T_t *src = (const H5T_t *) _src; + H5T_t *dst; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1224,7 +1225,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) { const H5T_t *dt = (const H5T_t *)_mesg; unsigned u; /* Local index variable */ - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1369,31 +1370,34 @@ H5O_dtype_reset(void *_mesg) /*------------------------------------------------------------------------- - * Function: H5O_dtype_free + * Function: H5O__dtype_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, March 30, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_free(void *mesg) +H5O__dtype_free(void *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_STATIC + + /* Sanity check */ HDassert(mesg); - ((H5T_t *) mesg)->shared = H5FL_FREE(H5T_shared_t, ((H5T_t *) mesg)->shared); - mesg = H5FL_FREE(H5T_t, mesg); + /* Release the datatype */ + if(H5T_close((H5T_t *)mesg) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free datatype") - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_dtype_free() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O__dtype_free() */ /*------------------------------------------------------------------------- @@ -1562,7 +1566,7 @@ H5O_dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg_ H5O_copy_t H5_ATTR_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata, hid_t H5_ATTR_UNUSED dxpl_id) { H5T_t *dst_mesg; /* Destination datatype */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oefl.c b/src/H5Oefl.c index a7ce31a..25ab753 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -18,7 +18,7 @@ * Tuesday, November 25, 1997 */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ #include "H5private.h" /* Generic Functions */ @@ -96,8 +96,8 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, int version; const char *s = NULL; H5HL_t *heap; - size_t u; /* Local index variable */ - void *ret_value; /* Return value */ + size_t u; /* Local index variable */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -258,64 +258,47 @@ H5O_efl_copy(const void *_mesg, void *_dest) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; H5O_efl_t *dest = (H5O_efl_t *) _dest; - size_t u; /* Local index variable */ - void *ret_value; /* Return value */ + size_t u; /* Local index variable */ + hbool_t slot_allocated = FALSE; /* Flag to indicate that dynamic allocation has begun */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* check args */ HDassert(mesg); - if(!dest) { - if(NULL == (dest = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message") - if(NULL == (dest->slot = (H5O_efl_entry_t *)H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots") - } /* end if */ - else if(dest->nalloc < mesg->nalloc) { - H5O_efl_entry_t *temp_slot; /* Temporary pointer to new slot information */ - /* Allocate new 'slot' information */ - if(NULL == (temp_slot = (H5O_efl_entry_t *)H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots") + /* Allocate destination message, if necessary */ + if(!dest && NULL == (dest = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message") - /* Release old 'slot' information */ - for(u = 0; u < dest->nused; u++) - dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); - dest->slot = (H5O_efl_entry_t *)H5MM_xfree(dest->slot); + /* copy */ + *dest = *mesg; - /* Point to new 'slot' information */ - dest->slot = temp_slot; + /* Deep copy allocated information */ + if(dest->nalloc > 0) { + if(NULL == (dest->slot = (H5O_efl_entry_t *)H5MM_calloc(dest->nalloc * sizeof(H5O_efl_entry_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots") + slot_allocated = TRUE; + for(u = 0; u < mesg->nused; u++) { + dest->slot[u] = mesg->slot[u]; + if(NULL == (dest->slot[u].name = H5MM_xstrdup(mesg->slot[u].name))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slot name") + } /* end for */ } /* end if */ - else { - /* Release old 'slot' information */ - for(u = 0; u < dest->nused; u++) - dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); - } /* end else */ - dest->heap_addr = mesg->heap_addr; - dest->nalloc = mesg->nalloc; - dest->nused = mesg->nused; - - for(u = 0; u < mesg->nused; u++) { - dest->slot[u] = mesg->slot[u]; - if(NULL == (dest->slot[u].name = H5MM_xstrdup(mesg->slot[u].name))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slot name") - } /* end for */ /* Set return value */ ret_value = dest; done: if(NULL == ret_value) { - if(dest && NULL == _dest) { - if(dest->slot) { - for(u = 0; u < mesg->nused; u++) { - if(dest->slot[u].name != NULL && dest->slot[u].name != mesg->slot[u].name) - dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); - } /* end for */ - dest->slot = (H5O_efl_entry_t *)H5MM_xfree(dest->slot); - } /* end if */ - dest = (H5O_efl_t *)H5MM_xfree(dest); + if(slot_allocated) { + for(u = 0; u < dest->nused; u++) + if(dest->slot[u].name != NULL && dest->slot[u].name != mesg->slot[u].name) + dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); + dest->slot = (H5O_efl_entry_t *)H5MM_xfree(dest->slot); } /* end if */ + if(NULL == _dest) + dest = (H5O_efl_t *)H5MM_xfree(dest); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -389,8 +372,10 @@ H5O_efl_reset(void *_mesg) /* reset */ if(mesg->slot) { - for(u = 0; u < mesg->nused; u++) + for(u = 0; u < mesg->nused; u++) { mesg->slot[u].name = (char *)H5MM_xfree(mesg->slot[u].name); + mesg->slot[u].name_offset = 0; + } /* end for */ mesg->slot = (H5O_efl_entry_t *)H5MM_xfree(mesg->slot); } /* end if */ mesg->heap_addr = HADDR_UNDEF; @@ -460,9 +445,9 @@ H5O_efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_ds { H5O_efl_t *efl_src = (H5O_efl_t *) mesg_src; H5O_efl_t *efl_dst = NULL; - H5HL_t *heap = NULL; /* Pointer to local heap for EFL file names */ + 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_TAG(dxpl_id, H5AC__COPIED_TAG, NULL) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 3bd1e84..ebcb5d3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -20,7 +20,8 @@ * uninitialized data points of a dataset. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -188,7 +189,7 @@ 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, const uint8_t *p) { H5O_fill_t *fill = NULL; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -301,8 +302,8 @@ static void * H5O_fill_old_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { - H5O_fill_t *fill = NULL; /* Decoded fill value message */ - void *ret_value; /* Return value */ + H5O_fill_t *fill = NULL; /* Decoded fill value message */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -494,7 +495,7 @@ H5O_fill_copy(const void *_src, void *_dst) { const H5O_fill_t *src = (const H5O_fill_t *)_src; H5O_fill_t *dst = (H5O_fill_t *)_dst; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -611,7 +612,7 @@ static size_t H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 180ebe8..1712857 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /* suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -89,7 +90,7 @@ H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * { H5O_fsinfo_t *fsinfo = NULL; /* free-space manager info */ H5FD_mem_t type; /* Memory type for iteration */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -183,9 +184,9 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c static void * H5O_fsinfo_copy(const void *_mesg, void *_dest) { - const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; - H5O_fsinfo_t *dest = (H5O_fsinfo_t *) _dest; - void *ret_value; /* Return value */ + const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; + H5O_fsinfo_t *dest = (H5O_fsinfo_t *) _dest; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -224,7 +225,7 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; size_t fs_addr_size = 0; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 5519021..9cd0dc1 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -100,7 +101,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 { H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */ unsigned char flags; /* Flags for encoding group info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -224,7 +225,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -265,7 +266,7 @@ 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 */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 81ef061..daffe48 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -19,8 +19,9 @@ * Purpose: Messages related to data layout. */ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Dataset functions */ @@ -105,7 +106,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * H5O_layout_t *mesg = NULL; uint8_t *heap_block = NULL; unsigned u; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -635,7 +636,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -654,6 +655,9 @@ H5O_layout_copy(const void *_mesg, void *_dest) case H5D_COMPACT: /* Deep copy the buffer for compact datasets also */ if(mesg->storage.u.compact.size > 0) { + /* Sanity check */ + HDassert(mesg->storage.u.compact.buf); + /* Allocate memory for the raw data */ if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size))) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") @@ -716,7 +720,7 @@ static size_t H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -886,8 +890,8 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ H5O_layout_t *layout_src = (H5O_layout_t *) mesg_src; H5O_layout_t *layout_dst = NULL; - hbool_t copied = FALSE; /* Whether the data was copied */ - void *ret_value; /* Return value */ + hbool_t copied = FALSE; /* Whether the data was copied */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index a0b6e4a..62e63d4 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -24,9 +24,10 @@ *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5L_FRIEND /*suppress error about including H5Lpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -119,7 +120,7 @@ H5O_linfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o { H5O_linfo_t *linfo = NULL; /* Link info */ unsigned char index_flags; /* Flags for encoding link index info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -249,7 +250,7 @@ H5O_linfo_copy(const void *_mesg, void *_dest) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; H5O_linfo_t *dest = (H5O_linfo_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -289,7 +290,7 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -383,10 +384,10 @@ H5O_linfo_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t *fil hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags, H5O_copy_t *cpy_info, void *_udata, hid_t dxpl_id) { - H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src; - H5O_linfo_t *linfo_dst = NULL; + H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src; + H5O_linfo_t *linfo_dst = NULL; H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *) _udata; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, H5AC__COPIED_TAG, NULL) diff --git a/src/H5Olink.c b/src/H5Olink.c index 7e70196..fd4ee88 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -24,9 +24,10 @@ *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5L_FRIEND /*suppress error about including H5Lpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -124,7 +125,7 @@ H5O_link_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *op H5O_link_t *lnk = NULL; /* Pointer to link message */ size_t len = 0; /* Length of a string in the message */ unsigned char link_flags; /* Flags for encoding link info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -411,7 +412,7 @@ H5O_link_copy(const void *_mesg, void *_dest) { const H5O_link_t *lnk = (const H5O_link_t *) _mesg; H5O_link_t *dest = (H5O_link_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -478,9 +479,9 @@ static size_t H5O_link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; - uint64_t name_len; /* Length of name */ - size_t name_size; /* Size of encoded name length */ - size_t ret_value; /* Return value */ + uint64_t name_len; /* Length of name */ + size_t name_size; /* Size of encoded name length */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -727,7 +728,7 @@ H5O_link_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t H5_AT H5O_copy_t H5_ATTR_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata, hid_t H5_ATTR_UNUSED dxpl_id) { H5O_link_t *link_src = (H5O_link_t *)native_src; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Omessage.c b/src/H5Omessage.c index c2756ea..d42896c 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -465,7 +466,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, NULL) @@ -652,7 +653,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -749,7 +750,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -789,7 +790,7 @@ 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 */ + int ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -836,7 +837,7 @@ 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 ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -875,7 +876,7 @@ 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL) @@ -966,8 +967,8 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1018,8 +1019,8 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1210,7 +1211,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, { H5O_t *oh = NULL; /* Pointer to actual object header */ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1359,7 +1360,7 @@ H5O_msg_raw_size(const H5F_t *f, unsigned type_id, hbool_t disable_shared, const void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -1404,7 +1405,7 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ H5P_genplist_t *ocpl; /* Object Creation Property list */ uint8_t oh_flags; /* Object header status flags */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -1466,7 +1467,7 @@ H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, const void *mesg, size_t extra_raw) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -1517,7 +1518,7 @@ htri_t H5O_msg_can_share(unsigned type_id, const void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1564,7 +1565,7 @@ htri_t H5O_msg_can_share_in_ohdr(unsigned type_id) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1602,7 +1603,7 @@ htri_t H5O_msg_is_shared(unsigned type_id, const void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1816,8 +1817,8 @@ H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1859,7 +1860,7 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, 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 *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2047,7 +2048,7 @@ H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) /* check args */ HDassert(f); @@ -2276,7 +2277,7 @@ H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ H5O_mesg_t *idx_msg; /* Pointer to message to modify */ unsigned idx; /* Index of message to modify */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Omodule.h b/src/H5Omodule.h new file mode 100644 index 0000000..a8f1301 --- /dev/null +++ b/src/H5Omodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5O package. Including this header means that the source file + * is part of the H5O package. + */ +#ifndef _H5Omodule_H +#define _H5Omodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5O_MODULE +#define H5_MY_PKG H5O +#define H5_MY_PKG_ERR H5E_OHDR +#define H5_MY_PKG_INIT YES + +#endif /* _H5Omodule_H */ + diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 63ba152..622d57d 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -19,7 +19,8 @@ * Purpose: The object modification time message. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -126,8 +127,8 @@ H5O_mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { time_t *mesg; - uint32_t tmp_time; /* Temporary copy of the time */ - void *ret_value; /* Return value */ + uint32_t tmp_time; /* Temporary copy of the time */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -184,7 +185,7 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 time_t *mesg, the_time; int i; struct tm tm; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -352,7 +353,7 @@ H5O_mtime_copy(const void *_mesg, void *_dest) { const time_t *mesg = (const time_t *) _mesg; time_t *dest = (time_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oname.c b/src/H5Oname.c index 2cd9e72..6c4f76f 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -88,7 +89,7 @@ H5O_name_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, const uint8_t *p) { H5O_name_t *mesg; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -170,9 +171,9 @@ H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, 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 @@ -223,7 +224,7 @@ 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; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Onull.c b/src/H5Onull.c index a6c6524..258f695 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Opkg.h" /* Object headers */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 1f8a1cd..ddcdb10 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5O_PACKAGE +#if !(defined H5O_FRIEND || defined H5O_MODULE) #error "Do not include this file outside the H5O package!" #endif diff --git a/src/H5Opline.c b/src/H5Opline.c index b79a73c..95a82b5 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -20,8 +20,9 @@ * Purpose: Data filter pipeline message. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ + #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -116,7 +117,7 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 H5Z_filter_info_t *filter; /* Filter to decode */ size_t name_length; /* Length of filter name */ size_t i; /* Local index variable */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -344,7 +345,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 @@ -434,7 +435,7 @@ 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 diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 77a11cd..4586adb 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -110,11 +110,11 @@ typedef struct H5O_t H5O_t; #define H5O_CPY_MCDT_SEARCH_CB_NAME "committed dtype list search" /* Callback function when the search for a matching committed datatype is complete */ /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5O_PACKAGE +#ifdef H5O_MODULE #define H5O_OH_GET_ADDR(O) ((O)->chunk[0].addr) -#else /* H5O_PACKAGE */ +#else /* H5O_MODULE */ #define H5O_OH_GET_ADDR(O) (H5O_get_oh_addr(O)) -#endif /* H5O_PACKAGE */ +#endif /* H5O_MODULE */ /* Set the fields in a shared message structure */ #define H5O_UPDATE_SHARED(SH_MESG, SH_TYPE, F, MSG_TYPE, CRT_IDX, OH_ADDR) \ diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index f5c7e25..ff7dfee 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -93,8 +94,8 @@ static void * H5O_refcount_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { - H5O_refcount_t *refcount = NULL; /* Reference count */ - void *ret_value; /* Return value */ + H5O_refcount_t *refcount = NULL; /* Reference count */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -177,9 +178,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 diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 50fba0b..28021de 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -13,8 +13,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5S_PACKAGE /*prevent warning from including H5Spkg.h */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5S_FRIEND /*prevent warning from including H5Spkg.h */ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -115,9 +115,9 @@ H5O_sdspace_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, 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 @@ -302,7 +302,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -352,7 +352,7 @@ static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg) { const H5S_extent_t *space = (const H5S_extent_t *)_mesg; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Oshared.c b/src/H5Oshared.c index c5c088a..25baa88 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -30,7 +30,7 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ /***********/ @@ -313,7 +313,7 @@ H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags, { H5O_shared_t sh_mesg; /* Shared message info */ unsigned version; /* Shared message version */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -477,7 +477,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 diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 2ac2a98..e8d620a 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -51,7 +51,7 @@ static H5_INLINE void * H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -166,7 +166,7 @@ static H5_INLINE size_t 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 @@ -324,7 +324,7 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, void *udata, hid_t dxpl_id) { void *dst_mesg = NULL; /* Destination message */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index deb10ab..a506ce2 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -21,7 +21,8 @@ * information in the superblock extension. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -79,8 +80,8 @@ static void * H5O_shmesg_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { - H5O_shmesg_table_t *mesg; /* Native message */ - void *ret_value; /* Return value */ + H5O_shmesg_table_t *mesg; /* Native message */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -156,7 +157,7 @@ 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; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -194,7 +195,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 133a3e2..bb39e58 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -24,8 +24,9 @@ *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -101,7 +102,7 @@ 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, const uint8_t *p) { H5O_stab_t *stab = NULL; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -180,9 +181,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 @@ -222,7 +223,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 @@ -314,8 +315,8 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, 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 diff --git a/src/H5Otest.c b/src/H5Otest.c index e7312ee..b5f728a 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -23,8 +23,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ #define H5O_TESTING /*suppress warning about H5O testing funcs*/ @@ -99,7 +99,7 @@ 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -159,12 +159,12 @@ htri_t H5O_is_attr_empty_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ - H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - H5O_loc_t *loc; /* Pointer to object's location */ + 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 548f74d..546e839 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P__init_pub_interface +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -62,6 +59,9 @@ typedef struct { /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -74,51 +74,6 @@ typedef struct { /*-------------------------------------------------------------------------- -NAME - H5P__init_pub_interface -- Initialize interface-specific information -USAGE - herr_t H5P__init_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5P_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5P__init_pub_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P__init_pub_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5P__term_pub_interface -- Terminate interface -USAGE - herr_t H5P__term_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5P__term_pub_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5P__term_pub_interface() */ - - -/*-------------------------------------------------------------------------- NAME H5Pcopy PURPOSE @@ -1395,7 +1350,7 @@ H5Premove(hid_t plist_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); /* Create the new property list class */ - if((ret_value = H5P_remove(plist_id,plist,name)) < 0) + if((ret_value = H5P_remove(plist, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); done: @@ -16,8 +16,7 @@ /* Module Setup */ /****************/ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5PL__init_interface +#include "H5PLmodule.h" /* This source code file is part of the H5PL module */ /***********/ @@ -52,7 +51,6 @@ * If you do not do this, people will be unable to incorporate our * source code into their own CMake builds if they define UNICODE. */ - #ifdef H5_HAVE_WIN32_API #define H5PL_PATH_SEPARATOR ";" @@ -103,6 +101,7 @@ typedef const void *(*H5PL_get_plugin_info_t)(void); /* Special symbol to indicate no plugin loading */ #define H5PL_NO_PLUGIN "::" + /******************/ /* Local Typedefs */ /******************/ @@ -130,6 +129,9 @@ static herr_t H5PL__close(H5PL_HANDLE handle); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -153,36 +155,94 @@ static hbool_t H5PL_path_found_g = FALSE; /* Enable all plugin libraries */ static unsigned int H5PL_plugin_g = H5PL_ALL_PLUGIN; + /*-------------------------------------------------------------------------- NAME - H5PL__init_interface -- Initialize interface-specific information + H5PL__init_package -- Initialize interface-specific information USAGE - herr_t H5PL__init_interface() + herr_t H5PL__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5PL__init_interface(void) +herr_t +H5PL__init_package(void) { char *preload_path; - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Retrieve pathnames from HDF5_PLUGIN_PRELOAD if the user sets it * to tell the library to load plugin libraries without search. */ - if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) { + if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) /* Special symbal "::" means no plugin during data reading. */ if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN)) H5PL_plugin_g = 0; - } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5PL__init_interface() */ +} /* end H5PL__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5PL_term_package + * + * Purpose: Terminate the H5PL 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. + * Failure: Negative. + * + * Programmer: Raymond Lu + * 20 February 2013 + * + *------------------------------------------------------------------------- + */ +int +H5PL_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + size_t u; /* Local index variable */ + + /* Close opened dynamic libraries */ + if(H5PL_table_g) { + for(u = 0; u < H5PL_table_used_g; u++) + H5PL__close((H5PL_table_g[u]).handle); + + /* Free the table of dynamic libraries */ + H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g); + H5PL_table_used_g = H5PL_table_alloc_g = 0; + + n++; + } /* end if */ + + /* Free the table of search paths */ + if(H5PL_num_paths_g > 0) { + for(u = 0; u < H5PL_num_paths_g; u++) + if(H5PL_path_table_g[u]) + H5PL_path_table_g[u] = (char *)H5MM_xfree(H5PL_path_table_g[u]); + H5PL_num_paths_g = 0; + H5PL_path_found_g = FALSE; + + n++; + } /* end if */ + + /* Mark the interface as uninitialized */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5PL_term_package() */ /*------------------------------------------------------------------------- @@ -209,21 +269,24 @@ H5PLset_loading_state(unsigned int plugin_type) { char *preload_path; herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "Iu", plugin_type); + /* change the bit value of the requested plugin type(s) */ H5PL_plugin_g = plugin_type; + /* check if special ENV variable is set and disable all plugin types */ - if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) { + if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) /* Special symbol "::" means no plugin during data reading. */ if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN)) H5PL_plugin_g = 0; - } + done: FUNC_LEAVE_API(ret_value) } /* end H5PLset_loading_state() */ - + /*------------------------------------------------------------------------- * Function: H5PLget_loading_state * @@ -240,66 +303,17 @@ herr_t H5PLget_loading_state(unsigned int *plugin_type) { herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "*Iu", plugin_type); if(plugin_type) *plugin_type = H5PL_plugin_g; - done: + +done: FUNC_LEAVE_API(ret_value) } /* end H5PLget_loading_state() */ - - -/*------------------------------------------------------------------------- - * Function: H5PL_term_interface - * - * Purpose: Terminate the H5PL 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. - * - * Failure: Negative. - * - * Programmer: Raymond Lu - * 20 February 2013 - * - *------------------------------------------------------------------------- - */ -int -H5PL_term_interface(void) -{ - int i = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(H5_interface_initialize_g) { - size_t u; /* Local index variable */ - - /* Close opened dynamic libraries */ - for(u = 0; u < H5PL_table_used_g; u++) - H5PL__close((H5PL_table_g[u]).handle); - - /* Free the table of dynamic libraries */ - H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g); - H5PL_table_used_g = H5PL_table_alloc_g = 0; - - /* Free the table of search paths */ - for(u = 0; u < H5PL_num_paths_g; u++) - if(H5PL_path_table_g[u]) - H5PL_path_table_g[u] = (char *)H5MM_xfree(H5PL_path_table_g[u]); - H5PL_num_paths_g = 0; - H5PL_path_found_g = FALSE; - - H5_interface_initialize_g = 0; - i = 1; - } /* end if */ - - FUNC_LEAVE_NOAPI(i) -} /* end H5PL_term_interface() */ - /*------------------------------------------------------------------------- * Function: H5PL_load @@ -324,16 +338,17 @@ H5PL_load(H5PL_type_t type, int id) FUNC_ENTER_NOAPI(NULL) - switch (type) { - case H5PL_TYPE_FILTER: - if((H5PL_plugin_g & H5PL_FILTER_PLUGIN) == 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) - break; - case H5PL_TYPE_ERROR: - case H5PL_TYPE_NONE: - default: - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id) - } + switch(type) { + case H5PL_TYPE_FILTER: + if((H5PL_plugin_g & H5PL_FILTER_PLUGIN) == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + break; + + case H5PL_TYPE_ERROR: + case H5PL_TYPE_NONE: + default: + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id) + } /* end switch */ /* Initialize the location paths for dynamic libraries, if they aren't * already set up. @@ -726,3 +741,4 @@ H5PL__close(H5PL_HANDLE handle) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5PL__close() */ + diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h new file mode 100644 index 0000000..0339737 --- /dev/null +++ b/src/H5PLmodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5PL package. Including this header means that the source file + * is part of the H5PL package. + */ +#ifndef _H5PLmodule_H +#define _H5PLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5PL_MODULE +#define H5_MY_PKG H5PL +#define H5_MY_PKG_ERR H5E_PLUGIN +#define H5_MY_PKG_INIT YES + +#endif /* _H5PLmodule_H */ + + diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 0a0641c..bfed332 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index c8df45b..eab9337 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -49,13 +50,13 @@ /* Definitions for size of raw data chunk cache(slots) */ #define H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t) #define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF H5D_CHUNK_CACHE_NSLOTS_DEFAULT -#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_size_t -#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_size_t +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_chunk_cache_nslots +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_chunk_cache_nslots /* Definition for size of raw data chunk cache(bytes) */ #define H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) #define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF H5D_CHUNK_CACHE_NBYTES_DEFAULT -#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_size_t -#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_chunk_cache_nbytes +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_chunk_cache_nbytes /* Definition for preemption read chunks first */ #define H5D_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) #define H5D_ACS_PREEMPT_READ_CHUNKS_DEF H5D_CHUNK_CACHE_W0_DEFAULT @@ -88,6 +89,12 @@ /* Property class callbacks */ static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__encode_chunk_cache_nslots(const void *value, void **_pp, + size_t *size); +static herr_t H5P__decode_chunk_cache_nslots(const void **_pp, void *_value); +static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, + size_t *size); +static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /* Property list callbacks */ static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); @@ -314,6 +321,226 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__encode_chunk_cache_nslots + * + * Purpose: Encode the rdcc_nslots parameter to a serialized + * property list. Similar to H5P__encode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF, in which + * nothing further is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) +{ + uint64_t enc_value; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(size); + + /* Determine if this is the default value, in which case only encode + * enc_size (as 255). Also set size needed for encoding. */ + if(*(const size_t *)value == H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF) { + enc_size = 0; + *size += 1; + } /* end if */ + else { + enc_value = (uint64_t)*(const size_t *)value; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size > 0); + *size += (1 + enc_size); + } /* end else */ + + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* Encode the size */ + *(*pp)++ = (uint8_t)enc_size; + + /* Encode the value if necessary */ + if(enc_size != 0) { + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_chunk_cache_nslots() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_chunk_cache_nslots + * + * Purpose: Decode the rdcc_nslots parameter from a serialized + * property list. Similar to H5P__decode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF, in which + * nothing further needs to be decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) +{ + size_t *value = (size_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Determine if enc_size indicates that this is the default value, in which + * case set value to H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF and return */ + if(enc_size == 0) + *value = H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF; + else { + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + H5_CHECKED_ASSIGN(*value, uint64_t, enc_value, size_t); + } /* end else */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_chunk_cache_nslots() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_chunk_cache_nbytes + * + * Purpose: Encode the rdcc_nbytes parameter to a serialized + * property list. Similar to H5P__encode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF, in which + * nothing further is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) +{ + uint64_t enc_value; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(size); + + /* Determine if this is the default value, in which case only encode + * enc_size (as 255). Also set size needed for encoding. */ + if(*(const size_t *)value == H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF) { + enc_size = 0; + *size += 1; + } /* end if */ + else { + enc_value = (uint64_t)*(const size_t *)value; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size > 0); + *size += (1 + enc_size); + } /* end else */ + + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* Encode the size */ + *(*pp)++ = (uint8_t)enc_size; + + /* Encode the value if necessary */ + if(enc_size != 0) { + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_chunk_cache_nbytes() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_chunk_cache_nbytes + * + * Purpose: Decode the rdcc_nbytes parameter from a serialized + * property list. Similar to H5P__decode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF, in which + * nothing further needs to be decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value) +{ + size_t *value = (size_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Determine if enc_size indicates that this is the default value, in which + * case set value to H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF and return */ + if(enc_size == 0) + *value = H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF; + else { + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + H5_CHECKED_ASSIGN(*value, uint64_t, enc_value, size_t); + } /* end else */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_chunk_cache_nbytes() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_virtual_view * * Purpose: Takes the access property list for the virtual dataset, diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 69645a4..5a0e32f 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -27,8 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -45,7 +45,7 @@ #include "H5Ppkg.h" /* Property lists */ #include "H5Sprivate.h" /* Dataspaces */ #include "H5Tprivate.h" /* Datatypes */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5Zprivate.h" /* Data filters */ /****************/ @@ -83,18 +83,26 @@ /* Definitions for storage layout property */ #define H5D_CRT_LAYOUT_SIZE sizeof(H5O_layout_t) #define H5D_CRT_LAYOUT_DEF H5D_DEF_LAYOUT_CONTIG +#define H5D_CRT_LAYOUT_SET H5P__dcrt_layout_set +#define H5D_CRT_LAYOUT_GET H5P__dcrt_layout_get #define H5D_CRT_LAYOUT_ENC H5P__dcrt_layout_enc #define H5D_CRT_LAYOUT_DEC H5P__dcrt_layout_dec #define H5D_CRT_LAYOUT_DEL H5P__dcrt_layout_del +#define H5D_CRT_LAYOUT_COPY H5P__dcrt_layout_copy #define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp #define H5D_CRT_LAYOUT_CLOSE H5P__dcrt_layout_close /* Definitions for fill value. size=0 means fill value will be 0 as * library default; size=-1 means fill value is undefined. */ #define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) #define H5D_CRT_FILL_VALUE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_FILL_VERSION_2, NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, FALSE} -#define H5D_CRT_FILL_VALUE_ENC H5P__fill_value_enc -#define H5D_CRT_FILL_VALUE_DEC H5P__fill_value_dec +#define H5D_CRT_FILL_VALUE_SET H5P__dcrt_fill_value_set +#define H5D_CRT_FILL_VALUE_GET H5P__dcrt_fill_value_get +#define H5D_CRT_FILL_VALUE_ENC H5P__dcrt_fill_value_enc +#define H5D_CRT_FILL_VALUE_DEC H5P__dcrt_fill_value_dec +#define H5D_CRT_FILL_VALUE_DEL H5P__dcrt_fill_value_del +#define H5D_CRT_FILL_VALUE_COPY H5P__dcrt_fill_value_copy #define H5D_CRT_FILL_VALUE_CMP H5P_fill_value_cmp +#define H5D_CRT_FILL_VALUE_CLOSE H5P__dcrt_fill_value_close /* Definitions for space allocation time state */ #define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned) #define H5D_CRT_ALLOC_TIME_STATE_DEF 1 @@ -103,9 +111,14 @@ /* Definitions for external file list */ #define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) #define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} +#define H5D_CRT_EXT_FILE_LIST_SET H5P__dcrt_ext_file_list_set +#define H5D_CRT_EXT_FILE_LIST_GET H5P__dcrt_ext_file_list_get #define H5D_CRT_EXT_FILE_LIST_ENC H5P__dcrt_ext_file_list_enc #define H5D_CRT_EXT_FILE_LIST_DEC H5P__dcrt_ext_file_list_dec +#define H5D_CRT_EXT_FILE_LIST_DEL H5P__dcrt_ext_file_list_del +#define H5D_CRT_EXT_FILE_LIST_COPY H5P__dcrt_ext_file_list_copy #define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp +#define H5D_CRT_EXT_FILE_LIST_CLOSE H5P__dcrt_ext_file_list_close /******************/ @@ -130,20 +143,31 @@ static herr_t H5P__init_def_layout(void); /* Property class callbacks */ static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P__dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); -static herr_t H5P__dcrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ +static herr_t H5P__dcrt_layout_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_layout_get(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dcrt_layout_dec(const void **pp, void *value); static herr_t H5P__dcrt_layout_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_layout_copy(const char *name, size_t size, void *value); static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__dcrt_layout_close(const char *name, size_t size, void *value); -static herr_t H5P__fill_value_enc(const void *value, void **pp, size_t *size); -static herr_t H5P__fill_value_dec(const void **pp, void *value); +static herr_t H5P__dcrt_fill_value_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_fill_value_dec(const void **pp, void *value); +static herr_t H5P__dcrt_fill_value_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_copy(const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_close(const char *name, size_t size, void *value); +static herr_t H5P__dcrt_ext_file_list_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_ext_file_list_get(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dcrt_ext_file_list_dec(const void **pp, void *value); +static herr_t H5P__dcrt_ext_file_list_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_ext_file_list_copy(const char *name, size_t size, void *value); static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__dcrt_ext_file_list_close(const char *name, size_t size, void *value); /*********************/ @@ -163,9 +187,9 @@ const H5P_libclass_t H5P_CLS_DCRT[1] = {{ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P__dcrt_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P__dcrt_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -224,14 +248,14 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) /* Register the storage layout property */ if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, - NULL, NULL, NULL, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, - H5D_CRT_LAYOUT_DEL, NULL, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0) + NULL, H5D_CRT_LAYOUT_SET, H5D_CRT_LAYOUT_GET, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, + H5D_CRT_LAYOUT_DEL, H5D_CRT_LAYOUT_COPY, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the fill value property */ if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, - NULL, NULL, NULL, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, - NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) + NULL, H5D_CRT_FILL_VALUE_SET, H5D_CRT_FILL_VALUE_GET, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, + H5D_CRT_FILL_VALUE_DEL, H5D_CRT_FILL_VALUE_COPY, H5D_CRT_FILL_VALUE_CMP, H5D_CRT_FILL_VALUE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the space allocation time state property */ @@ -242,8 +266,8 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) /* Register the external file list property */ if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, - NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, - NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) + NULL, H5D_CRT_EXT_FILE_LIST_SET, H5D_CRT_EXT_FILE_LIST_GET, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, + H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -252,170 +276,80 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__dcrt_copy + * Function: H5P__dcrt_layout_set * - * Purpose: Callback routine which is called whenever any dataset - * creation property list is copied. This routine copies - * the properties from the old list to the new list. + * Purpose: Copies a layout property when it's set for a property list * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Raymond Lu - * Tuesday, October 2, 2001 + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 * *------------------------------------------------------------------------- */ /* ARGSUSED */ static herr_t -H5P__dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void H5_ATTR_UNUSED *copy_data) +H5P__dcrt_layout_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { - H5O_fill_t src_fill, dst_fill; /* Source & destination fill values */ - H5O_efl_t src_efl, dst_efl; /* Source & destination external file lists */ - H5O_layout_t src_layout, dst_layout; /* Source & destination layout */ - H5P_genplist_t *src_plist; /* Pointer to source property list */ - H5P_genplist_t *dst_plist; /* Pointer to destination property list */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */ + H5O_layout_t new_layout; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - /* Verify property list IDs */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - - /* Get the layout, fill value, external file list, and data pipeline - * properties from the old property list - */ - if(H5P_get(src_plist, H5D_CRT_LAYOUT_NAME, &src_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") - if(H5P_get(src_plist, H5D_CRT_FILL_VALUE_NAME, &src_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") - if(H5P_get(src_plist, H5D_CRT_EXT_FILE_LIST_NAME, &src_efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + /* Sanity check */ + HDassert(value); /* Make copy of layout */ - if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, &src_layout, &dst_layout)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy layout") - - /* Reset layout values set when dataset is created */ - dst_layout.ops = NULL; - switch(dst_layout.type) { - case H5D_COMPACT: - dst_layout.storage.u.compact.buf = H5MM_xfree(dst_layout.storage.u.compact.buf); - HDmemset(&dst_layout.storage.u.compact, 0, sizeof(dst_layout.storage.u.compact)); - break; - - case H5D_CONTIGUOUS: - dst_layout.storage.u.contig.addr = HADDR_UNDEF; - dst_layout.storage.u.contig.size = 0; - break; - - case H5D_CHUNKED: - /* Reset chunk size */ - dst_layout.u.chunk.size = 0; - - /* Reset index info, if the chunk ops are set */ - if(dst_layout.storage.u.chunk.ops) - /* Reset address and pointer of the array struct for the chunked storage index */ - if(H5D_chunk_idx_reset(&dst_layout.storage.u.chunk, TRUE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") - - /* Reset chunk index ops */ - dst_layout.storage.u.chunk.ops = NULL; - break; - - case H5D_VIRTUAL: - dst_layout.storage.u.virt.serial_list_hobjid.addr = HADDR_UNDEF; - dst_layout.storage.u.virt.serial_list_hobjid.idx = 0; - break; - - case H5D_LAYOUT_ERROR: - case H5D_NLAYOUTS: - default: - HDassert(0 && "Unknown layout type!"); - } /* end switch */ - - /* Make copy of fill value */ - if(NULL == H5O_msg_copy(H5O_FILL_ID, &src_fill, &dst_fill)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value") - - /* Make copy of external file list */ - HDmemset(&dst_efl, 0, sizeof(H5O_efl_t)); - if(NULL == H5O_msg_copy(H5O_EFL_ID, &src_efl, &dst_efl)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list") + if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") - /* Reset efl name_offset and heap_addr, these are the values when the dataset is created */ - if(dst_efl.slot) { - unsigned int i; - - dst_efl.heap_addr = HADDR_UNDEF; - for(i = 0; i < dst_efl.nused; i++) - dst_efl.slot[i].name_offset = 0; - } /* end if */ - - /* Set the layout, fill value, external file list, and data pipeline - * properties for the destination property list - */ - if(H5P_set(dst_plist, H5D_CRT_LAYOUT_NAME, &dst_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") - if(H5P_set(dst_plist, H5D_CRT_FILL_VALUE_NAME, &dst_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") - if(H5P_set(dst_plist, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") + /* Copy new layout message over old one */ + *layout = new_layout; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dcrt_copy() */ +} /* end H5P__dcrt_layout_set() */ /*------------------------------------------------------------------------- - * Function: H5P__dcrt_close + * Function: H5P__dcrt_layout_get * - * Purpose: Callback routine which is called whenever any dataset create - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the list. + * Purpose: Copies a layout property when it's retrieved from a property list * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, July 11, 2001 + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t -H5P__dcrt_close(hid_t dcpl_id, void H5_ATTR_UNUSED *close_data) +H5P__dcrt_layout_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { - H5O_fill_t fill; /* Fill value */ - H5O_efl_t efl; /* External file list */ - H5P_genplist_t *plist; /* Property list */ + H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */ + H5O_layout_t new_layout; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + /* Sanity check */ + HDassert(value); - /* Get the fill value, external file list, and data pipeline properties - * from the old property list */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + /* Make copy of layout */ + if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") - /* Clean up any values set for the fill-value and external file-list */ - if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info") - if(H5O_msg_reset(H5O_EFL_ID, &efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") + /* Copy new layout message over old one */ + *layout = new_layout; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dcrt_close() */ +} /* end H5P__dcrt_layout_get() */ /*------------------------------------------------------------------------- @@ -440,7 +374,7 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) uint8_t **pp = (uint8_t **)_pp; uint8_t *tmp_p; size_t tmp_size; - size_t u; /* Local index variable */ + size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -452,16 +386,20 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) if(NULL != *pp) { /* Encode layout type */ *(*pp)++ = (uint8_t)layout->type; + *size += sizeof(uint8_t); /* If layout is chunked, encode chunking structure */ if(H5D_CHUNKED == layout->type) { /* Encode rank */ *(*pp)++ = (uint8_t)layout->u.chunk.ndims; + *size += sizeof(uint8_t); /* Encode chunk dims */ HDcompile_assert(sizeof(uint32_t) == sizeof(layout->u.chunk.dim[0])); - for(u = 0; u < (size_t)layout->u.chunk.ndims; u++) + for(u = 0; u < (size_t)layout->u.chunk.ndims; u++) { UINT32ENCODE(*pp, layout->u.chunk.dim[u]) + *size += sizeof(uint32_t); + } /* end for */ } /* end if */ else if(H5D_VIRTUAL == layout->type) { uint64_t nentries = (uint64_t)layout->storage.u.virt.list_nused; @@ -485,7 +423,7 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) *size += tmp_size; /* Source selection. Note that we are not passing the real - * allocated size because we do no know it. H5P__encode should + * allocated size because we do not know it. H5P__encode should * have verified that the buffer is large enough for the entire * list before we get here. */ tmp_size = (size_t)-1; @@ -503,46 +441,47 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) } /* end for */ } /* end if */ } /* end if */ - else if(H5D_VIRTUAL == layout->type) { - /* Calculate size of virtual layout info */ - /* number of entries */ - *size += (size_t)8; - - /* NULL pointer to pass to H5S_encode */ - tmp_p = NULL; - - /* Iterate over entries */ - for(u = 0; u < layout->storage.u.virt.list_nused; u++) { - /* Source file name */ - tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; - *size += tmp_size; - - /* Source dataset name */ - tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; - *size += tmp_size; - - /* Source selection */ - tmp_size = (size_t)0; - if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") - *size += tmp_size; - - /* Virtual dataset selection */ - tmp_size = (size_t)0; - if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") - *size += tmp_size; - } /* end for */ - } /* end if */ + else { + /* Size of layout type */ + *size += sizeof(uint8_t); - /* Size of layout type */ - *size += sizeof(uint8_t); + /* If layout is chunked, calculate chunking structure */ + if(H5D_CHUNKED == layout->type) { + *size += sizeof(uint8_t); + *size += layout->u.chunk.ndims * sizeof(uint32_t); + } /* end if */ + else if(H5D_VIRTUAL == layout->type) { + /* Calculate size of virtual layout info */ + /* number of entries */ + *size += (size_t)8; - /* Size of chunk info encoding */ - if(H5D_CHUNKED == layout->type) { - *size += sizeof(uint8_t); - *size += layout->u.chunk.ndims * sizeof(uint32_t); - } /* end if */ + /* NULL pointer to pass to H5S_encode */ + tmp_p = NULL; + + /* Iterate over entries */ + for(u = 0; u < layout->storage.u.virt.list_nused; u++) { + /* Source file name */ + tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; + *size += tmp_size; + + /* Source dataset name */ + tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; + *size += tmp_size; + + /* Source selection */ + tmp_size = (size_t)0; + if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") + *size += tmp_size; + + /* Virtual dataset selection */ + tmp_size = (size_t)0; + if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") + *size += tmp_size; + } /* end for */ + } /* end if */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -743,9 +682,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_layout_del(hid_t H5_ATTR_UNUSED prop_id, - const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, - void *value) +H5P__dcrt_layout_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { herr_t ret_value = SUCCEED; /* Return value */ @@ -755,15 +693,51 @@ H5P__dcrt_layout_del(hid_t H5_ATTR_UNUSED prop_id, HDassert(value); /* Reset the old layout */ - if(((H5O_layout_t *)value)->type == H5D_VIRTUAL) /* Temp hack until proper fix is in trunk */ - if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release layout message") + if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dcrt_layout_del() */ +/*-------------------------------------------------------------------------- + * Function: H5P__dcrt_layout_copy + * + * Purpose: Copy the layout property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Monday, Feb 9, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_layout_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */ + H5O_layout_t new_layout; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(layout); + + /* Make copy of layout */ + if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") + + /* Set new layout message directly into property list */ + *layout = new_layout; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_layout_copy() */ + + /*------------------------------------------------------------------------- * Function: H5P__dcrt_layout_cmp * @@ -781,7 +755,8 @@ done: *------------------------------------------------------------------------- */ static int -H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_UNUSED size) +H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, + size_t H5_ATTR_UNUSED size) { const H5O_layout_t *layout1 = (const H5O_layout_t *)_layout1, /* Create local aliases for values */ *layout2 = (const H5O_layout_t *)_layout2; @@ -894,8 +869,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_layout_close(const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) +H5P__dcrt_layout_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) { herr_t ret_value = SUCCEED; /* Return value */ @@ -905,9 +880,8 @@ H5P__dcrt_layout_close(const char H5_ATTR_UNUSED *name, HDassert(value); /* Reset the old layout */ - if(((H5O_layout_t *)value)->type == H5D_VIRTUAL) /* Temp hack until proper fix is in trunk */ - if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release layout message") + if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") done: FUNC_LEAVE_NOAPI(ret_value) @@ -915,7 +889,83 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__fill_value_enc + * Function: H5P__dcrt_fill_value_set + * + * Purpose: Copies a fill value property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_fill_t *fill = (H5O_fill_t *)value; /* Create local aliases for values */ + H5O_fill_t new_fill; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of fill value */ + if(NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + + /* Copy new fill value message over old one */ + *fill = new_fill; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_get + * + * Purpose: Copies a fill value property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_fill_t *fill = (H5O_fill_t *)value; /* Create local aliases for values */ + H5O_fill_t new_fill; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of fill value */ + if(NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + + /* Copy new fill value message over old one */ + *fill = new_fill; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_enc * * Purpose: Callback routine which is called whenever the fill value * property in the dataset creation property list is @@ -930,14 +980,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fill_value_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) { const H5O_fill_t *fill = (const H5O_fill_t *)value; /* Create local aliases for values */ size_t dt_size = 0; /* Size of encoded datatype */ herr_t ret_value = SUCCEED; /* Return value */ uint8_t **pp = (uint8_t **)_pp; uint64_t enc_value; - unsigned enc_size; + unsigned enc_size = 0; FUNC_ENTER_STATIC @@ -1006,11 +1056,11 @@ H5P__fill_value_enc(const void *value, void **_pp, size_t *size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__fill_value_enc() */ +} /* end H5P__dcrt_fill_value_enc() */ /*------------------------------------------------------------------------- - * Function: H5P__fill_value_dec + * Function: H5P__dcrt_fill_value_dec * * Purpose: Callback routine which is called whenever the fill value * property in the dataset creation property list is @@ -1025,7 +1075,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fill_value_dec(const void **_pp, void *_value) +H5P__dcrt_fill_value_dec(const void **_pp, void *_value) { H5O_fill_t *fill = (H5O_fill_t *)_value; /* Fill value */ const uint8_t **pp = (const uint8_t **)_pp; @@ -1073,7 +1123,77 @@ H5P__fill_value_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__fill_value_dec() */ +} /* end H5P__dcrt_fill_value_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_del + * + * Purpose: Frees memory used to store the fill value property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old fill value message */ + if(H5O_msg_reset(H5O_FILL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_copy + * + * Purpose: Copy the fill value property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_fill_t *fill = (H5O_fill_t *)value; /* Create local aliases for values */ + H5O_fill_t new_fill; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(fill); + + /* Make copy of fill value message */ + if(NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + + /* Set new fill value message directly into property list */ + *fill = new_fill; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_copy() */ /*------------------------------------------------------------------------- @@ -1092,7 +1212,8 @@ done: *------------------------------------------------------------------------- */ int -H5P_fill_value_cmp(const void *_fill1, const void *_fill2, size_t H5_ATTR_UNUSED size) +H5P_fill_value_cmp(const void *_fill1, const void *_fill2, + size_t H5_ATTR_UNUSED size) { const H5O_fill_t *fill1 = (const H5O_fill_t *)_fill1, /* Create local aliases for values */ *fill2 = (const H5O_fill_t *)_fill2; @@ -1138,6 +1259,115 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_close + * + * Purpose: Frees memory used to store the fill value property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old fill value message */ + if(H5O_msg_reset(H5O_FILL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_set + * + * Purpose: Copies an external file list property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_efl_t *efl = (H5O_efl_t *)value; /* Create local aliases for values */ + H5O_efl_t new_efl; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of external file list */ + if(NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + + /* Copy new external file list message over old one */ + *efl = new_efl; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_get + * + * Purpose: Copies an external file lsit property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_efl_t *efl = (H5O_efl_t *)value; /* Create local aliases for values */ + H5O_efl_t new_efl; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of external file list */ + if(NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + + /* Copy new external file list message over old one */ + *efl = new_efl; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_get() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dcrt_ext_file_list_enc * * Purpose: Callback routine which is called whenever the efl @@ -1313,6 +1543,76 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_del + * + * Purpose: Frees memory used to store the efl property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old efl message */ + if(H5O_msg_reset(H5O_EFL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_copy + * + * Purpose: Copy the efl property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thurday, Feb 26, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_efl_t *efl = (H5O_efl_t *)value; /* Create local aliases for values */ + H5O_efl_t new_efl; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(efl); + + /* Make copy of efl message */ + if(NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + + /* Set new efl message directly into property list */ + *efl = new_efl; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_copy() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dcrt_ext_file_list_cmp * * Purpose: Callback routine which is called whenever the external file @@ -1329,7 +1629,8 @@ done: *------------------------------------------------------------------------- */ static int -H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t H5_ATTR_UNUSED size) +H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, + size_t H5_ATTR_UNUSED size) { const H5O_efl_t *efl1 = (const H5O_efl_t *)_efl1, /* Create local aliases for values */ *efl2 = (const H5O_efl_t *)_efl2; @@ -1394,6 +1695,39 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_close + * + * Purpose: Frees memory used to store the efl property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old efl message */ + if(H5O_msg_reset(H5O_EFL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_close() */ + + +/*------------------------------------------------------------------------- * Function: H5P__set_layout * * Purpose: Sets the layout of raw data in the file. @@ -1408,7 +1742,6 @@ done: static herr_t H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) { - H5O_layout_t old_layout; /* Layout propertry already on list */ unsigned alloc_time_state; /* State of allocation time property */ herr_t ret_value = SUCCEED; /* return value */ @@ -1420,10 +1753,10 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) /* If we still have the "default" allocation time, change it according to the new layout */ if(alloc_time_state) { - H5O_fill_t fill; /* Fill value */ + H5O_fill_t fill; /* Fill value */ /* Get current fill value info */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Set the default based on layout */ @@ -1437,9 +1770,6 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) break; case H5D_CHUNKED: - fill.alloc_time = H5D_ALLOC_TIME_INCR; - break; - case H5D_VIRTUAL: fill.alloc_time = H5D_ALLOC_TIME_INCR; break; @@ -1451,18 +1781,10 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) } /* end switch */ /* Set updated fill value info */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time") } /* end if */ - /* Get the old layout */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &old_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") - - /* Reset the old layout before overwriting it */ - if(H5O_msg_reset(H5O_LAYOUT_ID, &old_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release layout message") - /* Set layout value */ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout") @@ -1627,8 +1949,8 @@ H5Pget_layout(hid_t plist_id) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID") - /* Get layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + /* Peek at layout property */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout") /* Set return value */ @@ -1759,8 +2081,8 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Retrieve the layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + /* Peek at the layout property */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") if(H5D_CHUNKED != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout") @@ -1805,15 +2127,15 @@ herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const char *src_dset_name, hid_t src_space_id) { - H5P_genplist_t *plist; /* Property list pointer */ - H5O_layout_t layout; /* Layout information for setting chunk info */ - H5S_t *vspace; /* Virtual dataset space selection */ - H5S_t *src_space; /* Source dataset space selection */ - hbool_t new_layout = FALSE; /* Whether we are adding a new virtual layout message to plist */ - H5O_storage_virtual_ent_t *ent = NULL; /* Convenience pointer to new VDS entry */ - hbool_t adding_entry = FALSE; /* Whether we are in the middle of adding an entry */ + H5P_genplist_t *plist; /* Property list pointer */ + H5O_layout_t virtual_layout; /* Layout information for setting virtual info */ + H5S_t *vspace; /* Virtual dataset space selection */ + H5S_t *src_space; /* Source dataset space selection */ H5O_storage_virtual_ent_t *old_list = NULL; /* List pointer previously on property list */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_storage_virtual_ent_t *ent = NULL; /* Convenience pointer to new VDS entry */ + hbool_t adding_entry = FALSE; /* Whether we are in the middle of adding an entry */ + hbool_t free_list = FALSE; /* Whether to free the list of virtual entries */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*s*si", dcpl_id, vspace_id, src_file_name, src_dset_name, @@ -1821,17 +2143,17 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, /* Check arguments */ if(!src_file_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source file name not provided") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "source file name not provided") if(!src_dset_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "source dataset name not provided") + HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "source dataset name not provided") if(NULL == (vspace = (H5S_t *)H5I_object_verify(vspace_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace") if(NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace") /* Check selections for validity */ if(H5D_virtual_check_mapping_pre(vspace, src_space, H5O_VIRTUAL_STATUS_USER) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid mapping selections") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "invalid mapping selections") #ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER /* If the compiler doesn't support C99 designated initializers, check if @@ -1847,41 +2169,41 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the current layout */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") /* If the layout was not already virtual, Start with default virtual layout. * Otherwise, add the mapping to the current list. */ - if(layout.type == H5D_VIRTUAL) + if(virtual_layout.type == H5D_VIRTUAL) /* Save old list pointer for error recovery */ - old_list = layout.storage.u.virt.list; + old_list = virtual_layout.storage.u.virt.list; else { - new_layout = TRUE; - HDmemcpy(&layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g)); + /* Reset the old layout */ + if(H5O_msg_reset(H5O_LAYOUT_ID, &virtual_layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") + + /* Copy the default virtual layout */ + HDmemcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g)); - HDassert(layout.storage.u.virt.list_nalloc == 0); + /* Sanity check */ + HDassert(virtual_layout.storage.u.virt.list_nalloc == 0); } /* end else */ /* Expand list if necessary */ - if(layout.storage.u.virt.list_nalloc == 0) { - /* Allocate initial entry list */ - if(NULL == (layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc(H5D_VIRTUAL_DEF_LIST_SIZE * sizeof(H5O_storage_virtual_ent_t)))) - HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't allocate virtual dataset mapping list") - adding_entry = TRUE; - layout.storage.u.virt.list_nalloc = H5D_VIRTUAL_DEF_LIST_SIZE; - } /* end if */ - else if(layout.storage.u.virt.list_nused - == layout.storage.u.virt.list_nalloc) { - /* Double size of entry list. Make sure to zero out new memory. */ - if(NULL == (layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_realloc(layout.storage.u.virt.list, (size_t)2 * layout.storage.u.virt.list_nalloc * sizeof(H5O_storage_virtual_ent_t)))) + if(virtual_layout.storage.u.virt.list_nused == virtual_layout.storage.u.virt.list_nalloc) { + H5O_storage_virtual_ent_t *x; /* Pointer to the new list */ + size_t new_alloc = MAX(H5D_VIRTUAL_DEF_LIST_SIZE, virtual_layout.storage.u.virt.list_nalloc * 2); + + /* Expand size of entry list */ + if(NULL == (x = (H5O_storage_virtual_ent_t *)H5MM_realloc(virtual_layout.storage.u.virt.list, new_alloc * sizeof(H5O_storage_virtual_ent_t)))) HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't reallocate virtual dataset mapping list") - adding_entry = TRUE; - (void)HDmemset(layout.storage.u.virt.list + layout.storage.u.virt.list_nalloc, 0, layout.storage.u.virt.list_nalloc * sizeof(H5O_storage_virtual_ent_t)); - layout.storage.u.virt.list_nalloc *= (size_t)2; + virtual_layout.storage.u.virt.list = x; + virtual_layout.storage.u.virt.list_nalloc = new_alloc; } /* end if */ /* Add virtual dataset mapping entry */ - ent = &layout.storage.u.virt.list[layout.storage.u.virt.list_nused]; + ent = &virtual_layout.storage.u.virt.list[virtual_layout.storage.u.virt.list_nused]; + HDmemset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */ if(NULL == (ent->source_dset.virtual_select = H5S_copy(vspace, FALSE, TRUE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") adding_entry = TRUE; @@ -1923,59 +2245,42 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid mapping entry") /* Update min_dims */ - if(H5D_virtual_update_min_dims(&layout, layout.storage.u.virt.list_nused) < 0) + if(H5D_virtual_update_min_dims(&virtual_layout, virtual_layout.storage.u.virt.list_nused) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to update virtual dataset minimum dimensions") /* Finish adding entry */ - layout.storage.u.virt.list_nused++; + virtual_layout.storage.u.virt.list_nused++; + + /* Set VDS layout information in property list */ + if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0) { + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") + if(old_list != virtual_layout.storage.u.virt.list) + free_list = TRUE; + } /* end if */ done: - /* Only need to do things if we started to add an entry */ - if(adding_entry) { - hbool_t free_list = FALSE; - - /* Set VDS layout information in property list. If we are adding a new - * layout, use H5P__set_layout so other fields are initialized properly. - * If we are extending the layout, just use H5P_set directly so we don't - * mess with anything else. Put this after the done: label because the - * original list may no longer be valid due to the use of realloc(), so - * we want to make sure the list is available if possible. */ - if(new_layout) { - if(H5P__set_layout(plist, &layout) < 0) { - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") - free_list = TRUE; - } /* end if */ + /* Check if the entry has been partly allocated but not added to the + * property list or not included in list_nused */ + if(ret_value < 0) { + /* Free incomplete entry if present */ + if(ent) { + ent->source_file_name = (char *)H5MM_xfree(ent->source_file_name); + ent->source_dset_name = (char *)H5MM_xfree(ent->source_dset_name); + if(ent->source_dset.virtual_select && H5S_close(ent->source_dset.virtual_select) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection") + ent->source_dset.virtual_select = NULL; + if(ent->source_select && H5S_close(ent->source_select) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") + ent->source_select = NULL; + H5D_virtual_free_parsed_name(ent->parsed_source_file_name); + ent->parsed_source_file_name = NULL; + H5D_virtual_free_parsed_name(ent->parsed_source_dset_name); + ent->parsed_source_dset_name = NULL; } /* end if */ - else - if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) { - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") - if(old_list != layout.storage.u.virt.list) - free_list = TRUE; - } /* end if */ - /* Check if the entry has been partly allocated but not added to the - * property list or not included in list_nused */ - if(ret_value < 0) { - /* Free incomplete entry if present */ - if(ent) { - ent->source_file_name = (char *)H5MM_xfree(ent->source_file_name); - ent->source_dset_name = (char *)H5MM_xfree(ent->source_dset_name); - if(ent->source_dset.virtual_select && H5S_close(ent->source_dset.virtual_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection") - ent->source_dset.virtual_select = NULL; - if(ent->source_select && H5S_close(ent->source_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") - ent->source_select = NULL; - H5D_virtual_free_parsed_name(ent->parsed_source_file_name); - ent->parsed_source_file_name = NULL; - H5D_virtual_free_parsed_name(ent->parsed_source_dset_name); - ent->parsed_source_dset_name = NULL; - } /* end if */ - - /* Free list if necessary */ - if(free_list) - layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_xfree(layout.storage.u.virt.list); - } /* end if */ + /* Free list if necessary */ + if(free_list) + virtual_layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_xfree(virtual_layout.storage.u.virt.list); } /* end if */ FUNC_LEAVE_API(ret_value) @@ -2012,7 +2317,7 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve the layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") if(H5D_VIRTUAL != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") @@ -2058,7 +2363,7 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t index) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve the layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") if(H5D_VIRTUAL != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") @@ -2106,7 +2411,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index) H5P_genplist_t *plist; /* Property list pointer */ H5O_layout_t layout; /* Layout information */ H5S_t *space = NULL; /* Dataspace pointer */ - hid_t ret_value; /* Return value */ + hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("i", "iz", dcpl_id, index); @@ -2116,7 +2421,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve the layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") if(H5D_VIRTUAL != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") @@ -2130,8 +2435,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index) * H5O_VIRTUAL_STATUS_CORRECT? -NAF */ /* If source space status is H5O_VIRTUAL_STATUS_INVALID, patch with bounds * of selection */ - if((layout.storage.u.virt.list[index].source_space_status - == H5O_VIRTUAL_STATUS_INVALID) + if((H5O_VIRTUAL_STATUS_INVALID == layout.storage.u.virt.list[index].source_space_status) && (layout.storage.u.virt.list[index].unlim_dim_source < 0)) { hsize_t bounds_start[H5S_MAX_RANK]; hsize_t bounds_end[H5S_MAX_RANK]; @@ -2221,7 +2525,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve the layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") if(H5D_VIRTUAL != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") @@ -2284,7 +2588,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve the layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") if(H5D_VIRTUAL != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") @@ -2348,7 +2652,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") if(efl.nused > 0 && H5O_EFL_UNLIMITED == efl.slot[efl.nused - 1].size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited") @@ -2361,7 +2665,6 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) } /* end for */ } /* end if */ - /* Add to the list */ if(efl.nused >= efl.nalloc) { size_t na = efl.nalloc + H5O_EFL_ALLOC; @@ -2379,7 +2682,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) efl.slot[idx].size = size; efl.nused++; - if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") done: @@ -2423,7 +2726,7 @@ H5Pget_external_count(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") /* Set return value */ @@ -2481,7 +2784,7 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out* HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") if(idx >= efl.nused) @@ -2560,11 +2863,11 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) cd_values[1]=pixels_per_block; /* Add the filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SZIP, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2607,11 +2910,11 @@ H5Pset_shuffle(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SHUFFLE, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2653,11 +2956,11 @@ H5Pset_nbit(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the nbit filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_NBIT, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2732,11 +3035,11 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac cd_values[1] = (unsigned)scale_factor; /* Add the scaleoffset filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SCALEOFFSET, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2776,7 +3079,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the current fill value */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Release the dynamic fill value components */ @@ -2826,7 +3129,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) fill.size = (-1); /* Update fill value in property list */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value") done: @@ -2870,7 +3173,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/, * datatype conversion might not have resulted in zero. If fill value * is undefined, also return error. */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") if(fill.size == -1) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined") @@ -2882,8 +3185,8 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/, } /* end if */ /* - * Can we convert between the source and destination datatypes? - */ + * Can we convert between the source and destination datatypes? + */ if(NULL == (tpath = H5T_path_find(fill.type, type, NULL, NULL, dxpl_id, FALSE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill.type, H5T_COPY_TRANSIENT), FALSE)) < 0) @@ -3038,7 +3341,7 @@ H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status) HDassert(status); /* Get the fill value struct */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Get the fill-value status */ @@ -3126,8 +3429,8 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) if(alloc_time == H5D_ALLOC_TIME_DEFAULT) { H5O_layout_t layout; /* Type of storage layout */ - /* Retrieve the storage layout */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + /* Peek at the storage layout */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") /* Set the default based on layout */ @@ -3162,14 +3465,14 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) alloc_time_state = 0; /* Retrieve previous fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Update property value */ fill.alloc_time = alloc_time; /* Set values */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") if(H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time") @@ -3211,7 +3514,7 @@ H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Set user's value */ @@ -3255,14 +3558,14 @@ H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve previous fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Update property value */ fill.fill_time = fill_time; /* Set values */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") done: @@ -3304,7 +3607,7 @@ H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Set user's value */ diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index e4e91ac..ecf2bea 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P__init_deprec_interface +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -82,51 +79,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5P__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5P__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5P_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5P__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5P__term_deprec_interface -- Terminate interface -USAGE - herr_t H5P__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5P__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5P__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 980b001..9ab3580 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -152,6 +153,8 @@ /* Definitions for data transform property */ #define H5D_XFER_XFORM_SIZE sizeof(void *) #define H5D_XFER_XFORM_DEF NULL +#define H5D_XFER_XFORM_SET H5P__dxfr_xform_set +#define H5D_XFER_XFORM_GET H5P__dxfr_xform_get #define H5D_XFER_XFORM_ENC H5P__dxfr_xform_enc #define H5D_XFER_XFORM_DEC H5P__dxfr_xform_dec #define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del @@ -203,6 +206,8 @@ static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, si static herr_t H5P__dxfr_mpio_chunk_opt_hard_dec(const void **pp, void *value); static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_edc_dec(const void **pp, void *value); +static herr_t H5P__dxfr_xform_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dxfr_xform_get(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_xform_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); @@ -443,7 +448,7 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) /* Register the data transform property */ if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, - NULL, NULL, NULL, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, + NULL, H5D_XFER_XFORM_SET, H5D_XFER_XFORM_GET, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -651,6 +656,72 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_set + * + * Purpose: Copies a data transform property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_xform_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + 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_CANTCOPY, FAIL, "error copying the data transform info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_xform_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_get + * + * Purpose: Copies a data transform property when it's retrieved for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_xform_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + 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_CANTCOPY, FAIL, "error copying the data transform info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_xform_get() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dxfr_xform_enc * * Purpose: Callback routine which is called whenever the data transform @@ -827,10 +898,12 @@ 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") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -953,7 +1026,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* See if a data transform is already set, and free it if it is */ - if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) + if(H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") /* Destroy previous data transform property */ @@ -964,15 +1037,14 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) if(NULL == (data_xform_prop = H5Z_xform_create(expression))) HGOTO_ERROR(H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info") - /* Update property list */ - if(H5P_set(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) + /* Update property list (takes ownership of transform) */ + if(H5P_poke(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression") 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() */ @@ -1016,7 +1088,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) + if(H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") if(NULL == data_xform_prop) @@ -1026,6 +1098,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)); @@ -1036,11 +1109,6 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) ret_value = (ssize_t)len; done: - 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 H5Pget_data_transform() */ diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index bd0a260..1bcd19c 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -22,12 +22,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -#ifdef NOT_YET -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_encdec_interface -#endif /* NOT_YET */ +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -82,29 +77,6 @@ typedef struct { /*******************/ -#ifdef NOT_YET - -/*-------------------------------------------------------------------------- -NAME - H5P_init_encdec_interface -- Initialize interface-specific information -USAGE - herr_t H5P_init_encdec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5P_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5P_init_encdec_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P_init_encdec_interface() */ -#endif /* NOT_YET */ - /*------------------------------------------------------------------------- * Function: H5P__encode_size_t @@ -737,7 +709,7 @@ H5P__decode(const void *buf) hid_t plist_id = -1; /* ID of new property list */ size_t value_buf_size = 0; /* Size of current value buffer */ uint8_t vers; /* Version of encoded property list */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE @@ -793,10 +765,10 @@ H5P__decode(const void *buf) HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "property decoding routine failed, property: '%s'", name) } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s', name") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s'", name) /* Set the value for the property */ - if(H5P_set(plist, name, value_buf) < 0) + if(H5P_poke(plist, name, value_buf) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value for property: '%s'", name) } /* end while */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 6b3d4ac..319dc77 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -110,12 +111,16 @@ #define H5F_ACS_GARBG_COLCT_REF_DEF 0 #define H5F_ACS_GARBG_COLCT_REF_ENC H5P__encode_unsigned #define H5F_ACS_GARBG_COLCT_REF_DEC H5P__decode_unsigned -/* Definition for file driver ID */ -#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t) -#define H5F_ACS_FILE_DRV_ID_DEF H5_DEFAULT_VFD -/* Definition for file driver info */ -#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*) -#define H5F_ACS_FILE_DRV_INFO_DEF NULL +/* Definition for file driver ID & info*/ +#define H5F_ACS_FILE_DRV_SIZE sizeof(H5FD_driver_prop_t) +#define H5F_ACS_FILE_DRV_DEF {H5_DEFAULT_VFD, NULL} +#define H5F_ACS_FILE_DRV_CRT H5P__facc_file_driver_create +#define H5F_ACS_FILE_DRV_SET H5P__facc_file_driver_set +#define H5F_ACS_FILE_DRV_GET H5P__facc_file_driver_get +#define H5F_ACS_FILE_DRV_DEL H5P__facc_file_driver_del +#define H5F_ACS_FILE_DRV_COPY H5P__facc_file_driver_copy +#define H5F_ACS_FILE_DRV_CMP H5P__facc_file_driver_cmp +#define H5F_ACS_FILE_DRV_CLOSE H5P__facc_file_driver_close /* Definition for file close degree */ #define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) #define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT @@ -157,9 +162,12 @@ /* Definition of pointer to initial file image info */ #define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t) #define H5F_ACS_FILE_IMAGE_INFO_DEF H5FD_DEFAULT_FILE_IMAGE_INFO -#define H5F_ACS_FILE_IMAGE_INFO_DEL H5P_file_image_info_del -#define H5F_ACS_FILE_IMAGE_INFO_COPY H5P_file_image_info_copy -#define H5F_ACS_FILE_IMAGE_INFO_CLOSE H5P_file_image_info_close +#define H5F_ACS_FILE_IMAGE_INFO_SET H5P__facc_file_image_info_set +#define H5F_ACS_FILE_IMAGE_INFO_GET H5P__facc_file_image_info_get +#define H5F_ACS_FILE_IMAGE_INFO_DEL H5P__facc_file_image_info_del +#define H5F_ACS_FILE_IMAGE_INFO_COPY H5P__facc_file_image_info_copy +#define H5F_ACS_FILE_IMAGE_INFO_CMP H5P__facc_file_image_info_cmp +#define H5F_ACS_FILE_IMAGE_INFO_CLOSE H5P__facc_file_image_info_close /* Definition of core VFD write tracking flag */ #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE sizeof(hbool_t) #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF FALSE @@ -186,14 +194,26 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_facc_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P_facc_create(hid_t fapl_id, void *copy_data); -static herr_t H5P_facc_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); +static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass); + +/* File driver ID & info property callbacks */ +static herr_t H5P__facc_file_driver_create(const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_copy(const char *name, size_t size, void *value); +static int H5P__facc_file_driver_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_file_driver_close(const char *name, size_t size, void *value); /* File image info property callbacks */ -static herr_t H5P_file_image_info_del(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P_file_image_info_copy(const char *name, size_t size, void *value); -static herr_t H5P_file_image_info_close(const char *name, size_t size, void *value); +static herr_t H5P__file_image_info_copy(void *value); +static herr_t H5P__file_image_info_free(void *value); +static herr_t H5P__facc_file_image_info_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_image_info_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_image_info_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_image_info_copy(const char *name, size_t size, void *value); +static int H5P__facc_file_image_info_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_file_image_info_close(const char *name, size_t size, void *value); /* encode & decode callbacks */ static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size); @@ -218,13 +238,13 @@ const H5P_libclass_t H5P_CLS_FACC[1] = {{ &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P_facc_reg_prop, /* Default property registration routine */ + H5P__facc_reg_prop, /* Default property registration routine */ - H5P_facc_create, /* Class creation callback */ + NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P_facc_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P_facc_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -249,7 +269,6 @@ static const hsize_t H5F_def_meta_block_size_g = H5F_ACS_META_BLOCK_SIZE_DEF; static const size_t H5F_def_sieve_buf_size_g = H5F_ACS_SIEVE_BUF_SIZE_DEF; /* Default raw data I/O sieve buffer size */ static const hsize_t H5F_def_sdata_block_size_g = H5F_ACS_SDATA_BLOCK_SIZE_DEF; /* Default small data allocation block size */ static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF; /* Default garbage collection for references setting */ -static const void *H5F_def_driver_info_g = H5F_ACS_FILE_DRV_INFO_DEF; /* Default VFL driver info */ static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */ static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */ static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */ @@ -262,9 +281,10 @@ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMA static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ + /*------------------------------------------------------------------------- - * Function: H5P_facc_reg_prop + * Function: H5P__facc_reg_prop * * Purpose: Register the file access property list class's properties * @@ -275,12 +295,12 @@ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE *------------------------------------------------------------------------- */ static herr_t -H5P_facc_reg_prop(H5P_genclass_t *pclass) +H5P__facc_reg_prop(H5P_genclass_t *pclass) { - const hid_t def_driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID (initialized from a variable) */ + const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, @@ -342,16 +362,11 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the file driver ID */ + /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &def_driver_id, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file driver info */ - /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &H5F_def_driver_info_g, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, + H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ @@ -406,8 +421,8 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, - NULL, NULL, NULL, NULL, NULL, - H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, NULL, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) + NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, + H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ @@ -424,159 +439,7 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_reg_prop() */ - - -/*---------------------------------------------------------------------------- - * Function: H5P_facc_create - * - * Purpose: Callback routine which is called whenever a file access - * property list is closed. This routine performs any generic - * initialization needed on the properties the library put into - * the list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - *---------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_facc_create(hid_t fapl_id, void H5_ATTR_UNUSED *copy_data) -{ - hid_t driver_id; - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Check argument */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Retrieve driver ID property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") - - if(driver_id > 0) { - void *driver_info; - - /* Retrieve driver info property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver info") - - /* Set the driver for the property list */ - if(H5FD_fapl_open(plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_create() */ - - -/*-------------------------------------------------------------------------- - * Function: H5P_facc_copy - * - * Purpose: Callback routine which is called whenever a file access - * property list is copied. This routine performs any generic - * copy needed on the properties. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - *-------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_facc_copy(hid_t dst_fapl_id, hid_t src_fapl_id, void H5_ATTR_UNUSED *copy_data) -{ - hid_t driver_id; - H5P_genplist_t *src_plist; /* Source property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Get driver ID from source property list */ - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(H5P_get(src_plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") - - if(driver_id > 0) { - H5P_genplist_t *dst_plist; /* Destination property list */ - void *driver_info; - - /* Get driver info from source property list */ - if(H5P_get(src_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver info") - - /* Set the driver for the destination property list */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(H5FD_fapl_open(dst_plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_copy() */ - - -/*-------------------------------------------------------------------------- - * Function: H5P_facc_close - * - * Purpose: Callback routine which is called whenever a file access - * property list is closed. This routine performs any generic - * cleanup needed on the properties. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - *--------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5P_facc_close(hid_t fapl_id, void H5_ATTR_UNUSED *close_data) -{ - hid_t driver_id; - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Check argument */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Get driver ID property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - - if(driver_id > 0) { - void *driver_info; - - /* Get driver info property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - - /* Close the driver for the property list */ - if(H5FD_fapl_close(driver_id, driver_info) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_close() */ +} /* end H5P__facc_reg_prop() */ /*------------------------------------------------------------------------- @@ -700,9 +563,7 @@ done: herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info) { - hid_t driver_id; /* VFL driver ID */ - void *driver_info; /* VFL driver info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -710,19 +571,15 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - /* Get the current driver information */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info") + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ - /* Close the driver for the property list */ - if(H5FD_fapl_close(driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver") + /* Prepare the driver property */ + driver_prop.driver_id = new_driver_id; + driver_prop.driver_info = new_driver_info; - /* Set the driver for the property list */ - if(H5FD_fapl_open(plist, new_driver_id, new_driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") + /* Set the driver ID & info property */ + if(H5P_set(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID & info") } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") @@ -776,7 +633,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_driver + * Function: H5P_peek_driver * * Purpose: Return the ID of the low-level file driver. PLIST_ID should * be a file access property list. @@ -794,7 +651,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5P_get_driver(H5P_genplist_t *plist) +H5P_peek_driver(H5P_genplist_t *plist) { hid_t ret_value = FAIL; /* Return value */ @@ -802,18 +659,21 @@ H5P_get_driver(H5P_genplist_t *plist) /* Get the current driver ID */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0) + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") + ret_value = driver_prop.driver_id; } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list") if(H5FD_VFD_DEFAULT == ret_value) ret_value = H5_DEFAULT_VFD; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_driver() */ +} /* end H5P_peek_driver() */ /*------------------------------------------------------------------------- @@ -822,6 +682,8 @@ done: * 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 @@ -847,7 +709,7 @@ H5Pget_driver(hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get the driver */ - if((ret_value = H5P_get_driver(plist)) < 0) + if((ret_value = H5P_peek_driver(plist)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver") done: @@ -856,7 +718,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_driver_info + * Function: H5P_peek_driver_info * * Purpose: Returns a pointer directly to the file driver-specific * information of a file access. @@ -874,8 +736,8 @@ done: * *------------------------------------------------------------------------- */ -void * -H5P_get_driver_info(H5P_genplist_t *plist) +const void * +H5P_peek_driver_info(H5P_genplist_t *plist) { void *ret_value = NULL; /* Return value */ @@ -883,15 +745,18 @@ H5P_get_driver_info(H5P_genplist_t *plist) /* Get the current driver info */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0) + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") + ret_value = (void *)driver_prop.driver_info; } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_driver_info() */ +} /* end H5P_peek_driver_info() */ /*------------------------------------------------------------------------- @@ -926,7 +791,7 @@ H5Pget_driver_info(hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") /* Get the driver info */ - if(NULL == (ret_value = H5P_get_driver_info(plist))) + if(NULL == (ret_value = (void *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") done: @@ -935,6 +800,365 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__file_driver_copy + * + * Purpose: Copy file driver ID & info. + * + * Note: This is an "in-place" copy, since this routine gets called + * after the top-level copy has been performed and this routine + * finishes the "deep" part of the copy. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__file_driver_copy(void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(value) { + H5FD_driver_prop_t *info = (H5FD_driver_prop_t *)value; /* Driver ID & info struct */ + + /* Copy the driver & info, if there is one */ + if(info->driver_id > 0) { + /* Increment the reference count on driver and copy driver info */ + if(H5I_inc_ref(info->driver_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") + + /* Copy driver info, if it exists */ + if(info->driver_info) { + H5FD_class_t *driver; /* Pointer to driver */ + void *new_pl; /* Copy of driver info */ + + /* Retrieve the driver for the ID */ + if(NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID") + + /* Allow the driver to copy or do it ourselves */ + if(driver->fapl_copy) { + if(NULL == (new_pl = (driver->fapl_copy)(info->driver_info))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed") + } /* end if */ + else if(driver->fapl_size > 0) { + if(NULL == (new_pl = H5MM_malloc(driver->fapl_size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") + HDmemcpy(new_pl, info->driver_info, driver->fapl_size); + } /* end else-if */ + else + HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") + + /* Set the driver info for the copy */ + info->driver_info = new_pl; + } /* end if */ + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__file_driver_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__file_driver_free + * + * Purpose: Free file driver ID & info. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__file_driver_free(void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(value) { + H5FD_driver_prop_t *info = (H5FD_driver_prop_t *)value; /* Driver ID & info struct */ + + /* Copy the driver & info, if there is one */ + if(info->driver_id > 0) { + if(info->driver_info) { + H5FD_class_t *driver; /* Pointer to driver */ + + /* Retrieve the driver for the ID */ + if(NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID") + + /* Allow driver to free info or do it ourselves */ + if(driver->fapl_free) { + if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") + } /* end if */ + else + H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ + } /* end if */ + + /* Decrement reference count for driver */ + if(H5I_dec_ref(info->driver_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__file_driver_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_create + * + * Purpose: Create callback for the file driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of file driver */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_set + * + * Purpose: Copies a file driver property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 7, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file driver ID & info */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_get + * + * Purpose: Copies a file driver property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 7, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file driver */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_del + * + * Purpose: Frees memory used to store the driver ID & info property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file driver ID & info */ + if(H5P__file_driver_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_copy + * + * Purpose: Copy callback for the file driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of file driver */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_cmp + * + * Purpose: Callback routine which is called whenever the file driver ID & info + * property in the file access property list is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, + size_t H5_ATTR_UNUSED size) +{ + const H5FD_driver_prop_t *info1 = (const H5FD_driver_prop_t *)_info1, /* Create local aliases for values */ + *info2 = (const H5FD_driver_prop_t *)_info2; + H5FD_class_t *cls1, *cls2; /* Driver class for each property */ + int cmp_value; /* Value from comparison */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(info1); + HDassert(info2); + HDassert(size == sizeof(H5FD_driver_prop_t)); + + /* Compare drivers */ + if(NULL == (cls1 = H5FD_get_class(info1->driver_id))) + HGOTO_DONE(-1) + if(NULL == (cls2 = H5FD_get_class(info2->driver_id))) + HGOTO_DONE(1) + if(cls1->name == NULL && cls2->name != NULL) HGOTO_DONE(-1); + if(cls1->name != NULL && cls2->name == NULL) HGOTO_DONE(1); + if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(cmp_value); + + /* Compare driver infos */ + if(cls1->fapl_size < cls2->fapl_size) HGOTO_DONE(-1) + if(cls1->fapl_size > cls2->fapl_size) HGOTO_DONE(1) + HDassert(cls1->fapl_size == cls2->fapl_size); + if(info1->driver_info == NULL && info2->driver_info != NULL) HGOTO_DONE(-1); + if(info1->driver_info != NULL && info2->driver_info == NULL) HGOTO_DONE(1); + if(info1->driver_info) { + HDassert(cls1->fapl_size > 0); + if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) + HGOTO_DONE(cmp_value); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_close + * + * Purpose: Close callback for the file driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file driver */ + if(H5P__file_driver_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_close() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_family_offset * * Purpose: Set offset for family driver. This file access property @@ -2007,7 +2231,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get old image info */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image pointer") /* Release previous buffer, if it exists */ @@ -2048,7 +2272,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) image_info.size = buf_len; /* Set values */ - if(H5P_set(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) + if(H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info") done: @@ -2100,7 +2324,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get values */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ @@ -2176,7 +2400,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get old info */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") /* verify file image field consistancy */ @@ -2214,7 +2438,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback } /* end if */ /* Set values */ - if(H5P_set(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) + if(H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info") done: @@ -2252,7 +2476,7 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get old info */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ @@ -2279,80 +2503,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_file_image_info_del - * - * Purpose: Delete callback for the file image info property, called - * when the property is deleted from the plist. The buffer - * and udata may need to be freed, possibly using their - * respective callbacks so the default free won't work. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P_file_image_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) -{ - H5FD_file_image_info_t info; /* Image info struct */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - if(value) { - info = *(H5FD_file_image_info_t *)value; - - /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || - ((info.buffer == NULL) && (info.size == 0))); - - if(info.buffer && info.size > 0) { - /* Free buffer */ - if(info.callbacks.image_free) { - if(info.callbacks.image_free(info.buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed") - } /* end if */ - else - HDfree(info.buffer); - } /* end if */ - - /* Free udata if it exists */ - if(info.callbacks.udata) { - if(NULL == info.callbacks.udata_free) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined") - - if(info.callbacks.udata_free(info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") - } /* end if */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_file_image_info_del() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_file_image_info_copy + * Function: H5P__file_image_info_copy * - * Purpose: Copy callback for the file image info property. The buffer + * Purpose: Copy file image info. The buffer * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * - * Return: Non-negative on success/Negative on failure + * Note: This is an "in-place" copy, since this routine gets called + * after the top-level copy has been performed and this routine + * finishes the "deep" part of the copy. * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 * *------------------------------------------------------------------------- */ static herr_t -H5P_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__file_image_info_copy(void *value) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(value) { H5FD_file_image_info_t *info; /* Image info struct */ @@ -2373,19 +2547,18 @@ H5P_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED if(info->callbacks.image_malloc) { if(NULL == (info->buffer = info->callbacks.image_malloc(info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "image malloc callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "image malloc callback failed") } /* end if */ else { if(NULL == (info->buffer = H5MM_malloc(info->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ /* Copy data to new buffer */ if(info->callbacks.image_memcpy) { if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, - info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, - info->callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ else HDmemcpy(info->buffer, old_buffer, info->size); @@ -2396,50 +2569,53 @@ H5P_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED void *old_udata = info->callbacks.udata; if(NULL == info->callbacks.udata_copy) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_copy not defined") info->callbacks.udata = info->callbacks.udata_copy(old_udata); } /* end if */ - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_file_image_info_copy() */ +} /* end H5P__file_image_info_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_file_image_info_close + * Function: H5P__file_image_info_free * - * Purpose: Close callback for the file image info property. The buffer - * and udata may need to be freed, possibly using their - * respective callbacks so the standard free won't work. + * Purpose: Free file image info. The buffer and udata may need to be + * freed, possibly using their respective callbacks, so the + * default free won't work. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 * *------------------------------------------------------------------------- */ static herr_t -H5P_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__file_image_info_free(void *value) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(value) { H5FD_file_image_info_t *info; /* Image info struct */ info = (H5FD_file_image_info_t *)value; + /* Verify file image field consistancy */ + HDassert(((info->buffer != NULL) && (info->size > 0)) || + ((info->buffer == NULL) && (info->size == 0))); + + /* Free buffer */ if(info->buffer != NULL && info->size > 0) { - /* Free buffer */ if(info->callbacks.image_free) { - if(info->callbacks.image_free(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, - info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed") + if((*info->callbacks.image_free)(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info->callbacks.udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") } /* end if */ else H5MM_xfree(info->buffer); @@ -2448,15 +2624,231 @@ H5P_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED /* Free udata if it exists */ if(info->callbacks.udata) { if(NULL == info->callbacks.udata_free) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined") - if(info->callbacks.udata_free(info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_free not defined") + if((*info->callbacks.udata_free)(info->callbacks.udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "udata_free callback failed") } /* end if */ } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_file_image_info_close() */ +} /* end H5P__file_image_info_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_set + * + * Purpose: Copies a file image property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file image info */ + if(H5P__file_image_info_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_get + * + * Purpose: Copies a file image property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file image info */ + if(H5P__file_image_info_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_del + * + * Purpose: Delete callback for the file image info property, called + * when the property is deleted from the plist. The buffer + * and udata may need to be freed, possibly using their + * respective callbacks so the default free won't work. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Jacob Gruber + * Thurday, August 11, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file image info */ + if(H5P__file_image_info_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_copy + * + * Purpose: Copy callback for the file image info property. The buffer + * and udata may need to be copied, possibly using their + * respective callbacks so the default copy won't work. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Jacob Gruber + * Thurday, August 11, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of file image info */ + if(H5P__file_image_info_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_cmp + * + * Purpose: Callback routine which is called whenever the file image info + * property in the file access property list is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Thursday, September 3, 2015 + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_file_image_info_cmp(const void *_info1, const void *_info2, + size_t H5_ATTR_UNUSED size) +{ + const H5FD_file_image_info_t *info1 = (const H5FD_file_image_info_t *)_info1, /* Create local aliases for values */ + *info2 = (const H5FD_file_image_info_t *)_info2; + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(info1); + HDassert(info2); + HDassert(size == sizeof(H5FD_file_image_info_t)); + + /* Check for different buffer sizes */ + if(info1->size < info2->size) HGOTO_DONE(-1) + if(info1->size > info2->size) HGOTO_DONE(1) + + /* Check for different callbacks */ + /* (Order in memory is fairly meaningless, so just check for equality) */ + if(info1->callbacks.image_malloc != info2->callbacks.image_malloc) HGOTO_DONE(1) + if(info1->callbacks.image_memcpy != info2->callbacks.image_memcpy) HGOTO_DONE(-1) + if(info1->callbacks.image_realloc != info2->callbacks.image_realloc) HGOTO_DONE(1) + if(info1->callbacks.image_free != info2->callbacks.image_free) HGOTO_DONE(-1) + if(info1->callbacks.udata_copy != info2->callbacks.udata_copy) HGOTO_DONE(1) + if(info1->callbacks.udata_free != info2->callbacks.udata_free) HGOTO_DONE(-1) + + /* Check for different udata */ + /* (Don't know how big it is, so can't check contents) */ + if(info1->callbacks.udata < info2->callbacks.udata) HGOTO_DONE(-1) + if(info1->callbacks.udata > info2->callbacks.udata) HGOTO_DONE(1) + + /* Check buffer contents (instead of buffer pointers) */ + if(info1->buffer != NULL && info2->buffer == NULL) HGOTO_DONE(-1) + if(info1->buffer == NULL && info2->buffer != NULL) HGOTO_DONE(1) + if(info1->buffer != NULL && info2->buffer != NULL) + ret_value = HDmemcmp(info1->buffer, info2->buffer, size); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_close + * + * Purpose: Close callback for the file image info property. The buffer + * and udata may need to be freed, possibly using their + * respective callbacks so the standard free won't work. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Jacob Gruber + * Thurday, August 11, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file image info */ + if(H5P__file_image_info_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_close() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 5fc93fd..d451982 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index 875f101..de9fa3b 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 1e3a278..f84fa7b 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ diff --git a/src/H5Pint.c b/src/H5Pint.c index e25b686..26431eb 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_interface +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -79,6 +76,22 @@ typedef struct { int cmp_value; /* Value from property comparison */ } H5P_plist_cmp_ud_t; +/* Typedef for property list set/poke callbacks */ +typedef struct { + const void *value; /* Pointer to value to set */ +} H5P_prop_set_ud_t; + +/* Typedef for property list get/peek callbacks */ +typedef struct { + void *value; /* Pointer for retrieved value */ +} H5P_prop_get_ud_t; + +/* Typedef for H5P__do_prop() callbacks */ +typedef herr_t (*H5P_do_plist_op_t)(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *udata); +typedef herr_t (*H5P_do_pclass_op_t)(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *udata); + /********************/ /* Local Prototypes */ @@ -88,6 +101,8 @@ typedef struct { static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); static herr_t H5P_free_prop(H5P_genprop_t *prop); static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); +static herr_t H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op, + H5P_do_pclass_op_t pclass_op, void *udata); /*********************/ @@ -96,7 +111,7 @@ static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); /* * Predefined property list classes. These are initialized at runtime by - * H5P_init_interface() in this source file. + * H5P__init_package() in this source file. */ hid_t H5P_CLS_ROOT_ID_g = FAIL; H5P_genclass_t *H5P_CLS_ROOT_g = NULL; @@ -135,7 +150,7 @@ 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. + * at runtime by H5P__init_package() in this source file. */ hid_t H5P_LST_FILE_CREATE_ID_g = FAIL; hid_t H5P_LST_FILE_ACCESS_ID_g = FAIL; @@ -312,89 +327,17 @@ static const H5I_class_t H5I_GENPROPLST_CLS[1] = {{ -/*-------------------------------------------------------------------------- - NAME - H5P_do_prop_cb1 - PURPOSE - Internal routine to call a property list callback routine and update - the property list accordingly. - USAGE - herr_t H5P_do_prop_cb1(slist,prop,cb) - H5SL_t *slist; IN/OUT: Skip list to hold changed properties - H5P_genprop_t *prop; IN: Property to call callback for - H5P_prp_cb1_t *cb; IN: Callback routine to call - RETURNS - Returns non-negative on success, negative on failure. - DESCRIPTION - Calls the callback routine passed in. If the callback routine changes - the property value, then the property is duplicated and added to skip list. - - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) -{ - void *tmp_value=NULL; /* Temporary value buffer */ - H5P_genprop_t *pcopy=NULL; /* Copy of property to insert into skip list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Allocate space for a temporary copy of the property value */ - if(NULL == (tmp_value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); - - /* Call "type 1" callback ('create', 'copy' or 'close') */ - if(cb(prop->name,prop->size,tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed") - - /* Check if the property value changed */ - if((prop->cmp)(tmp_value,prop->value,prop->size)) { - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") - - /* Copy the changed value into the new property */ - HDmemcpy(pcopy->value,tmp_value,prop->size); - - /* Insert the changed property into the property list */ - if(H5P_add_prop(slist,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into skip list") - } /* end if */ - -done: - /* Release the temporary value buffer */ - if(tmp_value!=NULL) - H5MM_xfree(tmp_value); - - /* Cleanup on failure */ - if(ret_value<0) { - if(pcopy!=NULL) - H5P_free_prop(pcopy); - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_do_prop_cb1() */ - - /*------------------------------------------------------------------------- * Function: H5P_init * * Purpose: Initialize the interface from some other layer. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Saturday, March 4, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -412,22 +355,22 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_init_interface -- Initialize interface-specific information + H5P__init_package -- Initialize interface-specific information USAGE - herr_t H5P_init_interface() + herr_t H5P__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5P_init_interface(void) +herr_t +H5P__init_package(void) { size_t tot_init; /* Total # of classes initialized */ size_t pass_init; /* # of classes initialized in each pass */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Initialize the Generic Property class & object groups. @@ -490,16 +433,16 @@ H5P_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_init_interface() */ +} /* end H5P__init_package() */ /*-------------------------------------------------------------------------- NAME - H5P_term_interface + H5P_term_package PURPOSE Terminate various H5P objects USAGE - void H5P_term_interface() + void H5P_term_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -511,13 +454,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5P_term_interface(void) +H5P_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { int64_t nlist, nclass; /* Destroy HDF5 library property classes & lists */ @@ -597,25 +540,89 @@ H5P_term_interface(void) n++; /*H5I*/ } else { - /* Close public interface */ - n += H5P__term_pub_interface(); - - /* Close deprecated interface */ - n += H5P__term_deprec_interface(); - /* Destroy the property list and class id groups */ - (void)H5I_dec_type_ref(H5I_GENPROP_LST); - n++; /*H5I*/ - (void)H5I_dec_type_ref(H5I_GENPROP_CLS); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_GENPROP_LST) > 0); + n += (H5I_dec_type_ref(H5I_GENPROP_CLS) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5P_term_interface() */ +} /* end H5P_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_do_prop_cb1 + PURPOSE + Internal routine to call a property list callback routine and update + the property list accordingly. + USAGE + herr_t H5P_do_prop_cb1(slist,prop,cb) + H5SL_t *slist; IN/OUT: Skip list to hold changed properties + H5P_genprop_t *prop; IN: Property to call callback for + H5P_prp_cb1_t *cb; IN: Callback routine to call + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Calls the callback routine passed in. If the callback routine changes + the property value, then the property is duplicated and added to skip list. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) +{ + void *tmp_value = NULL; /* Temporary value buffer */ + H5P_genprop_t *pcopy = NULL; /* Copy of property to insert into skip list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(slist); + HDassert(prop); + HDassert(prop->cmp); + HDassert(cb); + + /* Allocate space for a temporary copy of the property value */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value") + HDmemcpy(tmp_value, prop->value, prop->size); + + /* Call "type 1" callback ('create', 'copy' or 'close') */ + if(cb(prop->name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed") + + /* Make a copy of the class's property */ + if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + + /* Copy the changed value into the new property */ + HDmemcpy(pcopy->value, tmp_value, prop->size); + + /* Insert the changed property into the property list */ + if(H5P_add_prop(slist, pcopy) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list") + +done: + /* Release the temporary value buffer */ + if(tmp_value) + H5MM_xfree(tmp_value); + + /* Cleanup on failure */ + if(ret_value < 0) + if(pcopy) + H5P_free_prop(pcopy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_do_prop_cb1() */ /*-------------------------------------------------------------------------- @@ -838,7 +845,7 @@ 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) @@ -934,7 +941,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1050,8 +1057,8 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, 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 @@ -1171,7 +1178,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 @@ -1231,7 +1238,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 @@ -1541,8 +1548,8 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t 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) @@ -1636,10 +1643,10 @@ 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_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 */ + 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 @@ -1775,10 +1782,10 @@ 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) @@ -2561,162 +2568,449 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_set + H5P__do_prop PURPOSE - Internal routine to set a property's value in a property list. + Internal routine to perform an operation on a property in a property list USAGE - herr_t H5P_set(plist, name, value) + herr_t H5P__do_prop(plist, name, cb, udata) H5P_genplist_t *plist; IN: Property list to find property in const char *name; IN: Name of property to set - void *value; IN: Pointer to the value for the property + H5P_do_plist_op_t plist_op; IN: Pointer to the callback to invoke when the + property is found in the property list + H5P_do_pclass_op_t pclass_op; IN: Pointer to the callback to invoke when the + property is found in the property class + void *udata; IN: Pointer to the user data for the callback RETURNS Returns non-negative on success, negative on failure. DESCRIPTION - Sets a new value for a property in a property list. The property name - must exist or this routine will fail. If there is a 'set' callback routine - registered for this property, the 'value' will be passed to that routine and - any changes to the 'value' will be used when setting the property value. - The information pointed at by the 'value' pointer (possibly modified by the - 'set' callback) is copied into the property list value and may be changed - by the application making the H5Pset call without affecting the property - value. - - If the 'set' callback routine returns an error, the property value will - not be modified. This routine may not be called for zero-sized properties - and will return an error in that case. - + Finds a property in a property list and calls the callback with it. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t -H5P_set(H5P_genplist_t *plist, const char *name, const void *value) +static herr_t +H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op, + H5P_do_pclass_op_t pclass_op, void *udata) { H5P_genclass_t *tclass; /* Temporary class pointer */ H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); - HDassert(value); + HDassert(plist_op); + HDassert(pclass_op); /* Check if the property has been deleted */ - if(H5SL_search(plist->del,name)!=NULL) + if(NULL != H5SL_search(plist->del, name)) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Find property in changed list */ if(NULL != (prop = (H5P_genprop_t *)H5SL_search(plist->props, name))) { - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") - - /* Make a copy of the value and pass to 'set' callback */ - if(prop->set!=NULL) { - void *tmp_value; /* Temporary value for property */ - - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,value,prop->size); - - /* Call user's callback */ - if((*(prop->set))(plist->plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") - } /* end if */ - - /* Copy new [possibly unchanged] value into property value */ - HDmemcpy(prop->value,tmp_value,prop->size); - - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'set' callback, just copy value */ - else - HDmemcpy(prop->value,value,prop->size); + /* Call the 'found in propery list' callback */ + if((*plist_op)(plist, name, prop, udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property") } /* end if */ else { /* * Check if we should set class properties (up through list of parent classes also), * & make property 'set' callback. */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { + tclass = plist->pclass; + while(NULL != tclass) { + if(tclass->nprops > 0) { /* Find the property in the class */ - if((prop = (H5P_genprop_t *)H5SL_search(tclass->props,name))!=NULL) { - H5P_genprop_t *pcopy; /* Copy of property to insert into skip list */ - - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size") - - /* Make a copy of the value and pass to 'set' callback */ - if(prop->set!=NULL) { - void *tmp_value; /* Temporary value for property */ - - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,value,prop->size); - - /* Call user's callback */ - if((*(prop->set))(plist->plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") - } /* end if */ - - if((prop->cmp)(tmp_value,prop->value,prop->size)) { - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") - - /* Copy new value into property value */ - HDmemcpy(pcopy->value,tmp_value,pcopy->size); - - /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") - } /* end if */ - - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'set' callback, just copy value */ - else { - if((prop->cmp)(value,prop->value,prop->size)) { - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") - - HDmemcpy(pcopy->value,value,pcopy->size); - - /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") - } /* end if */ - } /* end else */ + if(NULL != (prop = (H5P_genprop_t *)H5SL_search(tclass->props, name))) { + /* Call the 'found in class' callback */ + if((*pclass_op)(plist, name, prop, udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property") /* Leave */ - HGOTO_DONE(SUCCEED); - } /* end while */ + break; + } /* end if */ } /* end if */ /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ /* If we get this far, then it wasn't in the list of changed properties, * nor in the properties in the class hierarchy, indicate an error */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") + if(NULL == tclass) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't find property in skip list") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__do_prop() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__poke_plist_cb + PURPOSE + Internal callback for H5P__do_prop, to overwrite a property's value in a property list. + USAGE + herr_t H5P__poke_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to overwrite property in + const char *name; IN: Name of property to overwrite + H5P_genprop_t *prop; IN: Property to overwrite + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Overwrite a value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property list. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Overwrite value in property */ + HDmemcpy(prop->value, udata->value, prop->size); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__poke_plist_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__poke_pclass_cb + PURPOSE + Internal callback for H5P__do_prop, to overwrite a property's value in a property list. + USAGE + herr_t H5P__poke_pclass_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to overwrite property in + const char *name; IN: Name of property to overwrite + H5P_genprop_t *prop; IN: Property to overwrite + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Overwrite a value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property class. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + H5P_genprop_t *pcopy = NULL; /* Copy of property to insert into skip list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + HDassert(prop->cmp); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a copy of the class's property */ + if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + + HDmemcpy(pcopy->value, udata->value, pcopy->size); + + /* Insert the changed property into the property list */ + if(H5P_add_prop(plist->props, pcopy) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") + +done: + /* Cleanup on failure */ + if(ret_value < 0) + if(pcopy) + H5P_free_prop(pcopy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__poke_pclass_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_poke + PURPOSE + Internal routine to overwrite a property's value in a property list. + USAGE + herr_t H5P_poke(plist, name, value) + H5P_genplist_t *plist; IN: Property list to find property in + const char *name; IN: Name of property to overwrite + void *value; IN: Pointer to the value for the property + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Overwrites a property in a property list (i.e. a "shallow" copy over + the property value). The property name must exist or this routine will + fail. If there is a setget' callback routine registered for this property, + it is _NOT_ called. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + This routine may not be called for zero-sized properties and will + return an error in that case. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5P_poke(H5P_genplist_t *plist, const char *name, const void *value) +{ + H5P_prop_set_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(value); + + /* Find the property and set the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__poke_plist_cb, H5P__poke_pclass_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to overwrite value") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P_poke() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__set_plist_cb + PURPOSE + Internal callback for H5P__do_prop, to set a property's value in a property list. + USAGE + herr_t H5P__set_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to set property in + const char *name; IN: Name of property to set + H5P_genprop_t *prop; IN: Property to set + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Sets a new value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property list. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a copy of the value and pass to 'set' callback */ + if(NULL != prop->set) { + /* Make a copy of the current value, in case the callback fails */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HDmemcpy(tmp_value, udata->value, prop->size); + + /* Call user's callback */ + if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + } /* end if */ + /* No 'set' callback, just copy value */ + else + tmp_value = (void *)udata->value; /* Casting away const OK -QAK */ + + /* Free any previous value for the property */ + if(NULL != prop->del) { + /* Call user's 'delete' callback */ + if((*(prop->del))(plist->plist_id, name, prop->size, prop->value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value") + } /* end if */ + + /* Copy new [possibly unchanged] value into property value */ + HDmemcpy(prop->value, tmp_value, prop->size); + +done: + /* Free the temporary value buffer */ + if(tmp_value != NULL && tmp_value != udata->value) + H5MM_xfree(tmp_value); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__set_plist_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__set_pclass_cb + PURPOSE + Internal callback for H5P__do_prop, to set a property's value in a property list. + USAGE + herr_t H5P__set_pclass_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to set property in + const char *name; IN: Name of property to set + H5P_genprop_t *prop; IN: Property to set + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Sets a new value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property class. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + H5P_genprop_t *pcopy = NULL; /* Copy of property to insert into skip list */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + HDassert(prop->cmp); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a copy of the value and pass to 'set' callback */ + if(NULL != prop->set) { + /* Make a copy of the current value, in case the callback fails */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HDmemcpy(tmp_value, udata->value, prop->size); + + /* Call user's callback */ + if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + } /* end if */ + /* No 'set' callback, just copy value */ + else + tmp_value = (void *)udata->value; /* Casting away const OK -QAK */ + + /* Make a copy of the class's property */ + if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + + HDmemcpy(pcopy->value, tmp_value, pcopy->size); + + /* Insert the changed property into the property list */ + if(H5P_add_prop(plist->props, pcopy) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") + +done: + /* Free the temporary value buffer */ + if(tmp_value != NULL && tmp_value != udata->value) + H5MM_xfree(tmp_value); + + /* Cleanup on failure */ + if(ret_value < 0) + if(pcopy) + H5P_free_prop(pcopy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__set_pclass_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_set + PURPOSE + Internal routine to set a property's value in a property list. + USAGE + herr_t H5P_set(plist, name, value) + H5P_genplist_t *plist; IN: Property list to find property in + const char *name; IN: Name of property to set + void *value; IN: Pointer to the value for the property + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Sets a new value for a property in a property list. The property name + must exist or this routine will fail. If there is a 'set' callback routine + registered for this property, the 'value' will be passed to that routine and + any changes to the 'value' will be used when setting the property value. + The information pointed at by the 'value' pointer (possibly modified by the + 'set' callback) is copied into the property list value and may be changed + by the application making the H5Pset call without affecting the property + value. + + If the 'set' callback routine returns an error, the property value will + not be modified. This routine may not be called for zero-sized properties + and will return an error in that case. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5P_set(H5P_genplist_t *plist, const char *name, const void *value) +{ + H5P_prop_set_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(value); + + /* Find the property and set the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__set_plist_cb, H5P__set_pclass_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to set value") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_set() */ @@ -3383,7 +3677,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) @@ -3436,7 +3730,7 @@ 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 */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3486,7 +3780,7 @@ done: H5P_genplist_t * H5P_object_verify(hid_t plist_id, hid_t pclass_id) { - H5P_genplist_t *ret_value; /* return value */ + H5P_genplist_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -3856,330 +4150,359 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_peek_unsigned + H5P__peek_cb PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal callback for H5P__do_prop, to peek at a property's value in a property list. USAGE - int H5P_peek_unsigned(plist, name) - H5P_genplist_t *plist; IN: Property list to check - const char *name; IN: Name of property to query + herr_t H5P__peek_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to peek property in + const char *name; IN: Name of property to peek + H5P_genprop_t *prop; IN: Property to peek + void *udata; IN: User data for operation RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. - + Peeks at a new value for a property in a property list. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! + Called when the property is found in the property list and when it's found + for the property class. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -unsigned -H5P_peek_unsigned(H5P_genplist_t *plist, const char *name) +static herr_t +H5P__peek_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) { - unsigned ret_value; /* return value */ + H5P_prop_get_ud_t *udata = (H5P_prop_get_ud_t *)_udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(UFAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(prop); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a (shallow) copy of the value */ + HDmemcpy(udata->value, prop->value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_unsigned() */ +} /* H5P__peek_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_peek_hid_t + H5P_peek PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal routine to look at the value of a property in a property list. USAGE - hid_t H5P_peek_hid_t(plist, name) + herr_t H5P_peek(plist, name, value) H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query + void *value; OUT: Pointer to the buffer for the property value RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. - + Retrieves a "shallow" copy of the value for a property in a property + list. The property name must exist or this routine will fail. If there + is a 'get' callback routine registered for this property, it is _NOT_ + called. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! + This routine may not be called for zero-sized properties and will + return an error in that case. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hid_t -H5P_peek_hid_t(H5P_genplist_t *plist, const char *name) +herr_t +H5P_peek(H5P_genplist_t *plist, const char *name, void *value) { - hid_t ret_value; /* return value */ + H5P_prop_get_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(value); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Find the property and peek at the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__peek_cb, H5P__peek_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to peek at value") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_hid_t() */ +} /* H5P_peek() */ /*-------------------------------------------------------------------------- NAME - H5P_peek_voidp + H5P__get_cb PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal callback for H5P__do_prop, to get a property's value in a property list. USAGE - void *H5P_peek_voidp(plist, name) - H5P_genplist_t *plist; IN: Property list to check - const char *name; IN: Name of property to query + herr_t H5P__get_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to get property in + const char *name; IN: Name of property to get + H5P_genprop_t *prop; IN: Property to get + void *udata; IN: User data for operation RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. - + Gets a new value for a property in a property list. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! + Called when the property is found in the property list and when it's found + for the property class. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void * -H5P_peek_voidp(H5P_genplist_t *plist, const char *name) +static herr_t +H5P__get_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) { - void * ret_value; /* return value */ + H5P_prop_get_ud_t *udata = (H5P_prop_get_ud_t *)_udata; /* User data for callback */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(prop); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Call the 'get' callback, if there is one */ + if(NULL != prop->get) { + /* Make a copy of the current value, in case the callback fails */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HDmemcpy(tmp_value, prop->value, prop->size); + + /* Call user's callback */ + if((*(prop->get))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + + /* Copy new [possibly unchanged] value into return value */ + HDmemcpy(udata->value, tmp_value, prop->size); + } /* end if */ + /* No 'get' callback, just copy value */ + else + HDmemcpy(udata->value, prop->value, prop->size); done: + /* Free the temporary value buffer */ + if(tmp_value) + H5MM_xfree(tmp_value); + FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_voidp() */ +} /* H5P__get_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_peek_size_t + H5P_get PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal routine to query the value of a property in a property list. USAGE - hsize_t H5P_peek_size_t(plist, name) + herr_t H5P_get(plist, name, value) H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query + void *value; OUT: Pointer to the buffer for the property value RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. + Retrieves a copy of the value for a property in a property list. The + property name must exist or this routine will fail. If there is a + 'get' callback routine registered for this property, the copy of the + value of the property will first be passed to that routine and any changes + to the copy of the value will be used when returning the property value + from this routine. + If the 'get' callback routine returns an error, 'value' will not be + modified and this routine will return an error. This routine may not be + called for zero-sized properties. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -size_t -H5P_peek_size_t(H5P_genplist_t *plist, const char *name) +herr_t +H5P_get(H5P_genplist_t *plist, const char *name, void *value) { - size_t ret_value; /* return value */ + H5P_prop_get_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(UFAIL) + FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(value); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Find the property and get the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__get_cb, H5P__get_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to get value") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_size_t() */ +} /* H5P_get() */ /*-------------------------------------------------------------------------- NAME - H5P_get + H5P__del_plist_cb PURPOSE - Internal routine to query the value of a property in a property list. + Internal callback for H5P__do_prop, to remove a property's value in a property list. USAGE - herr_t H5P_get(plist, name, value) - H5P_genplist_t *plist; IN: Property list to check - const char *name; IN: Name of property to query - void *value; OUT: Pointer to the buffer for the property value + herr_t H5P__del_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to remove property from + const char *name; IN: Name of property to remove + H5P_genprop_t *prop; IN: Property to remove + void *udata; IN: User data for operation RETURNS Returns non-negative on success, negative on failure. DESCRIPTION - Retrieves a copy of the value for a property in a property list. The - property name must exist or this routine will fail. If there is a - 'get' callback routine registered for this property, the copy of the - value of the property will first be passed to that routine and any changes - to the copy of the value will be used when returning the property value - from this routine. - If the 'get' callback routine returns an error, 'value' will not be - modified and this routine will return an error. This routine may not be - called for zero-sized properties. - + Remove a property in a property list. Called when the + property is found in the property list. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t -H5P_get(const H5P_genplist_t *plist, const char *name, void *value) +static herr_t +H5P__del_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void H5_ATTR_UNUSED *_udata) { - H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + char *del_name = NULL; /* Pointer to deleted name */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); - HDassert(value); + HDassert(prop); - /* Check if the property has been deleted */ - if(H5SL_search(plist->del,name)!=NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + /* Pass value to 'close' callback, if it exists */ + if(NULL != prop->del) { + /* Call user's callback */ + if((*(prop->del))(plist->plist_id, name, prop->size, prop->value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value") + } /* end if */ - /* Find property */ - if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + /* Duplicate string for insertion into new deleted property skip list */ + if(NULL == (del_name = H5MM_xstrdup(name))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") - /* Make a copy of the value and pass to 'get' callback */ - if(prop->get!=NULL) { - void *tmp_value; /* Temporary value for property */ + /* Insert property name into deleted list */ + if(H5SL_insert(plist->del, del_name, del_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list") - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); + /* Remove the property from the skip list */ + if(NULL == H5SL_remove(plist->props, prop->name)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list") - /* Call user's callback */ - if((*(prop->get))(plist->plist_id,name,prop->size,tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't get property value") + /* Free the property, ignoring return value, nothing we can do */ + H5P_free_prop(prop); - /* Copy new [possibly unchanged] value into return value */ - HDmemcpy(value,tmp_value,prop->size); + /* Decrement the number of properties in list */ + plist->nprops--; - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'get' callback, just copy value */ - else - HDmemcpy(value,prop->value,prop->size); - } /* end if */ - else { - /* - * Check if we should get class properties (up through list of parent classes also), - * & make property 'get' callback. - */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { - /* Find the property in the class */ - if((prop = (H5P_genprop_t *)H5SL_search(tclass->props,name))!=NULL) { - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size") - - /* Call the 'get' callback, if there is one */ - if(prop->get!=NULL) { - void *tmp_value; /* Temporary value for property */ +done: + /* Error cleanup */ + if(ret_value < 0) + if(del_name) + H5MM_xfree(del_name); - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__del_plist_cb() */ - /* Call user's callback */ - if((*(prop->get))(plist->plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") - } /* end if */ + +/*-------------------------------------------------------------------------- + NAME + H5P__del_pclass_cb + PURPOSE + Internal callback for H5P__do_prop, to remove a property's value in a property list. + USAGE + herr_t H5P__del_pclass_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to remove property from + const char *name; IN: Name of property to remove + H5P_genprop_t *prop; IN: Property to remove + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Remove a property in a property list. Called when the + property is found in the property class. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__del_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void H5_ATTR_UNUSED *_udata) +{ + char *del_name = NULL; /* Pointer to deleted name */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ - if((prop->cmp)(tmp_value,prop->value,prop->size)) { - H5P_genprop_t *pcopy; /* Copy of property to insert into skip list */ + FUNC_ENTER_STATIC - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); - /* Copy new value into property value */ - HDmemcpy(pcopy->value,tmp_value,prop->size); + /* Pass value to 'del' callback, if it exists */ + if(NULL != prop->del) { + /* Allocate space for a temporary copy of the property value */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value") + HDmemcpy(tmp_value, prop->value, prop->size); - /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") - } /* end if */ + /* Call user's callback */ + if((*(prop->del))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") + } /* end if */ - /* Copy new [possibly unchanged] value into return value */ - HDmemcpy(value,tmp_value,prop->size); + /* Duplicate string for insertion into new deleted property skip list */ + if(NULL == (del_name = H5MM_xstrdup(name))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'get' callback, just copy value */ - else - HDmemcpy(value,prop->value,prop->size); + /* Insert property name into deleted list */ + if(H5SL_insert(plist->del, del_name, del_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list") - /* Leave */ - HGOTO_DONE(SUCCEED); - } /* end while */ - } /* end if */ + /* Decrement the number of properties in list */ + plist->nprops--; - /* Go up to parent class */ - tclass=tclass->parent; - } /* end while */ +done: + /* Free the temporary value buffer */ + if(tmp_value) + H5MM_xfree(tmp_value); - /* If we get this far, then it wasn't in the list of changed properties, - * nor in the properties in the class hierarchy, indicate an error - */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") - } /* end else */ + /* Error cleanup */ + if(ret_value < 0) + if(del_name) + H5MM_xfree(del_name); -done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get() */ +} /* H5P__del_pclass_cb() */ /*-------------------------------------------------------------------------- @@ -4209,104 +4532,19 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) +H5P_remove(H5P_genplist_t *plist, const char *name) { - H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genprop_t *prop; /* Temporary property pointer */ - char *del_name; /* Pointer to deleted name */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); - /* Indicate that the property isn't in the list if it has been deleted already */ - if(H5SL_search(plist->del,name)!=NULL) - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") - - /* Get the property node from the changed property skip list */ - if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { - /* Pass value to 'close' callback, if it exists */ - if(prop->del!=NULL) { - /* Call user's callback */ - if((*(prop->del))(plist_id,name,prop->size,prop->value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") - } /* end if */ - - /* Duplicate string for insertion into new deleted property skip list */ - if((del_name=H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") - - /* Insert property name into deleted list */ - if(H5SL_insert(plist->del,del_name,del_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") - - /* Remove the property from the skip list */ - if(H5SL_remove(plist->props,prop->name) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list") - - /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(prop); - - /* Decrement the number of properties in list */ - plist->nprops--; - } /* end if */ - /* Walk through all the properties in the class hierarchy, looking for the property */ - else { - /* - * Check if we should delete class properties (up through list of parent classes also), - * & make property 'delete' callback. - */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { - /* Find the property in the class */ - if((prop=H5P_find_prop_pclass(tclass,name))!=NULL) { - /* Pass value to 'del' callback, if it exists */ - if(prop->del!=NULL) { - void *tmp_value; /* Temporary value buffer */ - - /* Allocate space for a temporary copy of the property value */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); - - /* Call user's callback */ - if((*(prop->del))(plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") - } /* end if */ - - /* Release the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - - /* Duplicate string for insertion into new deleted property skip list */ - if((del_name=H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") - - /* Insert property name into deleted list */ - if(H5SL_insert(plist->del,del_name,del_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") - - /* Decrement the number of properties in list */ - plist->nprops--; - - /* Leave */ - HGOTO_DONE(SUCCEED); - } /* end while */ - } /* end if */ - - /* Go up to parent class */ - tclass=tclass->parent; - } /* end while */ - - /* If we get this far, then it wasn't in the list of changed properties, - * nor in the properties in the class hierarchy, indicate an error - */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") - } /* end else */ + /* Find the property and get the value */ + if(H5P__do_prop(plist, name, H5P__del_plist_cb, H5P__del_pclass_cb, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to remove value") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4364,7 +4602,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) /* If the property exists in the destination alread */ if(NULL != H5P__find_prop_plist(dst_plist, name)) { /* Delete the property from the destination list, calling the 'close' callback if necessary */ - if(H5P_remove(dst_id,dst_plist,name) < 0) + if(H5P_remove(dst_plist, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") /* Get the pointer to the source property */ @@ -4759,7 +4997,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) @@ -4797,7 +5035,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 @@ -4863,7 +5101,7 @@ H5P_open_class_path(const char *path) 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 */ + H5P_genclass_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -4943,7 +5181,7 @@ done: H5P_genclass_t * H5P_get_class_parent(const H5P_genclass_t *pclass) { - H5P_genclass_t *ret_value; /* return value */ + H5P_genclass_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -5010,7 +5248,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) { H5P_genclass_t *pclass; /* Class of property list to create */ hid_t class_id; /* ID of class to create */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Plapl.c b/src/H5Plapl.c index e3b3c4f..f70fe5e 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ @@ -55,22 +57,26 @@ /* Definitions for external link prefix */ #define H5L_ACS_ELINK_PREFIX_SIZE sizeof(char *) #define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */ -#define H5L_ACS_ELINK_PREFIX_ENC H5P_lacc_elink_pref_enc -#define H5L_ACS_ELINK_PREFIX_DEC H5P_lacc_elink_pref_dec -#define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del -#define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy -#define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp -#define H5L_ACS_ELINK_PREFIX_CLOSE H5P_lacc_elink_pref_close +#define H5L_ACS_ELINK_PREFIX_SET H5P__lacc_elink_pref_set +#define H5L_ACS_ELINK_PREFIX_GET H5P__lacc_elink_pref_get +#define H5L_ACS_ELINK_PREFIX_ENC H5P__lacc_elink_pref_enc +#define H5L_ACS_ELINK_PREFIX_DEC H5P__lacc_elink_pref_dec +#define H5L_ACS_ELINK_PREFIX_DEL H5P__lacc_elink_pref_del +#define H5L_ACS_ELINK_PREFIX_COPY H5P__lacc_elink_pref_copy +#define H5L_ACS_ELINK_PREFIX_CMP H5P__lacc_elink_pref_cmp +#define H5L_ACS_ELINK_PREFIX_CLOSE H5P__lacc_elink_pref_close /* Definitions for setting fapl of external link access */ #define H5L_ACS_ELINK_FAPL_SIZE sizeof(hid_t) #define H5L_ACS_ELINK_FAPL_DEF H5P_DEFAULT -#define H5L_ACS_ELINK_FAPL_ENC H5P_lacc_elink_fapl_enc -#define H5L_ACS_ELINK_FAPL_DEC H5P_lacc_elink_fapl_dec -#define H5L_ACS_ELINK_FAPL_DEL H5P_lacc_elink_fapl_del -#define H5L_ACS_ELINK_FAPL_COPY H5P_lacc_elink_fapl_copy -#define H5L_ACS_ELINK_FAPL_CMP H5P_lacc_elink_fapl_cmp -#define H5L_ACS_ELINK_FAPL_CLOSE H5P_lacc_elink_fapl_close +#define H5L_ACS_ELINK_FAPL_SET H5P__lacc_elink_fapl_set +#define H5L_ACS_ELINK_FAPL_GET H5P__lacc_elink_fapl_get +#define H5L_ACS_ELINK_FAPL_ENC H5P__lacc_elink_fapl_enc +#define H5L_ACS_ELINK_FAPL_DEC H5P__lacc_elink_fapl_dec +#define H5L_ACS_ELINK_FAPL_DEL H5P__lacc_elink_fapl_del +#define H5L_ACS_ELINK_FAPL_COPY H5P__lacc_elink_fapl_copy +#define H5L_ACS_ELINK_FAPL_CMP H5P__lacc_elink_fapl_cmp +#define H5L_ACS_ELINK_FAPL_CLOSE H5P__lacc_elink_fapl_close /* Definitions for file access flags for external link traversal */ #define H5L_ACS_ELINK_FLAGS_SIZE sizeof(unsigned) @@ -98,21 +104,25 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__lacc_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ -static herr_t H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P_lacc_elink_pref_dec(const void **_pp, void *value); -static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value); -static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value); -static herr_t H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P_lacc_elink_fapl_dec(const void **_pp, void *value); -static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value); -static int H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_pref_dec(const void **_pp, void *value); +static herr_t H5P__lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_copy(const char* name, size_t size, void* value); +static int H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__lacc_elink_pref_close(const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_fapl_dec(const void **_pp, void *value); +static herr_t H5P__lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_copy(const char* name, size_t size, void* value); +static int H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__lacc_elink_fapl_close(const char* name, size_t size, void* value); /*********************/ @@ -128,7 +138,7 @@ const H5P_libclass_t H5P_CLS_LACC[1] = {{ &H5P_CLS_LINK_ACCESS_g, /* Pointer to class */ &H5P_CLS_LINK_ACCESS_ID_g, /* Pointer to class ID */ &H5P_LST_LINK_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P_lacc_reg_prop, /* Default property registration routine */ + H5P__lacc_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -158,7 +168,7 @@ static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Defaul /*------------------------------------------------------------------------- - * Function: H5P_lacc_reg_prop + * Function: H5P__lacc_reg_prop * * Purpose: Register the dataset creation property list class's properties * @@ -167,18 +177,14 @@ static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Defaul * 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 -H5P_lacc_reg_prop(H5P_genclass_t *pclass) +H5P__lacc_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register property for number of links traversed */ if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, @@ -188,13 +194,13 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) /* Register property for external link prefix */ if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, - NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, + NULL, H5L_ACS_ELINK_PREFIX_SET, H5L_ACS_ELINK_PREFIX_GET, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, - NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, + NULL, H5L_ACS_ELINK_FAPL_SET, H5L_ACS_ELINK_FAPL_GET, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -212,11 +218,97 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_reg_prop() */ +} /* end H5P__lacc_reg_prop() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_fapl_set + * + * Purpose: Copies an external link FAPL property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + hid_t l_fapl_id; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Get the FAPL ID */ + l_fapl_id = *(const hid_t *)value; + + /* 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))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__lacc_elink_fapl_set() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_enc + * Function: H5P__lacc_elink_fapl_get + * + * Purpose: Copies an external link FAPL property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + hid_t l_fapl_id; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Get the FAPL ID */ + l_fapl_id = *(const hid_t *)value; + + /* 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))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__lacc_elink_fapl_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_fapl_enc * * Purpose: Callback routine which is called whenever the elink FAPL * property in the dataset access property list is @@ -231,7 +323,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) { const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ uint8_t **pp = (uint8_t **)_pp; @@ -240,7 +332,7 @@ H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) size_t fapl_size = 0; /* FAPL's encoded size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check for non-default FAPL */ if(*elink_fapl != H5P_DEFAULT) { @@ -284,11 +376,11 @@ H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_enc() */ +} /* end H5P__lacc_elink_fapl_enc() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_dec + * Function: H5P__lacc_elink_fapl_dec * * Purpose: Callback routine which is called whenever the elink FAPL * property in the dataset access property list is @@ -303,15 +395,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_fapl_dec(const void **_pp, void *_value) +H5P__lacc_elink_fapl_dec(const void **_pp, void *_value) { hid_t *elink_fapl = (hid_t *)_value; /* The elink FAPL value */ const uint8_t **pp = (const uint8_t **)_pp; hbool_t non_default_fapl; /* Whether the FAPL is non-default */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(pp); HDassert(*pp); HDassert(elink_fapl); @@ -342,11 +435,11 @@ H5P_lacc_elink_fapl_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_dec() */ +} /* end H5P__lacc_elink_fapl_dec() */ /*-------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_del + * Function: H5P__lacc_elink_fapl_del * * Purpose: Close the FAPL for link access * @@ -360,27 +453,30 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { hid_t l_fapl_id; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* 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: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_del() */ +} /* end H5P__lacc_elink_fapl_del() */ /*-------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_copy + * Function: H5P__lacc_elink_fapl_copy * * Purpose: Copy the FAPL for link access * @@ -394,34 +490,36 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { hid_t l_fapl_id; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* 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))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file access properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_copy() */ +} /* end H5P__lacc_elink_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_cmp + * Function: H5P__lacc_elink_fapl_cmp * * Purpose: Callback routine which is called whenever the elink FAPL * property in the link access property list is @@ -435,14 +533,14 @@ done: *------------------------------------------------------------------------- */ static int -H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) { const hid_t *fapl1 = (const hid_t *)value1; const hid_t *fapl2 = (const hid_t *)value2; H5P_genplist_t *obj1, *obj2; /* Property lists to compare */ int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check for comparison with default value */ if(*fapl1 == 0 && *fapl2 > 0) HGOTO_DONE(1); @@ -464,11 +562,11 @@ H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_U done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_cmp() */ +} /* end H5P__lacc_elink_fapl_cmp() */ /*-------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_close + * Function: H5P__lacc_elink_fapl_close * * Purpose: Close the FAPL for link access * @@ -482,26 +580,88 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { hid_t l_fapl_id; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* 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") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_close() */ +} /* end H5P__lacc_elink_fapl_close() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_enc + * Function: H5P__lacc_elink_pref_set + * + * Purpose: Copies an external link prefix property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__lacc_elink_pref_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_pref_get + * + * Purpose: Copies an external link prefix property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__lacc_elink_pref_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_pref_enc * * Purpose: Callback routine which is called whenever the elink flags * property in the dataset access property list is @@ -516,7 +676,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) { const char *elink_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -524,7 +684,7 @@ H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -553,11 +713,11 @@ H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) *size += len; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_enc() */ +} /* end H5P__lacc_elink_pref_enc() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_dec + * Function: H5P__lacc_elink_pref_dec * * Purpose: Callback routine which is called whenever the elink prefix * property in the dataset access property list is @@ -572,7 +732,7 @@ H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_pref_dec(const void **_pp, void *_value) +H5P__lacc_elink_pref_dec(const void **_pp, void *_value) { char **elink_pref = (char **)_value; const uint8_t **pp = (const uint8_t **)_pp; @@ -581,7 +741,7 @@ H5P_lacc_elink_pref_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -610,11 +770,11 @@ H5P_lacc_elink_pref_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_pref_dec() */ +} /* end H5P__lacc_elink_pref_dec() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_del + * Function: H5P__lacc_elink_pref_del * * Purpose: Frees memory used to store the external link prefix string * @@ -627,20 +787,20 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_del() */ +} /* end H5P__lacc_elink_pref_del() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_copy + * Function: H5P__lacc_elink_pref_copy * * Purpose: Creates a copy of the external link prefix string * @@ -653,20 +813,20 @@ H5P_lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_copy() */ +} /* end H5P__lacc_elink_pref_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_cmp + * Function: H5P__lacc_elink_pref_cmp * * Purpose: Callback routine which is called whenever the elink prefix * property in the dataset creation property list is @@ -680,13 +840,13 @@ H5P_lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static int -H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) { const char *pref1 = *(const char * const *)value1; const char *pref2 = *(const char * const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -697,11 +857,11 @@ H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_U done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_pref_cmp() */ +} /* end H5P__lacc_elink_pref_cmp() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_close + * Function: H5P__lacc_elink_pref_close * * Purpose: Frees memory used to store the external link prefix string * @@ -714,16 +874,16 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_close() */ +} /* end H5P__lacc_elink_pref_close() */ /*------------------------------------------------------------------------- @@ -831,7 +991,6 @@ herr_t H5Pset_elink_prefix(hid_t plist_id, const char *prefix) { H5P_genplist_t *plist; /* Property list pointer */ - char *my_prefix; /* Copy of prefix string */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -841,19 +1000,8 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix) if(NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Get current prefix value */ - if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get prefix info") - - /* Free existing prefix, if there is one */ - H5MM_xfree(my_prefix); - - /* Make a copy of the user's prefix string */ - if(NULL == (my_prefix = H5MM_xstrdup(prefix))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy prefix") - /* Set prefix */ - if(H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) + if(H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") done: @@ -893,7 +1041,7 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the current prefix */ - if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) + if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") /* Check for prefix being set */ @@ -931,9 +1079,8 @@ done: herr_t H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id) { - H5P_genplist_t *plist, *fapl_plist; /* Property list pointer */ - hid_t l_fapl_id, new_fapl_id; - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ii", lapl_id, fapl_id); @@ -942,23 +1089,8 @@ H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id) if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link access property list"); - /* Get the current file access property list for the link access */ - if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &l_fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl") - - /* Close the current file access property list if set */ - 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") - - if(NULL == (fapl_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list"); - - /* Make a copy of the property list for FAPL_ID */ - if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file access properties") - /* Set the file access property list for the link access */ - if(H5P_set(plist, H5L_ACS_ELINK_FAPL_NAME, &new_fapl_id) < 0) + if(H5P_set(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fapl for link") done: @@ -982,9 +1114,8 @@ done: hid_t H5Pget_elink_fapl(hid_t lapl_id) { - H5P_genplist_t *plist, *fapl_plist; /* Property list pointer */ - hid_t l_fapl_id; - hid_t ret_value=FAIL; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", lapl_id); @@ -993,18 +1124,9 @@ H5Pget_elink_fapl(hid_t lapl_id) if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &l_fapl_id) < 0) + if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") - if(l_fapl_id > H5P_DEFAULT) { - if(NULL==(fapl_plist = H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); - - if((ret_value = H5P_copy_plist(fapl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file access properties") - } else - ret_value = l_fapl_id; - done: FUNC_LEAVE_API(ret_value); } /* end H5Pget_elink_fapl() */ @@ -1017,7 +1139,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 @@ -1056,7 +1178,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 @@ -1077,8 +1199,8 @@ H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get flags */ - if (flags) - if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, flags)<0) + if(flags) + if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, flags) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get access flags") done: @@ -1093,7 +1215,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 @@ -1138,7 +1260,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 @@ -1160,12 +1282,11 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get callback_info */ - if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info)<0) + if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info") if(func) *func = cb_info.func; - if(op_data) *op_data = cb_info.user_data; @@ -1173,4 +1294,3 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_cb() */ - diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index cde2035..f6e7793 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h new file mode 100644 index 0000000..ddf7c0f --- /dev/null +++ b/src/H5Pmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5P package. Including this header means that the source file + * is part of the H5P package. + */ +#ifndef _H5Pmodule_H +#define _H5Pmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5P_MODULE +#define H5_MY_PKG H5P +#define H5_MY_PKG_ERR H5E_PLIST +#define H5_MY_PKG_INIT YES + +#endif /* _H5Pmodule_H */ + diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 2740aad..7ae5a6e 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -27,8 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -63,9 +64,14 @@ #define H5O_CRT_OHDR_FLAGS_DEC H5P__decode_uint8_t /* Definitions for filter pipeline */ #define H5O_CRT_PIPELINE_SIZE sizeof(H5O_pline_t) +#define H5O_CRT_PIPELINE_SET H5P__ocrt_pipeline_set +#define H5O_CRT_PIPELINE_GET H5P__ocrt_pipeline_get #define H5O_CRT_PIPELINE_ENC H5P__ocrt_pipeline_enc #define H5O_CRT_PIPELINE_DEC H5P__ocrt_pipeline_dec +#define H5O_CRT_PIPELINE_DEL H5P__ocrt_pipeline_del +#define H5O_CRT_PIPELINE_COPY H5P__ocrt_pipeline_copy #define H5O_CRT_PIPELINE_CMP H5P__ocrt_pipeline_cmp +#define H5O_CRT_PIPELINE_CLOSE H5P__ocrt_pipeline_close /******************/ @@ -84,13 +90,16 @@ /* Property class callbacks */ static herr_t H5P__ocrt_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P__ocrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); -static herr_t H5P__ocrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *value); +static herr_t H5P__ocrt_pipeline_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocrt_pipeline_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocrt_pipeline_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocrt_pipeline_copy(const char *name, size_t size, void *value); static int H5P__ocrt_pipeline_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__ocrt_pipeline_close(const char *name, size_t size, void *value); /* Local routines */ static herr_t H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, @@ -113,9 +122,9 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P__ocrt_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P__ocrt_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -177,8 +186,8 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) /* Register the pipeline property */ if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, - NULL, NULL, NULL, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, - NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) + NULL, H5O_CRT_PIPELINE_SET, H5O_CRT_PIPELINE_GET, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, + H5O_CRT_PIPELINE_DEL, H5O_CRT_PIPELINE_COPY, H5O_CRT_PIPELINE_CMP, H5O_CRT_PIPELINE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -187,97 +196,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__ocrt_copy - * - * Purpose: Callback routine which is called whenever any object - * creation property list is copied. This routine copies - * the properties from the old list to the new list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * Monday, September 21, 2009 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P__ocrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void H5_ATTR_UNUSED *copy_data) -{ - H5O_pline_t src_pline, dst_pline; /* Source & destination pipelines */ - H5P_genplist_t *src_plist; /* Pointer to source property list */ - H5P_genplist_t *dst_plist; /* Pointer to destination property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Verify property list IDs */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list") - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list") - - /* Get the link pipeline property from the old property list */ - if(H5P_get(src_plist, H5O_CRT_PIPELINE_NAME, &src_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Make copy of link pipeline */ - if(NULL == H5O_msg_copy(H5O_PLINE_ID, &src_pline, &dst_pline)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy link pipeline") - - /* Set the link pipeline property for the destination property list */ - if(H5P_set(dst_plist, H5O_CRT_PIPELINE_NAME, &dst_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__ocrt_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__ocrt_close - * - * Purpose: Callback routine which is called whenever any object create - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * Monday, September 21, 2009 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P__ocrt_close(hid_t dcpl_id, void H5_ATTR_UNUSED *close_data) -{ - H5O_pline_t pline; /* I/O pipeline */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list") - - /* Get the link pipeline property from the old property list */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Clean up any values set for the link pipeline */ - if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release pipeline info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__ocrt_close() */ - - -/*------------------------------------------------------------------------- * Function: H5Pset_attr_phase_change * * Purpose: Sets the cutoff values for indexes storing attributes @@ -615,7 +533,7 @@ H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, FUNC_ENTER_NOAPI(FAIL) /* Get the pipeline property to modify */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Modify the filter parameters of the I/O pipeline */ @@ -623,7 +541,7 @@ H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -841,7 +759,7 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, } /* end if */ /* Get the pipeline property to append to */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Add the filter to the I/O pipeline */ @@ -849,7 +767,7 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -899,7 +817,7 @@ H5Pget_nfilters(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to query */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Set return value */ @@ -982,7 +900,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") /* Get the pipeline property to query */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") /* Check index */ @@ -1038,7 +956,7 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags FUNC_ENTER_NOAPI(FAIL) /* Get pipeline info */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Get pointer to filter in pipeline */ @@ -1167,7 +1085,7 @@ H5Pall_filters_avail(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to query */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Check if all filters are available */ @@ -1203,7 +1121,7 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id) FUNC_ENTER_NOAPI(FAIL) /* Get pipeline info */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Check if the file is in the pipeline */ @@ -1250,7 +1168,7 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to modify */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Check if there are any filters */ @@ -1260,7 +1178,7 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't delete filter") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") } /* end if */ @@ -1318,7 +1236,7 @@ H5Pset_deflate(hid_t plist_id, unsigned level) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to append to */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Add the filter */ @@ -1326,7 +1244,7 @@ H5Pset_deflate(hid_t plist_id, unsigned level) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -1369,7 +1287,7 @@ H5Pset_fletcher32(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to append to */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Add the Fletcher32 checksum as a filter */ @@ -1377,7 +1295,7 @@ H5Pset_fletcher32(hid_t plist_id) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add fletcher32 filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -1462,6 +1380,82 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, /*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_set + * + * Purpose: Copies an I/O pipeline property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_pline_t *pline = (H5O_pline_t *)value; /* Create local aliases for values */ + H5O_pline_t new_pline; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of I/O pipeline */ + if(NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + + /* Copy new I/O pipeline message over old one */ + *pline = new_pline; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_get + * + * Purpose: Copies a layout property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_pline_t *pline = (H5O_pline_t *)value; /* Create local aliases for values */ + H5O_pline_t new_pline; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of I/O pipeline */ + if(NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + + /* Copy new I/O pipeline message over old one */ + *pline = new_pline; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_get() */ + + +/*------------------------------------------------------------------------- * Function: H5P__ocrt_pipeline_enc * * Purpose: Callback routine which is called whenever the pipeline @@ -1639,6 +1633,9 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) /* Add the filter to the I/O pipeline */ if(H5Z_append(pline, filter.id, filter.flags, filter.cd_nelmts, filter.cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") + + /* Free cd_values, if it was allocated */ + filter.cd_values = (unsigned *)H5MM_xfree(filter.cd_values); } /* end for */ done: @@ -1647,6 +1644,77 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_del + * + * Purpose: Frees memory used to store the I/O pipeline property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old I/O pipeline */ + if(H5O_msg_reset(H5O_PLINE_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_copy + * + * Purpose: Copy the I/O pipeline property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_pline_t *pline = (H5O_pline_t *)value; /* Create local aliases for values */ + H5O_pline_t new_pline; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(pline); + + /* Make copy of I/O pipeline */ + if(NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + + /* Copy new I/O pipeline message over old one */ + *pline = new_pline; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_copy() */ + + +/*------------------------------------------------------------------------- * Function: H5P__ocrt_pipeline_cmp * * Purpose: Callback routine which is called whenever a filter pipeline @@ -1727,6 +1795,39 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__ocrt_pipeline_cmp() */ + +/*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_close + * + * Purpose: Frees memory used to store the I/O pipeline property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old I/O pipeline */ + if(H5O_msg_reset(H5O_PLINE_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_close() */ + #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- @@ -1792,7 +1893,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") /* Get pipeline info */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") /* Check more args */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 45ba778..7657d52 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -53,10 +54,13 @@ #define H5O_CPY_OPTION_ENC H5P__encode_unsigned #define H5O_CPY_OPTION_DEC H5P__decode_unsigned /* Definitions for merge committed dtype list */ -#define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(char *) +#define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(H5O_copy_dtype_merge_list_t *) #define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL +#define H5O_CPY_MERGE_COMM_DT_LIST_SET H5P__ocpy_merge_comm_dt_list_set +#define H5O_CPY_MERGE_COMM_DT_LIST_GET H5P__ocpy_merge_comm_dt_list_get #define H5O_CPY_MERGE_COMM_DT_LIST_ENC H5P__ocpy_merge_comm_dt_list_enc #define H5O_CPY_MERGE_COMM_DT_LIST_DEC H5P__ocpy_merge_comm_dt_list_dec +#define H5O_CPY_MERGE_COMM_DT_LIST_DEL H5P__ocpy_merge_comm_dt_list_del #define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy #define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp #define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close @@ -81,13 +85,17 @@ /* General routines */ static H5O_copy_dtype_merge_list_t *H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list); +static herr_t H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value); /* Property class callbacks */ static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ +static herr_t H5P__ocpy_merge_comm_dt_list_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocpy_merge_comm_dt_list_get(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *value); +static herr_t H5P__ocpy_merge_comm_dt_list_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char* name, size_t size, void* value); static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size, void* value); @@ -162,8 +170,8 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) /* Register merge named dtype list property */ if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, - NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC, - NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) + NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET, H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC, + H5O_CPY_MERGE_COMM_DT_LIST_DEL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ @@ -186,20 +194,23 @@ done: * * Programmer: Neil Fortner * October 27, 2011 + * *------------------------------------------------------------------------- */ static H5O_copy_dtype_merge_list_t * H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) { - H5O_copy_dtype_merge_list_t *tmp_node; - FUNC_ENTER_STATIC_NOERR /* Free the list */ while(dt_list) { + H5O_copy_dtype_merge_list_t *tmp_node; + 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 */ @@ -207,6 +218,138 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) } /* H5P__free_merge_comm_dtype_list */ +/*-------------------------------------------------------------------------- + * Function: H5P__copy_merge_comm_dt_list + * + * Purpose: Copy a merge committed datatype list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, September 2, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value) +{ + const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */ + H5O_copy_dtype_merge_list_t *dst_dt_list = NULL; /* Destination merge named datatype lists */ + H5O_copy_dtype_merge_list_t *dst_dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of merge committed dtype list */ + src_dt_list = *value; + while(src_dt_list) { + /* Copy src_dt_list */ + if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + if(NULL == (tmp_dt_list->path = H5MM_strdup(src_dt_list->path))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Add copied node to dest dtype list */ + if(dst_dt_list_tail) { + dst_dt_list_tail->next = tmp_dt_list; + dst_dt_list_tail = tmp_dt_list; + } /* end if */ + else { + dst_dt_list = tmp_dt_list; + dst_dt_list_tail = tmp_dt_list; + } /* end else */ + tmp_dt_list = NULL; + + /* Advance src_dt_list pointer */ + src_dt_list = src_dt_list->next; + } /* end while */ + + /* Set the merge named dtype list property for the destination property list */ + *value = dst_dt_list; + +done: + if(ret_value < 0) { + dst_dt_list = H5P__free_merge_comm_dtype_list(dst_dt_list); + if(tmp_dt_list) { + tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path); + tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__copy_merge_comm_dt_list() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_set + * + * Purpose: Copies a merge committed datatype list property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocpy_merge_comm_dt_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of merge committed dtype list */ + if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocpy_merge_comm_dt_list_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_get + * + * Purpose: Copies a merge committed datatype list property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocpy_merge_comm_dt_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of merge committed dtype list */ + if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocpy_merge_comm_dt_list_get() */ + + /*------------------------------------------------------------------------- * Function: H5P__ocpy_merge_comm_dt_list_enc * @@ -295,6 +438,9 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) HDassert(pp); HDassert(*pp); HDassert(dt_list); + + /* Start off with NULL (default value) */ + *dt_list = NULL; /* Decode the string sequence */ len = HDstrlen(*(const char **)pp); @@ -339,6 +485,36 @@ done: /*-------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_del + * + * Purpose: Frees memory used to store the merge committed datatype list property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, September 2, 2015 + * + *-------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P__ocpy_merge_comm_dt_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Free the merge named dtype list */ + H5P__free_merge_comm_dtype_list(*(H5O_copy_dtype_merge_list_t **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__ocpy_merge_comm_dt_list_del() */ + + +/*-------------------------------------------------------------------------- * Function: H5P__ocpy_merge_comm_dt_list_copy * * Purpose: Copy the merge committed datatype list @@ -356,51 +532,18 @@ static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */ - H5O_copy_dtype_merge_list_t *dst_dt_list = NULL; /* Destination merge named datatype lists */ - H5O_copy_dtype_merge_list_t *dst_dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); /* Make copy of merge committed dtype list */ - src_dt_list = *(const H5O_copy_dtype_merge_list_t **)value; - while(src_dt_list) { - /* Copy src_dt_list */ - if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if(NULL == (tmp_dt_list->path = H5MM_strdup(src_dt_list->path))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Add copied node to dest dtype list */ - if(dst_dt_list_tail) { - dst_dt_list_tail->next = tmp_dt_list; - dst_dt_list_tail = tmp_dt_list; - } /* end if */ - else { - dst_dt_list = tmp_dt_list; - dst_dt_list_tail = tmp_dt_list; - } /* end else */ - tmp_dt_list = NULL; - - /* Advance src_dt_list pointer */ - src_dt_list = src_dt_list->next; - } /* end while */ - - /* Set the merge named dtype list property for the destination property list */ - *(H5O_copy_dtype_merge_list_t **)value = dst_dt_list; + if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") done: - if(ret_value < 0) { - dst_dt_list = H5P__free_merge_comm_dtype_list(dst_dt_list); - if(tmp_dt_list) { - tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path); - tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list); - } /* end if */ - } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__ocpy_merge_comm_dt_list_copy() */ @@ -439,6 +582,9 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, /* Walk through the lists, comparing each path. For the lists to be the * same, the paths must be in the same order. */ while(dt_list1 && dt_list2) { + HDassert(dt_list1->path); + HDassert(dt_list2->path); + /* Compare paths */ ret_value = HDstrcmp(dt_list1->path, dt_list2->path); if(ret_value != 0) HGOTO_DONE(ret_value) @@ -601,13 +747,15 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path) /* Check parameters */ if(!path) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no path specified") + if(path[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path is empty string") /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get dtype list */ - if(H5P_get(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0) + if(H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list") /* Add the new path to the list */ @@ -618,7 +766,7 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path) new_obj->next = old_list; /* Update the list stored in the property list */ - if(H5P_set(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &new_obj) < 0) + if(H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &new_obj) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge named dtype list") done: @@ -663,14 +811,14 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get dtype list */ - if(H5P_get(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) + if(H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed dtype list") /* Free dtype list */ dt_list = H5P__free_merge_comm_dtype_list(dt_list); /* Update the list stored in the property list (to NULL) */ - if(H5P_set(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) + if(H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge committed dtype list") done: diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 2942a4d..105baf7 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -21,7 +21,7 @@ * the H5P package. Source files outside the H5P package should * include H5Pprivate.h instead. */ -#ifndef H5P_PACKAGE +#if !(defined H5P_FRIEND || defined H5P_MODULE) #error "Do not include this file outside the H5P package!" #endif @@ -158,8 +158,6 @@ struct H5Z_filter_info_t; /******************************/ /* Private functions, not part of the publicly documented API */ -H5_DLL herr_t H5P__term_pub_interface(void); -H5_DLL herr_t H5P__term_deprec_interface(void); H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 7233818..05830d1 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -33,13 +33,13 @@ #define H5P_STRCRT_CHAR_ENCODING_NAME "character_encoding" /* Character set encoding for string */ /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5P_PACKAGE +#ifdef H5P_MODULE #define H5P_PLIST_ID(P) ((P)->plist_id) #define H5P_CLASS(P) ((P)->pclass) -#else /* H5F_PACKAGE */ +#else /* H5P_MODULE */ #define H5P_PLIST_ID(P) (H5P_get_plist_id(P)) #define H5P_CLASS(P) (H5P_get_class(P)) -#endif /* H5P_PACKAGE */ +#endif /* H5P_MODULE */ /****************************/ @@ -111,21 +111,23 @@ H5_DLL herr_t H5P_init(void); H5_DLL herr_t H5P_close(void *_plist); H5_DLL hid_t H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref); H5_DLL hid_t H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref); -H5_DLL herr_t H5P_get(const H5P_genplist_t *plist, const char *name, void *value); +H5_DLL herr_t H5P_get(H5P_genplist_t *plist, const char *name, void *value); H5_DLL herr_t H5P_set(H5P_genplist_t *plist, const char *name, const void *value); +H5_DLL herr_t H5P_peek(H5P_genplist_t *plist, const char *name, void *value); +H5_DLL herr_t H5P_poke(H5P_genplist_t *plist, const char *name, const void *value); H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name); +H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); -H5_DLL hid_t H5P_get_driver(H5P_genplist_t *plist); -H5_DLL void * H5P_get_driver_info(H5P_genplist_t *plist); +H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); +H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 3ba625e..5a09cd7 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ diff --git a/src/H5Ptest.c b/src/H5Ptest.c index b36da6a..30a98a4 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -19,7 +19,7 @@ * Purpose: Generic Property Testing Functions */ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ #define H5P_TESTING /*suppress warning about H5P testing funcs*/ @@ -60,8 +60,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) @@ -101,8 +101,8 @@ 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) @@ -156,7 +156,7 @@ H5P_reset_external_file_test(hid_t dcpl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* get external file list */ - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") /* Clean up any values set for the external file-list */ @@ -164,7 +164,7 @@ H5P_reset_external_file_test(hid_t dcpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") /* set external file list */ - if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") done: @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5R_PACKAGE /*suppress error about including H5Rpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5R_init_interface +#include "H5Rmodule.h" /* This source code file is part of the H5R module */ /***********/ @@ -63,6 +60,9 @@ static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -81,39 +81,16 @@ static const H5I_class_t H5I_REFERENCE_CLS[1] = {{ NULL /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5R_top_package_initialize_s = FALSE; - -/*------------------------------------------------------------------------- - * Function: H5R_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, September 13, 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5R_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R_init() */ /*-------------------------------------------------------------------------- NAME - H5R_init_interface -- Initialize interface-specific information + H5R__init_package -- Initialize interface-specific information USAGE - herr_t H5R_init_interface() + herr_t H5R__init_package() RETURNS Non-negative on success/Negative on failure @@ -121,33 +98,37 @@ DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5R_init_interface(void) +herr_t +H5R__init_package(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Initialize the atom group for the file IDs */ if(H5I_register_type(H5I_REFERENCE_CLS) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface"); + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface") + + /* Mark "top" of interface as initialized, too */ + H5R_top_package_initialize_s = TRUE; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5R__init_package() */ /*-------------------------------------------------------------------------- NAME - H5R_term_interface + H5R_top_term_package PURPOSE Terminate various H5R objects USAGE - void H5R_term_interface() + void H5R_top_term_package() RETURNS void DESCRIPTION - Release the atom group and any other resources allocated. + Release IDs for the atom group, deferring full interface shutdown + until later (in H5R_term_package). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -155,32 +136,69 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5R_term_interface(void) +H5R_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if (H5_interface_initialize_g) { + if(H5R_top_package_initialize_s) { if(H5I_nmembers(H5I_REFERENCE) > 0) { (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close deprecated interface */ - n += H5R__term_deprec_interface(); - /* Destroy the reference id group */ - (void)H5I_dec_type_ref(H5I_REFERENCE); - n++; /*H5I*/ + /* Mark closed */ + if(0 == n) + H5R_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5R_top_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_term_package + PURPOSE + Terminate various H5R objects + USAGE + void H5R_term_package() + RETURNS + void + DESCRIPTION + Release the atom group and any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + + Finishes shutting down the interface, after H5R_top_term_package() + is called + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5R_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_REFERENCE)); + HDassert(FALSE == H5R_top_package_initialize_s); + + /* Destroy the reference id group */ + n += (H5I_dec_type_ref(H5I_REFERENCE) > 0); - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5R_term_interface() */ +} /* end H5R_term_package() */ /*-------------------------------------------------------------------------- @@ -424,7 +442,7 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, H5G_loc_t loc; /* Group location */ unsigned rc; /* Reference count of object */ H5O_type_t obj_type; /* Type of object */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -902,9 +920,9 @@ static ssize_t H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { - hid_t file_id = (-1); /* ID for file that the reference is in */ + hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 9877f42..b8133b2 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5R_PACKAGE /*suppress error about including H5Rpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5R__init_deprec_interface +#include "H5Rmodule.h" /* This source code file is part of the H5R module */ /***********/ @@ -84,51 +81,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5R__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5R__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5R_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5R__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5R_init()) -} /* H5R__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5R__term_deprec_interface -- Terminate interface -USAGE - herr_t H5R__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5R__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5R__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h new file mode 100644 index 0000000..6799483 --- /dev/null +++ b/src/H5Rmodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5R package. Including this header means that the source file + * is part of the H5R package. + */ +#ifndef _H5Rmodule_H +#define _H5Rmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5R_MODULE +#define H5_MY_PKG H5R +#define H5_MY_PKG_ERR H5E_REFERENCE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Rmodule_H */ + + diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index fd16754..8ed8d65 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -21,7 +21,7 @@ * only within the H5R package. Source files outside the * H5R package should include H5Rprivate.h instead. */ -#ifndef H5R_PACKAGE +#if !(defined H5R_FRIEND || defined H5R_MODULE) #error "Do not include this file outside the H5R package!" #endif @@ -54,8 +54,6 @@ /******************************/ /* General functions */ -H5_DLL herr_t H5R_init(void); -H5_DLL herr_t H5R__term_deprec_interface(void); H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type, @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5S_init_interface +#include "H5Smodule.h" /* This source code file is part of the H5S module */ /***********/ @@ -59,6 +56,9 @@ static htri_t H5S_is_simple(const H5S_t *sdim); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -76,7 +76,7 @@ H5FL_DEFINE(H5S_extent_t); 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); +H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK); /* Dataspace ID class */ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ @@ -86,47 +86,52 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5S_top_package_initialize_s = FALSE; + /*-------------------------------------------------------------------------- NAME - H5S_init_interface -- Initialize interface-specific information + H5S__init_package -- Initialize interface-specific information USAGE - herr_t H5S_init_interface() - + herr_t H5S__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. - --------------------------------------------------------------------------*/ -static herr_t -H5S_init_interface(void) +herr_t +H5S__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize the atom group for the file IDs */ if(H5I_register_type(H5I_DATASPACE_CLS) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Mark "top" of interface as initialized, too */ + H5S_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_init_interface() */ +} /* end H5S__init_package() */ /*-------------------------------------------------------------------------- NAME - H5S_term_interface + H5S_top_term_package PURPOSE Terminate various H5S objects USAGE - void H5S_term_interface() + void H5S_top_term_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION - Release the atom group and any other resources allocated. + Release IDs for the atom group, deferring full interface shutdown + until later (in H5S_term_package). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -134,29 +139,69 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5S_term_interface(void) +H5S_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5S_top_package_initialize_s) { if(H5I_nmembers(H5I_DATASPACE) > 0) { (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Destroy the dataspace object id group */ - (void)H5I_dec_type_ref(H5I_DATASPACE); - n++; /*H5I*/ - /* Shut down interface */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark "top" of interface as closed */ + if(0 == n) + H5S_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5S_top_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_term_package + PURPOSE + Terminate various H5S objects + USAGE + void H5S_term_package() + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + Release the atom group and any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + + Finishes shutting down the interface, after H5S_top_term_package() + is called + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5S_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_DATASPACE)); + HDassert(FALSE == H5S_top_package_initialize_s); + + /* Destroy the dataspace object id group */ + n += (H5I_dec_type_ref(H5I_DATASPACE) > 0); + + /* Mark interface as closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5S_term_interface() */ +} /* end H5S_term_package() */ /*-------------------------------------------------------------------------- @@ -181,7 +226,7 @@ H5S_t * H5S_create(H5S_class_t type) { H5S_t *new_ds = NULL; /* New dataspace created */ - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -617,8 +662,8 @@ done: 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) @@ -669,7 +714,7 @@ done: 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) @@ -745,8 +790,8 @@ done: 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) @@ -850,7 +895,7 @@ done: 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) @@ -935,8 +980,8 @@ done: 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) @@ -994,7 +1039,7 @@ done: 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) @@ -1102,8 +1147,8 @@ done: 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) @@ -1150,7 +1195,7 @@ done: 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 @@ -1455,7 +1500,7 @@ 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) @@ -1652,7 +1697,7 @@ H5S_decode(const unsigned char **p) 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; + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1734,7 +1779,7 @@ done: 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) @@ -1932,7 +1977,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 @@ -59,16 +59,15 @@ * */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5SL_init_interface +#include "H5SLmodule.h" /* This source code file is part of the H5SL module */ /* Private headers needed */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ #include "H5SLprivate.h" /* Skip list routines */ -#include "H5MMprivate.h" /* Memory management */ /* Local Macros */ @@ -576,6 +575,9 @@ static H5SL_node_t *H5SL_insert_common(H5SL_t *slist, void *item, const void *ke static herr_t H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); static herr_t H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5SL_t struct */ H5FL_DEFINE_STATIC(H5SL_t); @@ -590,12 +592,11 @@ static size_t H5SL_fac_nalloc_g; /*-------------------------------------------------------------------------- NAME - H5SL_init_interface + H5SL__init_package PURPOSE Initialize interface-specific information USAGE - herr_t H5SL_init_interface() - + herr_t H5SL__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -605,10 +606,10 @@ static size_t H5SL_fac_nalloc_g; EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t -H5SL_init_interface(void) +herr_t +H5SL__init_package(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Allocate space for array of factories */ H5SL_fac_g = (H5FL_fac_head_t **)H5MM_malloc(sizeof(H5FL_fac_head_t *)); @@ -621,7 +622,64 @@ H5SL_init_interface(void) H5SL_fac_nused_g = 1; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SL_init_interface() */ +} /* end H5SL__init_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5SL_term_package + PURPOSE + Terminate all the H5FL factories used in this package, and clear memory + USAGE + int H5SL_term_package() + RETURNS + Success: Positive if any action might have caused a change in some + other interface; zero otherwise. + Failure: Negative + DESCRIPTION + Release any resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int H5SL_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Terminate all the factories */ + if(H5SL_fac_nused_g > 0) { + size_t i; + herr_t ret; + + for(i = 0; i < H5SL_fac_nused_g; i++) { + ret = H5FL_fac_term(H5SL_fac_g[i]); + HDassert(ret >= 0); + } /* end if */ + H5SL_fac_nused_g = 0; + + n++; + } /* end if */ + + /* Free the list of factories */ + if(H5SL_fac_g) { + H5SL_fac_g = (H5FL_fac_head_t **)H5MM_xfree((void *)H5SL_fac_g); + H5SL_fac_nalloc_g = 0; + + n++; + } /* end if */ + + /* Mark the interface as uninitialized */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* H5SL_term_package() */ /*-------------------------------------------------------------------------- @@ -649,7 +707,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 @@ -938,7 +996,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) @@ -1097,7 +1155,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 @@ -1425,9 +1483,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 @@ -1534,9 +1592,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 @@ -1726,9 +1784,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 @@ -1832,9 +1890,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 @@ -2509,50 +2567,3 @@ H5SL_close(H5SL_t *slist) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SL_close() */ - -/*-------------------------------------------------------------------------- - NAME - H5SL_term_interface - PURPOSE - Terminate all the H5FL factories used in this package, and clear memory - USAGE - int H5SL_term_interface() - RETURNS - Success: Positive if any action might have caused a change in some - other interface; zero otherwise. - Failure: Negative - DESCRIPTION - Release any resources allocated. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Can't report errors... - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -int H5SL_term_interface(void) -{ - size_t i; - herr_t ret; - int n = H5_interface_initialize_g ? 1 : 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(n) { - /* Terminate all the factories */ - for(i=0; i<H5SL_fac_nused_g; i++) { - ret = H5FL_fac_term(H5SL_fac_g[i]); - HDassert(ret >= 0); - } - H5SL_fac_nused_g = 0; - - /* Free the list of factories */ - H5SL_fac_g = (H5FL_fac_head_t **)H5MM_xfree((void *)H5SL_fac_g); - H5SL_fac_nalloc_g = 0; - - /* Mark the interface as uninitialized */ - H5_interface_initialize_g = 0; - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* H5SL_term_interface() */ - diff --git a/src/H5SLmodule.h b/src/H5SLmodule.h new file mode 100644 index 0000000..d5bfbc2 --- /dev/null +++ b/src/H5SLmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5SL package. Including this header means that the source file + * is part of the H5SL package. + */ +#ifndef _H5SLmodule_H +#define _H5SLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5SL_MODULE +#define H5_MY_PKG H5SL +#define H5_MY_PKG_ERR H5E_SLIST +#define H5_MY_PKG_INIT YES + +#endif /* _H5SLmodule_H */ + @@ -17,8 +17,9 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ + /***********/ /* Headers */ @@ -84,6 +85,9 @@ static herr_t H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + H5FL_DEFINE(H5SM_master_table_t); H5FL_ARR_DEFINE(H5SM_index_header_t, H5O_SHMESG_MAX_NINDEXES); H5FL_DEFINE(H5SM_list_t); @@ -642,7 +646,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id) hsize_t x; /* Counter variable */ size_t num_entries; /* Number of messages to create in list */ haddr_t addr = HADDR_UNDEF; /* Address of the list on disk */ - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, H5AC__SOHM_TAG, HADDR_UNDEF) @@ -885,7 +889,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 @@ -1617,8 +1621,8 @@ done: static size_t H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos) { - size_t x; - size_t ret_value; + size_t x; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 7706cbd..e24dbb7 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ /***********/ @@ -97,7 +97,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 293088c..1bdd95a 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ /***********/ @@ -186,7 +186,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t u; /* Counter variable for index headers */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -510,7 +510,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t u; /* Counter variable for messages in list */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index d2dff47..5dbe5cf 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ /***********/ diff --git a/src/H5SMmodule.h b/src/H5SMmodule.h new file mode 100644 index 0000000..b6991b6 --- /dev/null +++ b/src/H5SMmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5SM package. Including this header means that the source file + * is part of the H5SM package. + */ +#ifndef _H5SMmodule_H +#define _H5SMmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5SM_MODULE +#define H5_MY_PKG H5SM +#define H5_MY_PKG_ERR H5E_SOHM +#define H5_MY_PKG_INIT NO + +#endif /* _H5SMmodule_H */ + diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index 68dc484..ac2ba1b 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -21,7 +21,7 @@ * the H5SM shared object header messages package. Source files * outside the H5SM package should include H5SMprivate.h instead. */ -#ifndef H5SM_PACKAGE +#if !(defined H5SM_FRIEND || defined H5SM_MODULE) #error "Do not include this file outside the H5SM package!" #endif diff --git a/src/H5SMtest.c b/src/H5SMtest.c index c4e02bc..798203d 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ #define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ diff --git a/src/H5Sall.c b/src/H5Sall.c index 568327a..79796c3 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -20,7 +20,7 @@ * Purpose: "All" selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -44,7 +44,7 @@ static herr_t H5S_all_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_all_offset(const H5S_t *space, hsize_t *off); -static int H5S_all_unlim_dim(const H5S_t *space); +static int H5S__all_unlim_dim(const H5S_t *space); static htri_t H5S_all_is_contiguous(const H5S_t *space); static htri_t H5S_all_is_single(const H5S_t *space); static htri_t H5S_all_is_regular(const H5S_t *space); @@ -76,7 +76,7 @@ const H5S_select_class_t H5S_sel_all[1] = {{ H5S_all_deserialize, H5S_all_bounds, H5S_all_offset, - H5S_all_unlim_dim, + H5S__all_unlim_dim, NULL, H5S_all_is_contiguous, H5S_all_is_single, @@ -666,11 +666,11 @@ H5S_all_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) /*-------------------------------------------------------------------------- NAME - H5S_all_unlim_dim + H5S__all_unlim_dim PURPOSE Return unlimited dimension of selection, or -1 if none USAGE - int H5S_all_unlim_dim(space) + int H5S__all_unlim_dim(space) H5S_t *space; IN: Dataspace pointer to check RETURNS Unlimited dimension of selection, or -1 if none (never fails). @@ -686,12 +686,12 @@ H5S_all_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) REVISION LOG --------------------------------------------------------------------------*/ static int -H5S_all_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) +H5S__all_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(-1) -} /* end H5S_all_unlim_dim() */ +} /* end H5S__all_unlim_dim() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index 0cbe4f2..b69604c 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ /***********/ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 70c9b67..f0ec40d 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -20,7 +20,7 @@ * Purpose: Hyperslab selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -63,7 +63,7 @@ static herr_t H5S_hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flag const uint8_t **p); static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_hyper_offset(const H5S_t *space, hsize_t *offset); -static int H5S_hyper_unlim_dim(const H5S_t *space); +static int H5S__hyper_unlim_dim(const H5S_t *space); static herr_t H5S_hyper_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim); static htri_t H5S_hyper_is_contiguous(const H5S_t *space); @@ -102,7 +102,7 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{ H5S_hyper_deserialize, H5S_hyper_bounds, H5S_hyper_offset, - H5S_hyper_unlim_dim, + H5S__hyper_unlim_dim, H5S_hyper_num_elem_non_unlim, H5S_hyper_is_contiguous, H5S_hyper_is_single, @@ -1104,7 +1104,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter) static H5S_hyper_span_t * H5S_hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next) { - H5S_hyper_span_t *ret_value; + H5S_hyper_span_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1299,7 +1299,7 @@ H5S_hyper_copy_span_helper (H5S_hyper_span_info_t *spans) H5S_hyper_span_t *new_span; /* Temporary hyperslab span */ H5S_hyper_span_t *prev_span; /* Previous hyperslab span */ H5S_hyper_span_info_t *new_down; /* New down span tree */ - H5S_hyper_span_info_t *ret_value; + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1385,7 +1385,7 @@ done: static H5S_hyper_span_info_t * H5S_hyper_copy_span(H5S_hyper_span_info_t *spans) { - H5S_hyper_span_info_t *ret_value; + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1766,9 +1766,9 @@ static htri_t H5S_hyper_is_valid (const H5S_t *space) { unsigned u; /* Counter */ - htri_t ret_value=TRUE; /* return value */ + htri_t ret_value = TRUE; /* return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) HDassert(space); @@ -1875,7 +1875,7 @@ H5S_hyper_span_nblocks(H5S_hyper_span_info_t *spans) static hsize_t H5S_get_select_hyper_nblocks(H5S_t *space) { - hsize_t ret_value; /* return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1961,9 +1961,9 @@ done: static hssize_t H5S_hyper_serial_size(const H5S_t *space) { - unsigned u; /* Counter */ hsize_t block_count; /* block counter for regular hyperslabs */ - hssize_t ret_value; /* return value */ + unsigned u; /* Counter */ + hssize_t ret_value = -1; /* return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2972,11 +2972,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_hyper_unlim_dim + H5S__hyper_unlim_dim PURPOSE Return unlimited dimension of selection, or -1 if none USAGE - int H5S_hyper_unlim_dim(space) + int H5S__hyper_unlim_dim(space) H5S_t *space; IN: Dataspace pointer to check RETURNS Unlimited dimension of selection, or -1 if none (never fails). @@ -2989,12 +2989,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5S_hyper_unlim_dim(const H5S_t *space) +H5S__hyper_unlim_dim(const H5S_t *space) { - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_STATIC_NOERR - FUNC_LEAVE_NOAPI(space->select.sel_info.hslab->unlim_dim) -} /* end H5S_hyper_get_unlim_dim() */ + FUNC_LEAVE_NOAPI(space->select.sel_info.hslab->unlim_dim); +} /* end H5S__hyper_unlim_dim() */ /*-------------------------------------------------------------------------- @@ -3065,7 +3065,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) unsigned u; /* index variable */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) HDassert(space); @@ -3220,6 +3220,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) ret_value=TRUE; } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_is_contiguous() */ @@ -3250,7 +3251,7 @@ H5S_hyper_is_single(const H5S_t *space) unsigned u; /* index variable */ htri_t ret_value=TRUE; /* return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) HDassert(space); @@ -3315,7 +3316,7 @@ done: static htri_t H5S_hyper_is_regular(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -5442,7 +5443,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */ H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */ unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */ - H5S_hyper_span_info_t *ret_value; + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -5810,7 +5811,7 @@ static hsize_t H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans) { H5S_hyper_span_t *span; /* Hyperslab span */ - hsize_t ret_value; + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -5872,7 +5873,7 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride, hsize_t stride_iter; /* Iterator over the stride values */ int i; /* Counters */ unsigned u; /* Counters */ - H5S_hyper_span_info_t *ret_value; /* Return value */ + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -9097,7 +9098,7 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_se size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -9966,7 +9967,7 @@ H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, hsize_t num_slices, const H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_unlim_diminfo in unlimited dimension */ hsize_t count; hsize_t rem_slices; - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -10046,9 +10047,9 @@ H5S_hyper_get_clip_extent(const H5S_t *clip_space, const H5S_t *match_space, hbool_t incl_trail) { hsize_t num_slices; /* Number of slices in unlimited dimension */ - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(0) /* Check parameters */ HDassert(clip_space); @@ -10072,6 +10073,7 @@ H5S_hyper_get_clip_extent(const H5S_t *clip_space, const H5S_t *match_space, /* Call "real" get_clip_extent function */ ret_value = H5S__hyper_get_clip_extent_real(clip_space, num_slices, incl_trail); +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_clip_extent() */ @@ -10114,9 +10116,9 @@ H5S_hyper_get_clip_extent_match(const H5S_t *clip_space, hsize_t count; /* Temporary count */ hsize_t block; /* Temporary block */ hsize_t num_slices; /* Number of slices in unlimited dimension */ - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(0) /* Check parameters */ HDassert(clip_space); @@ -10161,6 +10163,7 @@ H5S_hyper_get_clip_extent_match(const H5S_t *clip_space, /* Call "real" get_clip_extent function */ ret_value = H5S__hyper_get_clip_extent_real(clip_space, num_slices, incl_trail); +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_clip_extent_match() */ @@ -10278,9 +10281,9 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size, { H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */ H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */ - hsize_t ret_value; + hsize_t ret_value = 0; - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(0) /* Check parameters */ HDassert(space); @@ -10311,6 +10314,7 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size, } /* end if */ } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_first_inc_block */ diff --git a/src/H5Smodule.h b/src/H5Smodule.h new file mode 100644 index 0000000..d4d94f2 --- /dev/null +++ b/src/H5Smodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5S package. Including this header means that the source file + * is part of the H5S package. + */ +#ifndef _H5Smodule_H +#define _H5Smodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5S_MODULE +#define H5_MY_PKG H5S +#define H5_MY_PKG_ERR H5E_DATASPACE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Smodule_H */ + diff --git a/src/H5Smpio.c b/src/H5Smpio.c index c2190b4..1f97bc8 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -22,7 +22,7 @@ * I didn't make them portable. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 74a9b82..2fbd44b 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -20,7 +20,7 @@ * Purpose: "None" selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" @@ -45,7 +45,7 @@ static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags const uint8_t **p); static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off); -static int H5S_none_unlim_dim(const H5S_t *space); +static int H5S__none_unlim_dim(const H5S_t *space); static htri_t H5S_none_is_contiguous(const H5S_t *space); static htri_t H5S_none_is_single(const H5S_t *space); static htri_t H5S_none_is_regular(const H5S_t *space); @@ -77,7 +77,7 @@ const H5S_select_class_t H5S_sel_none[1] = {{ H5S_none_deserialize, H5S_none_bounds, H5S_none_offset, - H5S_none_unlim_dim, + H5S__none_unlim_dim, NULL, H5S_none_is_contiguous, H5S_none_is_single, @@ -617,11 +617,11 @@ H5S_none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offse /*-------------------------------------------------------------------------- NAME - H5S_none_unlim_dim + H5S__none_unlim_dim PURPOSE Return unlimited dimension of selection, or -1 if none USAGE - int H5S_none_unlim_dim(space) + int H5S__none_unlim_dim(space) H5S_t *space; IN: Dataspace pointer to check RETURNS Unlimited dimension of selection, or -1 if none (never fails). @@ -635,12 +635,12 @@ H5S_none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offse REVISION LOG --------------------------------------------------------------------------*/ static int -H5S_none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) +H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(-1) -} /* end H5S_none_unlim_dim() */ +} /* end H5S__none_unlim_dim() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Spkg.h b/src/H5Spkg.h index b4210c2..e57650a 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -21,7 +21,7 @@ * the H5S package. Source files outside the H5S package should * include H5Sprivate.h instead. */ -#ifndef H5S_PACKAGE +#if !(defined H5S_FRIEND || defined H5S_MODULE) #error "Do not include this file outside the H5S package!" #endif diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 202da85..1a14254 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -20,7 +20,7 @@ * Purpose: Point selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -46,7 +46,7 @@ static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flag const uint8_t **p); static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off); -static int H5S_point_unlim_dim(const H5S_t *space); +static int H5S__point_unlim_dim(const H5S_t *space); static htri_t H5S_point_is_contiguous(const H5S_t *space); static htri_t H5S_point_is_single(const H5S_t *space); static htri_t H5S_point_is_regular(const H5S_t *space); @@ -78,7 +78,7 @@ const H5S_select_class_t H5S_sel_point[1] = {{ H5S_point_deserialize, H5S_point_bounds, H5S_point_offset, - H5S_point_unlim_dim, + H5S__point_unlim_dim, NULL, H5S_point_is_contiguous, H5S_point_is_single, @@ -778,7 +778,7 @@ static hssize_t H5S_point_serial_size (const H5S_t *space) { H5S_pnt_node_t *curr; /* Point information nodes */ - hssize_t ret_value; /* return value */ + hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1193,11 +1193,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_point_unlim_dim + H5S__point_unlim_dim PURPOSE Return unlimited dimension of selection, or -1 if none USAGE - int H5S_point_unlim_dim(space) + int H5S__point_unlim_dim(space) H5S_t *space; IN: Dataspace pointer to check RETURNS Unlimited dimension of selection, or -1 if none (never fails). @@ -1212,12 +1212,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5S_point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) +H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(-1) -} /* end H5S_point_unlim_dim() */ +} /* end H5S__point_unlim_dim() */ /*-------------------------------------------------------------------------- @@ -1244,7 +1244,7 @@ H5S_point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) 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 @@ -1281,7 +1281,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 @@ -1321,7 +1321,7 @@ H5S_point_is_single(const H5S_t *space) static htri_t H5S_point_is_regular(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index e6816e2..6c4265d 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -116,7 +116,7 @@ typedef struct H5S_sel_iter_t { } H5S_sel_iter_t; /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5S_PACKAGE +#ifdef H5S_MODULE #define H5S_GET_EXTENT_TYPE(S) ((S)->extent.type) #define H5S_GET_EXTENT_NDIMS(S) ((S)->extent.rank) #define H5S_GET_EXTENT_NPOINTS(S) ((S)->extent.nelem) @@ -142,7 +142,7 @@ typedef struct H5S_sel_iter_t { #define H5S_SELECT_ITER_NEXT(ITER,NELEM)((*(ITER)->type->iter_next)(ITER,NELEM)) #define H5S_SELECT_ITER_NEXT_BLOCK(ITER) ((*(ITER)->type->iter_next_block)(ITER)) #define H5S_SELECT_ITER_RELEASE(ITER) ((*(ITER)->type->iter_release)(ITER)) -#else /* H5S_PACKAGE */ +#else /* H5S_MODULE */ #define H5S_GET_EXTENT_TYPE(S) (H5S_get_simple_extent_type(S)) #define H5S_GET_EXTENT_NDIMS(S) (H5S_get_simple_extent_ndims(S)) #define H5S_GET_EXTENT_NPOINTS(S) (H5S_get_simple_extent_npoints(S)) @@ -168,7 +168,7 @@ typedef struct H5S_sel_iter_t { #define H5S_SELECT_ITER_NEXT(ITER,NELEM)(H5S_select_iter_next(ITER,NELEM)) #define H5S_SELECT_ITER_NEXT_BLOCK(ITER) (H5S_select_iter_next_block(ITER)) #define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER)) -#endif /* H5S_PACKAGE */ +#endif /* H5S_MODULE */ /* Handle these two callbacks in a special way, since they have prologs that need to be executed */ #define H5S_SELECT_COPY(DST,SRC,SHARE) (H5S_select_copy(DST,SRC,SHARE)) #define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF)) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 6b0ca6e..cf82af1 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -19,7 +19,7 @@ * Purpose: Dataspace selection functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -107,7 +107,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) @@ -148,7 +148,7 @@ done: herr_t H5S_select_release(H5S_t *ds) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -185,7 +185,7 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -220,7 +220,7 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, 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 @@ -411,7 +411,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 @@ -452,12 +452,12 @@ H5S_select_valid(const H5S_t *space) herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p) { - H5S_t *tmp_space; /* Pointer to actual dataspace to use, either - *space or a newly allocated one */ - uint32_t sel_type; /* Pointer to the selection type */ - uint32_t version; /* Version number */ - uint8_t flags = 0; /* Flags */ - herr_t ret_value=FAIL; /* return value */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, either + *space or a newly allocated one */ + uint32_t sel_type; /* Pointer to the selection type */ + uint32_t version; /* Version number */ + uint8_t flags = 0; /* Flags */ + herr_t ret_value = FAIL; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -633,7 +633,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 @@ -674,7 +674,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 @@ -795,7 +795,7 @@ done: 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 @@ -832,7 +832,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 @@ -869,7 +869,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 @@ -906,7 +906,7 @@ 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 = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -944,7 +944,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 @@ -984,7 +984,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 @@ -1019,7 +1019,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 @@ -1074,7 +1074,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 @@ -1156,7 +1156,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 @@ -1235,7 +1235,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 @@ -1318,7 +1318,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 @@ -1535,7 +1535,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 diff --git a/src/H5Stest.c b/src/H5Stest.c index 62a4179..e1f4b61 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -19,7 +19,7 @@ * Purpose: Dataspace selection testing functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #define H5S_TESTING /*suppress warning about H5S testing funcs*/ @@ -54,7 +54,7 @@ H5S_select_shape_same_test(hid_t sid1, hid_t sid2) { H5S_t *space1; /* Pointer to 1st dataspace */ H5S_t *space2; /* Pointer to 2nd dataspace */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -95,7 +95,7 @@ htri_t H5S_get_rebuild_status_test(hid_t space_id) { H5S_t *space; /* Pointer to 1st dataspace */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -25,10 +24,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -304,12 +300,15 @@ H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR; /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* * Predefined data types. These are initialized at runtime in H5Tinit.c and - * by H5T_init_interface() in this source file. + * by H5T__init_package() in this source file. * * If more of these are added, the new ones must be added to the list of - * types to reset in H5T_term_interface(). + * types to reset in H5T_term_package(). */ hid_t H5T_IEEE_F32BE_g = FAIL; hid_t H5T_IEEE_F32LE_g = FAIL; @@ -529,6 +528,9 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ (H5I_free_t)H5T_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5T_top_package_initialize_s = FALSE; + /*------------------------------------------------------------------------- @@ -537,48 +539,42 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ * Purpose: Initialize the interface from some other package. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Robb Matzke * Wednesday, December 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5T_init(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* FUNC_ENTER() does all the work */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_init() */ /*------------------------------------------------------------------------- - * Function: H5T_init_inf + * Function: H5T__init_inf * * Purpose: Initialize the +/- Infinity floating-poing values for type * conversion. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Saturday, November 22, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5T_init_inf(void) +H5T__init_inf(void) { H5T_t *dst_p; /* Datatype type operate on */ H5T_atomic_t *dst; /* Datatype's atomic info */ @@ -587,7 +583,7 @@ H5T_init_inf(void) size_t u; /* Local index value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the float datatype */ if(NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g))) @@ -673,63 +669,22 @@ H5T_init_inf(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_init_inf() */ - - -/*------------------------------------------------------------------------- - * Function: H5T_init_hw - * - * Purpose: Perform hardware specific [floating-point] initialization - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Monday, November 24, 2003 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T_init_hw(void) -{ -#ifdef H5_HAVE_GET_FPC_CSR - union fpc_csr csr; /* Union to hold results of floating-point status register query */ -#endif /* H5_HAVE_GET_FPC_CSR */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef H5_HAVE_GET_FPC_CSR - /* [This code is specific to SGI machines] */ - - /* Get the floating-point status register */ - csr.fc_word = get_fpc_csr(); - - /* If the "flush denormalized values to zero" flag is set, unset it */ - if(csr.fc_struct.flush) { - csr.fc_struct.flush = 0; - set_fpc_csr(csr.fc_word); - } /* end if */ -#endif /* H5_HAVE_GET_FPC_CSR */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_init_hw() */ +} /* end H5T__init_inf() */ /*-------------------------------------------------------------------------- NAME - H5T_init_interface -- Initialize interface-specific information + H5T__init_package -- Initialize interface-specific information USAGE - herr_t H5T_init_interface() - + herr__t H5T_init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5T_init_interface(void) +herr_t +H5T__init_package(void) { H5T_t *native_schar=NULL; /* Datatype structure for native signed char */ H5T_t *native_uchar=NULL; /* Datatype structure for native unsigned char */ @@ -777,17 +732,13 @@ H5T_init_interface(void) /* Make certain there aren't too many classes of datatypes defined */ /* Only 16 (numbered 0-15) are supported in the current file format */ - HDassert(H5T_NCLASSES < 16); - - /* Perform any necessary hardware initializations */ - if(H5T_init_hw() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") + HDcompile_assert(H5T_NCLASSES < 16); /* * Initialize pre-defined native datatypes from code generated during * the library configuration by H5detect. */ - if(H5TN_init_interface() < 0) + if(H5T__init_native() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Get the atomic datatype structures needed by the initialization code below */ @@ -1004,7 +955,7 @@ H5T_init_interface(void) /* One-byte character string */ H5T_INIT_TYPE(CSTRING, H5T_C_S1_g, ALLOC, -, SET, 1) - string=dt; /* Keep type for later */ + string = dt; /* Keep type for later */ /*------------------------------------------------------------ * The `Fortran' architecture @@ -1021,7 +972,7 @@ H5T_init_interface(void) /* Object reference (i.e. object header address in file) */ H5T_INIT_TYPE(OBJREF, H5T_STD_REF_OBJ_g, ALLOC, -, SET, H5R_OBJ_REF_BUF_SIZE) - objref=dt; /* Keep type for later */ + objref = dt; /* Keep type for later */ /* Dataset Region reference (i.e. selection inside a dataset) */ H5T_INIT_TYPE(REGREF, H5T_STD_REF_DSETREG_g, ALLOC, -, SET, H5R_DSET_REG_REF_BUF_SIZE) @@ -1263,6 +1214,7 @@ H5T_init_interface(void) status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_ind_dxpl_id, FALSE); + /* From floats to long */ status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_ind_dxpl_id, FALSE); @@ -1294,13 +1246,13 @@ H5T_init_interface(void) status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_ind_dxpl_id, FALSE); /* Initialize the +/- Infinity values for floating-point types */ - status |= H5T_init_inf(); + status |= H5T__init_inf(); - if (status<0) + if(status < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)") /* Register datatype creation property class properties here. See similar - * code in H5D_init_interface(), etc. for example. + * code in H5D__init_package(), etc. for example. */ /* Only register the default property list if it hasn't been created yet */ @@ -1313,6 +1265,9 @@ H5T_init_interface(void) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") } /* end if */ + /* Mark "top" of interface as initialized, too */ + H5T_top_package_initialize_s = TRUE; + done: /* General cleanup */ if(compound != NULL) @@ -1338,11 +1293,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_init_interface() */ +} /* end H5T__init_package() */ /*------------------------------------------------------------------------- - * Function: H5T_unlock_cb + * Function: H5T__unlock_cb * * Purpose: Clear the immutable flag for a datatype. This function is * called when the library is closing in order to unlock all @@ -1356,198 +1311,252 @@ done: *------------------------------------------------------------------------- */ static int -H5T_unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED *key) +H5T__unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void *_udata) { H5T_t *dt = (H5T_t *)_dt; + int *n = (int *)_udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + + HDassert(dt && dt->shared); - HDassert (dt && dt->shared); - if (H5T_STATE_IMMUTABLE==dt->shared->state) + if(H5T_STATE_IMMUTABLE==dt->shared->state) { dt->shared->state = H5T_STATE_RDONLY; + (*n)++; + } /* end if */ + FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5T_unlock_cb() */ +} /* end H5T__unlock_cb() */ /*------------------------------------------------------------------------- - * Function: H5T_term_interface + * Function: H5T_top_term_package * - * Purpose: Close this interface. + * Purpose: Close the "top" of the interface, releasing IDs, etc. * * Return: Success: Positive if any action might have caused a - * change in some other interface; zero - * otherwise. - * + * change in some other interface; zero otherwise. * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 20, 1998 + * Programmer: Quincey Koziol + * Thursday, September 10, 2015 * *------------------------------------------------------------------------- */ int -H5T_term_interface(void) +H5T_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { - int i, nprint = 0; - + if(H5T_top_package_initialize_s) { /* Unregister all conversion functions */ - for(i = 0; i < H5T_g.npaths; i++) { - H5T_path_t *path; - - path = H5T_g.path[i]; - HDassert(path); - if(path->func) { - H5T__print_stats(path, &nprint/*in,out*/); - path->cdata.command = H5T_CONV_FREE; - if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, - (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) { + if(H5T_g.path) { + int i, nprint = 0; + + for(i = 0; i < H5T_g.npaths; i++) { + H5T_path_t *path; + + path = H5T_g.path[i]; + HDassert(path); + if(path->func) { + H5T__print_stats(path, &nprint/*in,out*/); + path->cdata.command = H5T_CONV_FREE; + if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, + (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) { #ifdef H5T_DEBUG - if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: conversion function " - "0x%08lx failed to free private data for " - "%s (ignored)\n", - (unsigned long)(path->func), path->name); - } /* end if */ + if (H5DEBUG(T)) { + fprintf(H5DEBUG(T), "H5T: conversion function " + "0x%08lx failed to free private data for " + "%s (ignored)\n", + (unsigned long)(path->func), path->name); + } /* end if */ #endif - H5E_clear_stack(NULL); /*ignore the error*/ - } /* end if */ - } /* end if */ + H5E_clear_stack(NULL); /*ignore the error*/ + } /* end if */ + } /* end if */ - if(path->src) - H5T_close(path->src); - if(path->dst) - H5T_close(path->dst); - path = H5FL_FREE(H5T_path_t, path); - H5T_g.path[i] = NULL; - } /* end for */ + if(path->src) + H5T_close(path->src); + if(path->dst) + H5T_close(path->dst); + path = H5FL_FREE(H5T_path_t, path); + H5T_g.path[i] = NULL; + } /* end for */ + + /* Clear conversion tables */ + H5T_g.path = (H5T_path_t **)H5MM_xfree(H5T_g.path); + H5T_g.npaths = 0; + H5T_g.apaths = 0; + H5T_g.soft = (H5T_soft_t *)H5MM_xfree(H5T_g.soft); + H5T_g.nsoft = 0; + H5T_g.asoft = 0; - /* Clear conversion tables */ - H5T_g.path = (H5T_path_t **)H5MM_xfree(H5T_g.path); - H5T_g.npaths = 0; - H5T_g.apaths = 0; - H5T_g.soft = (H5T_soft_t *)H5MM_xfree(H5T_g.soft); - H5T_g.nsoft = 0; - H5T_g.asoft = 0; + n++; + } /* end if */ /* Unlock all datatypes, then free them */ /* note that we are ignoring the return value from H5I_iterate() */ - H5I_iterate(H5I_DATATYPE, H5T_unlock_cb, NULL, FALSE); + /* Also note that we are incrementing 'n' in the callback */ + H5I_iterate(H5I_DATATYPE, H5T__unlock_cb, &n, FALSE); - /* Close deprecated interface */ - n += H5T__term_deprec_interface(); - - /* Destroy the datatype object id group */ - (void)H5I_dec_type_ref(H5I_DATATYPE); - n++; /*H5I*/ + /* Release all datatype IDs */ + if(H5I_nmembers(H5I_DATATYPE) > 0) { + (void)H5I_clear_type(H5I_DATATYPE, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ /* Reset all the datatype IDs */ - H5T_IEEE_F32BE_g = FAIL; - H5T_IEEE_F32LE_g = FAIL; - H5T_IEEE_F64BE_g = FAIL; - H5T_IEEE_F64LE_g = FAIL; - - H5T_STD_I8BE_g = FAIL; - H5T_STD_I8LE_g = FAIL; - H5T_STD_I16BE_g = FAIL; - H5T_STD_I16LE_g = FAIL; - H5T_STD_I32BE_g = FAIL; - H5T_STD_I32LE_g = FAIL; - H5T_STD_I64BE_g = FAIL; - H5T_STD_I64LE_g = FAIL; - H5T_STD_U8BE_g = FAIL; - H5T_STD_U8LE_g = FAIL; - H5T_STD_U16BE_g = FAIL; - H5T_STD_U16LE_g = FAIL; - H5T_STD_U32BE_g = FAIL; - H5T_STD_U32LE_g = FAIL; - H5T_STD_U64BE_g = FAIL; - H5T_STD_U64LE_g = FAIL; - H5T_STD_B8BE_g = FAIL; - H5T_STD_B8LE_g = FAIL; - H5T_STD_B16BE_g = FAIL; - H5T_STD_B16LE_g = FAIL; - H5T_STD_B32BE_g = FAIL; - H5T_STD_B32LE_g = FAIL; - H5T_STD_B64BE_g = FAIL; - H5T_STD_B64LE_g = FAIL; - H5T_STD_REF_OBJ_g = FAIL; - H5T_STD_REF_DSETREG_g = FAIL; - - H5T_UNIX_D32BE_g = FAIL; - H5T_UNIX_D32LE_g = FAIL; - H5T_UNIX_D64BE_g = FAIL; - H5T_UNIX_D64LE_g = FAIL; - - H5T_C_S1_g = FAIL; - - H5T_FORTRAN_S1_g = FAIL; - - H5T_NATIVE_SCHAR_g = FAIL; - H5T_NATIVE_UCHAR_g = FAIL; - H5T_NATIVE_SHORT_g = FAIL; - H5T_NATIVE_USHORT_g = FAIL; - H5T_NATIVE_INT_g = FAIL; - H5T_NATIVE_UINT_g = FAIL; - H5T_NATIVE_LONG_g = FAIL; - H5T_NATIVE_ULONG_g = FAIL; - H5T_NATIVE_LLONG_g = FAIL; - H5T_NATIVE_ULLONG_g = FAIL; - H5T_NATIVE_FLOAT_g = FAIL; - H5T_NATIVE_DOUBLE_g = FAIL; + if(H5T_IEEE_F32BE_g > 0) { + H5T_IEEE_F32BE_g = FAIL; + H5T_IEEE_F32LE_g = FAIL; + H5T_IEEE_F64BE_g = FAIL; + H5T_IEEE_F64LE_g = FAIL; + + H5T_STD_I8BE_g = FAIL; + H5T_STD_I8LE_g = FAIL; + H5T_STD_I16BE_g = FAIL; + H5T_STD_I16LE_g = FAIL; + H5T_STD_I32BE_g = FAIL; + H5T_STD_I32LE_g = FAIL; + H5T_STD_I64BE_g = FAIL; + H5T_STD_I64LE_g = FAIL; + H5T_STD_U8BE_g = FAIL; + H5T_STD_U8LE_g = FAIL; + H5T_STD_U16BE_g = FAIL; + H5T_STD_U16LE_g = FAIL; + H5T_STD_U32BE_g = FAIL; + H5T_STD_U32LE_g = FAIL; + H5T_STD_U64BE_g = FAIL; + H5T_STD_U64LE_g = FAIL; + H5T_STD_B8BE_g = FAIL; + H5T_STD_B8LE_g = FAIL; + H5T_STD_B16BE_g = FAIL; + H5T_STD_B16LE_g = FAIL; + H5T_STD_B32BE_g = FAIL; + H5T_STD_B32LE_g = FAIL; + H5T_STD_B64BE_g = FAIL; + H5T_STD_B64LE_g = FAIL; + H5T_STD_REF_OBJ_g = FAIL; + H5T_STD_REF_DSETREG_g = FAIL; + + H5T_UNIX_D32BE_g = FAIL; + H5T_UNIX_D32LE_g = FAIL; + H5T_UNIX_D64BE_g = FAIL; + H5T_UNIX_D64LE_g = FAIL; + + H5T_C_S1_g = FAIL; + + H5T_FORTRAN_S1_g = FAIL; + + H5T_NATIVE_SCHAR_g = FAIL; + H5T_NATIVE_UCHAR_g = FAIL; + H5T_NATIVE_SHORT_g = FAIL; + H5T_NATIVE_USHORT_g = FAIL; + H5T_NATIVE_INT_g = FAIL; + H5T_NATIVE_UINT_g = FAIL; + H5T_NATIVE_LONG_g = FAIL; + H5T_NATIVE_ULONG_g = FAIL; + H5T_NATIVE_LLONG_g = FAIL; + H5T_NATIVE_ULLONG_g = FAIL; + H5T_NATIVE_FLOAT_g = FAIL; + H5T_NATIVE_DOUBLE_g = FAIL; #if H5_SIZEOF_LONG_DOUBLE !=0 - H5T_NATIVE_LDOUBLE_g = FAIL; + H5T_NATIVE_LDOUBLE_g = FAIL; #endif - H5T_NATIVE_B8_g = FAIL; - H5T_NATIVE_B16_g = FAIL; - H5T_NATIVE_B32_g = FAIL; - H5T_NATIVE_B64_g = FAIL; - H5T_NATIVE_OPAQUE_g = FAIL; - H5T_NATIVE_HADDR_g = FAIL; - H5T_NATIVE_HSIZE_g = FAIL; - H5T_NATIVE_HSSIZE_g = FAIL; - H5T_NATIVE_HERR_g = FAIL; - H5T_NATIVE_HBOOL_g = FAIL; - - H5T_NATIVE_INT8_g = FAIL; - H5T_NATIVE_UINT8_g = FAIL; - H5T_NATIVE_INT_LEAST8_g = FAIL; - H5T_NATIVE_UINT_LEAST8_g = FAIL; - H5T_NATIVE_INT_FAST8_g = FAIL; - H5T_NATIVE_UINT_FAST8_g = FAIL; - - H5T_NATIVE_INT16_g = FAIL; - H5T_NATIVE_UINT16_g = FAIL; - H5T_NATIVE_INT_LEAST16_g = FAIL; - H5T_NATIVE_UINT_LEAST16_g = FAIL; - H5T_NATIVE_INT_FAST16_g = FAIL; - H5T_NATIVE_UINT_FAST16_g = FAIL; - - H5T_NATIVE_INT32_g = FAIL; - H5T_NATIVE_UINT32_g = FAIL; - H5T_NATIVE_INT_LEAST32_g = FAIL; - H5T_NATIVE_UINT_LEAST32_g = FAIL; - H5T_NATIVE_INT_FAST32_g = FAIL; - H5T_NATIVE_UINT_FAST32_g = FAIL; - - H5T_NATIVE_INT64_g = FAIL; - H5T_NATIVE_UINT64_g = FAIL; - H5T_NATIVE_INT_LEAST64_g = FAIL; - H5T_NATIVE_UINT_LEAST64_g = FAIL; - H5T_NATIVE_INT_FAST64_g = FAIL; - H5T_NATIVE_UINT_FAST64_g = FAIL; + H5T_NATIVE_B8_g = FAIL; + H5T_NATIVE_B16_g = FAIL; + H5T_NATIVE_B32_g = FAIL; + H5T_NATIVE_B64_g = FAIL; + H5T_NATIVE_OPAQUE_g = FAIL; + H5T_NATIVE_HADDR_g = FAIL; + H5T_NATIVE_HSIZE_g = FAIL; + H5T_NATIVE_HSSIZE_g = FAIL; + H5T_NATIVE_HERR_g = FAIL; + H5T_NATIVE_HBOOL_g = FAIL; + + H5T_NATIVE_INT8_g = FAIL; + H5T_NATIVE_UINT8_g = FAIL; + H5T_NATIVE_INT_LEAST8_g = FAIL; + H5T_NATIVE_UINT_LEAST8_g = FAIL; + H5T_NATIVE_INT_FAST8_g = FAIL; + H5T_NATIVE_UINT_FAST8_g = FAIL; + + H5T_NATIVE_INT16_g = FAIL; + H5T_NATIVE_UINT16_g = FAIL; + H5T_NATIVE_INT_LEAST16_g = FAIL; + H5T_NATIVE_UINT_LEAST16_g = FAIL; + H5T_NATIVE_INT_FAST16_g = FAIL; + H5T_NATIVE_UINT_FAST16_g = FAIL; + + H5T_NATIVE_INT32_g = FAIL; + H5T_NATIVE_UINT32_g = FAIL; + H5T_NATIVE_INT_LEAST32_g = FAIL; + H5T_NATIVE_UINT_LEAST32_g = FAIL; + H5T_NATIVE_INT_FAST32_g = FAIL; + H5T_NATIVE_UINT_FAST32_g = FAIL; + + H5T_NATIVE_INT64_g = FAIL; + H5T_NATIVE_UINT64_g = FAIL; + H5T_NATIVE_INT_LEAST64_g = FAIL; + H5T_NATIVE_UINT_LEAST64_g = FAIL; + H5T_NATIVE_INT_FAST64_g = FAIL; + H5T_NATIVE_UINT_FAST64_g = FAIL; + + n++; + } /* end if */ + + /* Mark "top" of interface as closed */ + if(0 == n) + H5T_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5T_top_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_term_package + * + * Purpose: Close this interface. + * + * Note: Finishes shutting down the interface, after + * H5T_top_term_package() is called + * + * Return: Success: Positive if any action might have caused a + * change in some other interface; zero + * otherwise. + * Failure: Negative + * + * Programmer: Robb Matzke + * Friday, November 20, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5T_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity check */ + HDassert(0 == H5I_nmembers(H5I_DATATYPE)); + HDassert(FALSE == H5T_top_package_initialize_s); + + /* Destroy the datatype object id group */ + n += (H5I_dec_type_ref(H5I_DATATYPE) > 0); /* Mark interface as closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5T_term_interface() */ +} /* end H5T_term_package() */ /*------------------------------------------------------------------------- @@ -1865,7 +1874,7 @@ done: H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal) { - H5T_class_t ret_value; + H5T_class_t ret_value = H5T_NO_CLASS; /* Return value */ FUNC_ENTER_NOAPI(H5T_NO_CLASS) @@ -2912,8 +2921,8 @@ done: H5T_t * H5T_decode(const unsigned char *buf) { - H5F_t *f = NULL; /* Fake file structure*/ - H5T_t *ret_value; /* Return value */ + H5F_t *f = NULL; /* Fake file structure*/ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -3116,7 +3125,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) H5T_shared_t *reopened_fo = NULL; unsigned i; char *s; - H5T_t *ret_value; + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -3445,7 +3454,7 @@ H5T_t * H5T__alloc(void) { H5T_t *dt = NULL; /* Pointer to datatype allocated */ - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -3532,21 +3541,23 @@ H5T__free(H5T_t *dt) switch(dt->shared->type) { case H5T_COMPOUND: for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { - H5MM_xfree(dt->shared->u.compnd.memb[i].name); + dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name); H5T_close(dt->shared->u.compnd.memb[i].type); } /* end for */ - H5MM_xfree(dt->shared->u.compnd.memb); + dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb); + dt->shared->u.compnd.nmembs = 0; break; case H5T_ENUM: for(i = 0; i < dt->shared->u.enumer.nmembs; i++) - H5MM_xfree(dt->shared->u.enumer.name[i]); - H5MM_xfree(dt->shared->u.enumer.name); - H5MM_xfree(dt->shared->u.enumer.value); + dt->shared->u.enumer.name[i] = (char *)H5MM_xfree(dt->shared->u.enumer.name[i]); + dt->shared->u.enumer.name = (char **)H5MM_xfree(dt->shared->u.enumer.name); + dt->shared->u.enumer.value = (uint8_t *)H5MM_xfree(dt->shared->u.enumer.value); + dt->shared->u.enumer.nmembs = 0; break; case H5T_OPAQUE: - H5MM_xfree(dt->shared->u.opaque.tag); + dt->shared->u.opaque.tag = (char *)H5MM_xfree(dt->shared->u.opaque.tag); break; case H5T_NO_CLASS: @@ -3562,11 +3573,13 @@ H5T__free(H5T_t *dt) default: break; } /* end switch */ + dt->shared->type = H5T_NO_CLASS; /* Close the parent */ HDassert(dt->shared->parent != dt); if(dt->shared->parent && H5T_close(dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type") + dt->shared->parent = NULL; done: FUNC_LEAVE_NOAPI(ret_value) @@ -3641,7 +3654,7 @@ H5T_close(H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "problem attempting to free location") } /* end if */ - /* Free the group hier. path since we're not calling H5T__free*/ + /* Free the group hier. path since we're not calling H5T__free() */ H5G_name_free(&(dt->path)); } /* end else */ @@ -4375,7 +4388,7 @@ done: * 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, + * H5T__init_package() is trying to register hard conversions, * IS_API is FALSE and the old hard path is not replaced. * Tuesday, Sept 13, 2005 * @@ -4394,13 +4407,15 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, hid_t src_id = -1, dst_id = -1; /*src and dst type identifiers */ int i; /*counter */ int nprint = 0; /*lines of output printed */ - H5T_path_t *ret_value; /*return value */ + H5T_path_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Sanity check */ HDassert(src); + HDassert(src->shared); HDassert(dst); + HDassert(dst->shared); /* * Make sure the first entry in the table is the no-op conversion path. @@ -4753,7 +4768,7 @@ static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst) { H5T_path_t *path; - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -5045,7 +5060,7 @@ done: htri_t H5T_is_sensible(const H5T_t *dt) { - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -62,7 +62,7 @@ static void H5TS_key_destructor(void *key_val) { /* Use HDfree here instead of H5MM_xfree(), to avoid calling the H5CS routines */ - if(key_val!=NULL) + if(key_val != NULL) HDfree(key_val); } @@ -91,7 +91,8 @@ 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 */ + H5_g.H5_libterm_g = FALSE; /* Library isn't being shutdown */ #ifdef H5_HAVE_WIN32_API # ifdef PTW32_STATIC_LIB diff --git a/src/H5Tarray.c b/src/H5Tarray.c index 752f2aa..4b2c7cf 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_array_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -78,28 +75,6 @@ -/*-------------------------------------------------------------------------- -NAME - H5T_init_array_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_array_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_array_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_array_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tarray_create2 * @@ -179,8 +154,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 diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 5322959..8c53066 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -19,7 +19,7 @@ * the bytes are in little-endian order. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -261,7 +261,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 diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 024cc83..5ff1c73 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_commit_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -83,28 +80,6 @@ static H5T_t *H5T_open_oid(const H5G_loc_t *loc, hid_t dxpl_id); -/*-------------------------------------------------------------------------- -NAME - H5T_init_commit_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_commit_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_commit_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_commit_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tcommit2 * @@ -184,10 +159,10 @@ herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id) { - H5O_obj_create_t ocrt_info; /* Information for object creation */ - H5T_obj_create_t tcrt_info; /* Information for named datatype creation */ - H5T_state_t old_state = H5T_STATE_TRANSIENT; /* The state of the datatype before H5T__commit. */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_obj_create_t ocrt_info; /* Information for object creation */ + H5T_obj_create_t tcrt_info; /* Information for named datatype creation */ + H5T_state_t old_state; /* The state of the datatype before H5T__commit. */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -518,7 +493,7 @@ 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) @@ -705,7 +680,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) @@ -821,7 +796,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index b377b29..1342770 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_compound_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -80,26 +77,6 @@ static htri_t H5T_is_packed(const H5T_t *dt); -/*-------------------------------------------------------------------------- -NAME - H5T_init_compound_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_compound_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init() currently). ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_compound_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_compound_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_member_offset * @@ -282,7 +259,7 @@ 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) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 6847e68..8b96d22 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -21,7 +21,8 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ + /***********/ /* Headers */ @@ -2111,7 +2112,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 @@ -2925,7 +2926,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* 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) { diff --git a/src/H5Tcset.c b/src/H5Tcset.c index 33fb32a..95658ed 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -18,10 +18,7 @@ * the character set (cset) for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_cset_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -30,28 +27,6 @@ #include "H5Tpkg.h" /*data-type functions */ -/*-------------------------------------------------------------------------- -NAME - H5T_init_cset_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_cset_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_cset_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_cset_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_cset * diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 717fc17..8a10cc6 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index f1586bd..cd4de1d 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T__init_deprec_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -84,51 +81,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5T__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5T__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5T__term_deprec_interface -- Terminate interface -USAGE - herr_t H5T__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5T__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5T__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Tenum.c b/src/H5Tenum.c index 2b7563b..e80d748 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -18,10 +18,7 @@ * in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_enum_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -36,27 +33,6 @@ static char *H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_enum_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_enum_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_enum_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_enum_interface() */ /*------------------------------------------------------------------------- @@ -123,7 +99,7 @@ done: 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 @@ -416,7 +392,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t si 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 diff --git a/src/H5Tfields.c b/src/H5Tfields.c index fb186fb..8818a73 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -18,10 +18,7 @@ * enumerated & compound datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_fields_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -31,28 +28,6 @@ #include "H5Tpkg.h" /*data-type functions */ -/*-------------------------------------------------------------------------- -NAME - H5T_init_fields_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_fields_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_fields_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_fields_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_nmembers * @@ -117,7 +92,7 @@ done: int H5T_get_nmembers(const H5T_t *dt) { - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -199,7 +174,7 @@ done: char * H5T__get_member_name(H5T_t const *dt, unsigned membno) { - char *ret_value; + char *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c index daa7886..62b8e79 100644 --- a/src/H5Tfixed.c +++ b/src/H5Tfixed.c @@ -18,10 +18,7 @@ * integer) datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_fixed_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -30,28 +27,6 @@ #include "H5Tpkg.h" /*data-type functions */ -/*-------------------------------------------------------------------------- -NAME - H5T_init_fixed_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_fixed_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_fixed_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_fixed_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_sign * @@ -109,7 +84,7 @@ done: H5T_sign_t H5T_get_sign(H5T_t const *dt) { - H5T_sign_t ret_value; + H5T_sign_t ret_value = H5T_SGN_ERROR; /* Return value */ FUNC_ENTER_NOAPI(H5T_SGN_ERROR) diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c index fff413d..b8b1c07 100644 --- a/src/H5Tfloat.c +++ b/src/H5Tfloat.c @@ -18,10 +18,7 @@ * datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_float_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -29,27 +26,6 @@ #include "H5Iprivate.h" /*ID functions */ #include "H5Tpkg.h" /*data-type functions */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_float_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_float_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_float_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_float_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h new file mode 100644 index 0000000..bfaab5e6 --- /dev/null +++ b/src/H5Tmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5T package. Including this header means that the source file + * is part of the H5T package. + */ +#ifndef _H5Tmodule_H +#define _H5Tmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5T_MODULE +#define H5_MY_PKG H5T +#define H5_MY_PKG_ERR H5E_DATATYPE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Tmodule_H */ + diff --git a/src/H5Tnative.c b/src/H5Tnative.c index bf6ba08..229fe94 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -18,10 +18,7 @@ * a "native" datatype for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_native_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -43,27 +40,6 @@ static H5T_t* H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, static herr_t H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size, size_t nelems, size_t align, size_t *struct_align); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_native_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_native_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_native_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_native_interface() */ /*------------------------------------------------------------------------- @@ -168,7 +144,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) @@ -571,7 +547,7 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, H5T_NATIVE_INT_MATCH_LLONG, H5T_NATIVE_INT_MATCH_UNKNOWN } match = H5T_NATIVE_INT_MATCH_UNKNOWN; - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -711,7 +687,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig #endif H5T_NATIVE_FLOAT_MATCH_UNKNOWN } match=H5T_NATIVE_FLOAT_MATCH_UNKNOWN; - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -829,7 +805,7 @@ H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_a hid_t tid=(-1); /* Datatype ID of appropriate native datatype */ size_t align=0; /* Alignment necessary for native datatype */ size_t native_size=0; /* Datatype size of the native type */ - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Toffset.c b/src/H5Toffset.c index ea4b3b5..cc45d8e 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -18,10 +18,7 @@ * the datatype offset for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_offset_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -32,27 +29,6 @@ /* Static local functions */ static herr_t H5T_set_offset(const H5T_t *dt, size_t offset); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_offset_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_offset_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_offset_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_offset_interface() */ /*------------------------------------------------------------------------- @@ -138,7 +114,7 @@ done: int H5T_get_offset(const H5T_t *dt) { - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(-1) diff --git a/src/H5Toh.c b/src/H5Toh.c index abf8a51..9c8ad80 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -102,7 +102,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 @@ -133,7 +133,7 @@ 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 */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -173,7 +173,7 @@ 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 */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -217,7 +217,7 @@ static H5O_loc_t * H5O_dtype_get_oloc(hid_t obj_id) { H5T_t *type; /* Datatype opened */ - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Topaque.c b/src/H5Topaque.c index f37d14b..9cc22c9 100644 --- a/src/H5Topaque.c +++ b/src/H5Topaque.c @@ -18,10 +18,7 @@ * datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_opaque_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -30,27 +27,6 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Tpkg.h" /* Datatypes */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_opaque_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_opaque_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_opaque_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_opaque_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Torder.c b/src/H5Torder.c index 35be454..6c9c55c 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_order_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -79,27 +76,6 @@ static herr_t H5T_set_order(H5T_t *dtype, H5T_order_t order); -/*-------------------------------------------------------------------------- -NAME - H5T_init_order_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_order_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_order_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_order_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_order * diff --git a/src/H5Tpad.c b/src/H5Tpad.c index 38de494..e636a84 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -18,10 +18,7 @@ * the datatype padding for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_pad_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -29,27 +26,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Tpkg.h" /* Datatypes */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_pad_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_pad_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_pad_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_pad_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 0b0cd61..0bd1e06 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -21,7 +21,7 @@ * the H5T package. Source files outside the H5T package should * include H5Tprivate.h instead. */ -#ifndef H5T_PACKAGE +#if !(defined H5T_FRIEND || defined H5T_MODULE) #error "Do not include this file outside the H5T package!" #endif @@ -424,7 +424,7 @@ H5FL_EXTERN(H5T_t); H5FL_EXTERN(H5T_shared_t); /* Common functions */ -H5_DLL herr_t H5T__term_deprec_interface(void); +H5_DLL herr_t H5T__init_native(void); H5_DLL H5T_t *H5T__create(H5T_class_t type, size_t size); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index 73a4e32..be85491 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -18,10 +18,7 @@ * the datatype precision for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_precis_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -32,27 +29,6 @@ /* Static local functions */ static herr_t H5T_set_precision(const H5T_t *dt, size_t prec); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_precis_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_precis_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_precis_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_precis_interface() */ /*------------------------------------------------------------------------- @@ -119,7 +95,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) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 558afaf..93fe599 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -34,17 +34,17 @@ #define H5T_ELEM_BUF_SIZE 256 /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5T_PACKAGE +#ifdef H5T_MODULE #define H5T_GET_SIZE(T) ((T)->shared->size) #define H5T_GET_SHARED(T) ((T)->shared) #define H5T_GET_MEMBER_OFFSET(T, I) ((T)->u.compnd.memb[I].offset) #define H5T_GET_MEMBER_SIZE(T, I) ((T)->u.compnd.memb[I].shared->size) -#else /* H5T_PACKAGE */ +#else /* H5T_MODULE */ #define H5T_GET_SIZE(T) (H5T_get_size(T)) #define H5T_GET_SHARED(T) (H5T_get_shared(T)) #define H5T_GET_MEMBER_OFFSET(T, I) (H5T_get_member_offset((T), (I))) #define H5T_GET_MEMBER_SIZE(T, I) (H5T_get_member_size((T), (I))) -#endif /* H5T_PACKAGE */ +#endif /* H5T_MODULE */ /* Forward references of package typedefs (declared in H5Tpkg.h) */ typedef struct H5T_t H5T_t; @@ -104,7 +104,6 @@ struct H5O_t; H5_DLLVAR H5T_order_t H5T_native_order_g; /* Private functions */ -H5_DLL herr_t H5TN_init_interface(void); H5_DLL herr_t H5T_init(void); H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c index c71827b..2cd1db4 100644 --- a/src/H5Tstrpad.c +++ b/src/H5Tstrpad.c @@ -18,10 +18,7 @@ * the datatype string padding for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_strpad_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -29,27 +26,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Tpkg.h" /* Datatypes */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_strpad_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_strpad_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_strpad_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_strpad_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tvisit.c b/src/H5Tvisit.c index 4ede3f3..d732fb3 100644 --- a/src/H5Tvisit.c +++ b/src/H5Tvisit.c @@ -35,7 +35,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 64337b8..26346d6 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -18,10 +18,7 @@ * datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_vlen_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -64,27 +61,6 @@ static H5T_vlen_alloc_info_t H5T_vlen_def_vl_alloc_info ={ H5D_VLEN_FREE_INFO }; - -/*-------------------------------------------------------------------------- -NAME - H5T_init_vlen_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_vlen_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_vlen_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_vlen_interface() */ /*------------------------------------------------------------------------- @@ -147,8 +123,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 @@ -781,7 +757,7 @@ 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 */ + size_t seq_len = 0; /* Sequence length */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -13,10 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5Z_init_interface +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -57,6 +54,9 @@ typedef enum { H5Z_PRELUDE_SET_LOCAL /* Call "set local" callback */ } H5Z_prelude_type_t; +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Local variables */ static size_t H5Z_table_alloc_g = 0; static size_t H5Z_table_used_g = 0; @@ -73,7 +73,7 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key); /*------------------------------------------------------------------------- - * Function: H5Z_init_interface + * Function: H5Z__init_package * * Purpose: Initializes the data filter layer. * @@ -82,45 +82,43 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key); * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -H5Z_init_interface (void) +herr_t +H5Z__init_package(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Internal filters */ - if (H5Z_register (H5Z_SHUFFLE)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") - if (H5Z_register (H5Z_FLETCHER32)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") - if (H5Z_register (H5Z_NBIT)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter") - if (H5Z_register (H5Z_SCALEOFFSET)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter") + if(H5Z_register(H5Z_SHUFFLE) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") + if(H5Z_register(H5Z_FLETCHER32) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") + if(H5Z_register(H5Z_NBIT) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter") + if(H5Z_register(H5Z_SCALEOFFSET) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter") /* External filters */ #ifdef H5_HAVE_FILTER_DEFLATE - if (H5Z_register (H5Z_DEFLATE)<0) + if(H5Z_register(H5Z_DEFLATE) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter") #endif /* H5_HAVE_FILTER_DEFLATE */ #ifdef H5_HAVE_FILTER_SZIP H5Z_SZIP->encoder_present = SZ_encoder_enabled(); - if (H5Z_register (H5Z_SZIP)<0) + if(H5Z_register(H5Z_SZIP) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter") #endif /* H5_HAVE_FILTER_SZIP */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5Z__init_package() */ /*------------------------------------------------------------------------- - * Function: H5Z_term_interface + * Function: H5Z_term_package * * Purpose: Terminate the H5Z layer. * @@ -129,44 +127,44 @@ done: * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int -H5Z_term_interface(void) +H5Z_term_package(void) { -#ifdef H5Z_DEBUG - size_t i; - int dir, nprint=0; - char comment[16], bandwidth[32]; -#endif + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { #ifdef H5Z_DEBUG - if (H5DEBUG(Z)) { - for (i=0; i<H5Z_table_used_g; i++) { - for (dir=0; dir<2; dir++) { - if (0==H5Z_stat_table_g[i].stats[dir].total) continue; + char comment[16], bandwidth[32]; + int dir, nprint = 0; + size_t i; - if (0==nprint++) { + if(H5DEBUG(Z)) { + for(i = 0; i < H5Z_table_used_g; i++) { + for(dir = 0; dir<2; dir++) { + if(0 == H5Z_stat_table_g[i].stats[dir].total) + continue; + + if(0 == nprint++) { /* Print column headers */ - HDfprintf (H5DEBUG(Z), "H5Z: filter statistics " + HDfprintf(H5DEBUG(Z), "H5Z: filter statistics " "accumulated over life of library:\n"); - HDfprintf (H5DEBUG(Z), + HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total", "Errors", "User", "System", "Elapsed", "Bandwidth"); - HDfprintf (H5DEBUG(Z), + 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); - comment[sizeof(comment)-1] = '\0'; + HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); + comment[sizeof(comment) - 1] = '\0'; /* * Format bandwidth to have four significant digits and @@ -178,7 +176,7 @@ H5Z_term_interface(void) H5Z_stat_table_g[i].stats[dir].timer.etime); /* Print the statistics */ - HDfprintf (H5DEBUG(Z), + HDfprintf(H5DEBUG(Z), " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f " "%10s\n", dir?"<":">", comment, H5Z_stat_table_g[i].stats[dir].total, @@ -187,21 +185,28 @@ H5Z_term_interface(void) H5Z_stat_table_g[i].stats[dir].timer.stime, H5Z_stat_table_g[i].stats[dir].timer.etime, bandwidth); - } - } - } + } /* end for */ + } /* end for */ + } /* end if */ #endif /* H5Z_DEBUG */ /* Free the table of filters */ - H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); + if(H5Z_table_g) { + H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); #ifdef H5Z_DEBUG - H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g); + H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g); #endif /* H5Z_DEBUG */ - H5Z_table_used_g = H5Z_table_alloc_g = 0; - H5_interface_initialize_g = 0; + H5Z_table_used_g = H5Z_table_alloc_g = 0; + + n++; + } /* end if */ + + /* Mark interface as closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ - return(0); -} /* end H5Z_term_interface() */ + FUNC_LEAVE_NOAPI(n) +} /* end H5Z_term_package() */ /*------------------------------------------------------------------------- @@ -825,8 +830,8 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") - /* Get layout information */ - if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) + /* Peek at the layout information */ + if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ @@ -834,7 +839,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */ /* Get I/O pipeline information */ - if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) + if(H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ @@ -1445,8 +1450,8 @@ done: 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) diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index 06d9866..15aac27 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -18,7 +18,7 @@ * Friday, August 27, 1999 */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -77,7 +77,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, { 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 1877ddd..690d7a2 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -14,11 +14,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu<slu@ncsa.uiuc.edu> + * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> * Jan 3, 2003 */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -81,7 +81,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un 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/H5Zmodule.h b/src/H5Zmodule.h new file mode 100644 index 0000000..fa0ef8f --- /dev/null +++ b/src/H5Zmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5Z package. Including this header means that the source file + * is part of the H5Z package. + */ +#ifndef _H5Zmodule_H +#define _H5Zmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5Z_MODULE +#define H5_MY_PKG H5Z +#define H5_MY_PKG_ERR H5E_PLINE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Zmodule_H */ + diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 479cd6c..e2fb300 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ diff --git a/src/H5Zpkg.h b/src/H5Zpkg.h index e2cec89..aa2ffe2 100644 --- a/src/H5Zpkg.h +++ b/src/H5Zpkg.h @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5Z_PACKAGE +#if !(defined H5Z_FRIEND || defined H5Z_MODULE) #error "Do not include this file outside the H5Z package!" #endif diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 46dd3c1..7de0060 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ @@ -746,7 +746,7 @@ 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 ret_value = t_bad; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index 654a7d5..3fa6c8d 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -135,7 +135,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], 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 ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) diff --git a/src/H5Zszip.c b/src/H5Zszip.c index f0d08d8..2c2ed07 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index db61cc5..42d6ceb 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -255,8 +255,14 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); else \ { \ ret_value->type = (TYPE); \ - ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers); \ - ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \ + if(tree->lchild) \ + ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers); \ + else \ + ret_value->lchild = NULL; \ + if(tree->rchild) \ + ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \ + else \ + ret_value->rchild = NULL; \ } \ } @@ -542,7 +548,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) @@ -581,7 +587,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 @@ -675,7 +681,7 @@ 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 *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -775,7 +781,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 @@ -787,7 +793,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); + sscanf(current->tok_begin, "%ld", &factor->value.int_val); break; case H5Z_XFORM_FLOAT: @@ -795,7 +801,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); + sscanf(current->tok_begin, "%lf", &factor->value.float_val); break; case H5Z_XFORM_SYMBOL: @@ -804,7 +810,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") - factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); + factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); dat_val_pointers->num_ptrs++; break; @@ -814,11 +820,11 @@ 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") - current = H5Z_get_token(current); + current = H5Z_get_token(current); if (current->tok_type != H5Z_XFORM_RPAREN) { - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") } break; @@ -917,7 +923,7 @@ done: 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 @@ -1296,14 +1302,11 @@ 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") - - - done: - FUNC_LEAVE_NOAPI(ret_value) +done: + FUNC_LEAVE_NOAPI(ret_value) } @@ -1477,10 +1480,10 @@ H5Z_do_op(H5Z_node* tree) H5Z_data_xform_t * H5Z_xform_create(const char *expr) { - H5Z_data_xform_t *data_xform_prop=NULL; - H5Z_data_xform_t *ret_value; + H5Z_data_xform_t *data_xform_prop = NULL; unsigned int i; unsigned int count = 0; + H5Z_data_xform_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1513,7 +1516,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") @@ -1609,8 +1612,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 @@ -1696,7 +1697,7 @@ done: hbool_t H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop) { - hbool_t ret_value; + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5config.h.in b/src/H5config.h.in deleted file mode 100644 index 9363813..0000000 --- a/src/H5config.h.in +++ /dev/null @@ -1,641 +0,0 @@ -/* src/H5config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define if the memory buffers being written to disk should be cleared before - writing. */ -#undef CLEAR_MEMORY - -/* Define if C++ compiler recognizes offsetof */ -#undef CXX_HAVE_OFFSETOF - -/* Define the default plugins path to compile */ -#undef DEFAULT_PLUGINDIR - -/* Define if `dev_t' is a scalar */ -#undef DEV_T_IS_SCALAR - -/* Define to dummy `main' function (if any) required to link to the Fortran - libraries. */ -#undef FC_DUMMY_MAIN - -/* Define if F77 and FC dummy `main' functions are identical. */ -#undef FC_DUMMY_MAIN_EQ_F77 - -/* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#undef FC_FUNC - -/* As FC_FUNC, but for C identifiers containing underscores. */ -#undef FC_FUNC_ - -/* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ -#undef FORTRAN_C_LONG_DOUBLE_IS_UNIQUE - -/* Define if we have Fortran C_LONG_DOUBLE */ -#undef FORTRAN_HAVE_C_LONG_DOUBLE - -/* Define if we have Fortran intrinsic C_SIZEOF */ -#undef FORTRAN_HAVE_C_SIZEOF - -/* Define if we have Fortran intrinsic SIZEOF */ -#undef FORTRAN_HAVE_SIZEOF - -/* Define if we have Fortran intrinsic STORAGE_SIZE */ -#undef FORTRAN_HAVE_STORAGE_SIZE - -/* Determine the size of C long double */ -#undef FORTRAN_SIZEOF_LONG_DOUBLE - -/* Define Fortran compiler ID */ -#undef Fortran_COMPILER_ID - -/* Define valid Fortran INTEGER KINDs */ -#undef H5CONFIG_F_IKIND - -/* Define number of valid Fortran INTEGER KINDs */ -#undef H5CONFIG_F_NUM_IKIND - -/* Define number of valid Fortran REAL KINDs */ -#undef H5CONFIG_F_NUM_RKIND - -/* Define valid Fortran REAL KINDs */ -#undef H5CONFIG_F_RKIND - -/* Define valid Fortran REAL KINDs Sizeof */ -#undef H5CONFIG_F_RKIND_SIZEOF - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have the `asprintf' function. */ -#undef HAVE_ASPRINTF - -/* Define if the __attribute__(()) extension is present */ -#undef HAVE_ATTRIBUTE - -/* Define if the compiler understands C99 designated initialization of structs - and unions */ -#undef HAVE_C99_DESIGNATED_INITIALIZER - -/* Define if the compiler understands the __func__ keyword */ -#undef HAVE_C99_FUNC - -/* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME - -/* Define if the function stack tracing code is to be compiled in */ -#undef HAVE_CODESTACK - -/* Define if Darwin or Mac OS X */ -#undef HAVE_DARWIN - -/* Define to 1 if you have the `difftime' function. */ -#undef HAVE_DIFFTIME - -/* Define if the direct I/O virtual file driver (VFD) should be compiled */ -#undef HAVE_DIRECT - -/* Define to 1 if you have the <dirent.h> header file. */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the <dmalloc.h> header file. */ -#undef HAVE_DMALLOC_H - -/* Define if library information should be embedded in the executables */ -#undef HAVE_EMBEDDED_LIBINFO - -/* Define to 1 if you have the <features.h> header file. */ -#undef HAVE_FEATURES_H - -/* Define if support for deflate (zlib) filter is enabled */ -#undef HAVE_FILTER_DEFLATE - -/* Define if support for szip filter is enabled */ -#undef HAVE_FILTER_SZIP - -/* Determine if __float128 is available */ -#undef HAVE_FLOAT128 - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `frexpf' function. */ -#undef HAVE_FREXPF - -/* Define to 1 if you have the `frexpl' function. */ -#undef HAVE_FREXPL - -/* Define to 1 if you have the `fseeko' function. */ -#undef HAVE_FSEEKO - -/* Define to 1 if you have the `fseeko64' function. */ -#undef HAVE_FSEEKO64 - -/* Define to 1 if you have the `fstat64' function. */ -#undef HAVE_FSTAT64 - -/* Define to 1 if you have the `ftello' function. */ -#undef HAVE_FTELLO - -/* Define to 1 if you have the `ftello64' function. */ -#undef HAVE_FTELLO64 - -/* Define to 1 if you have the `ftruncate64' function. */ -#undef HAVE_FTRUNCATE64 - -/* Define if the compiler understands the __FUNCTION__ keyword */ -#undef HAVE_FUNCTION - -/* Determine if INTEGER*16 is available */ -#undef HAVE_Fortran_INTEGER_SIZEOF_16 - -/* Define to 1 if you have the `GetConsoleScreenBufferInfo' function. */ -#undef HAVE_GETCONSOLESCREENBUFFERINFO - -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define to 1 if you have the `getpwuid' function. */ -#undef HAVE_GETPWUID - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `gettextinfo' function. */ -#undef HAVE_GETTEXTINFO - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if the compiler understands inline */ -#undef HAVE_INLINE - -/* Define if library will contain instrumentation to detect correct - optimization operation */ -#undef HAVE_INSTRUMENTED_LIBRARY - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `ioctl' function. */ -#undef HAVE_IOCTL - -/* Define to 1 if you have the <io.h> header file. */ -#undef HAVE_IO_H - -/* Define to 1 if you have the `dl' library (-ldl). */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the `dmalloc' library (-ldmalloc). */ -#undef HAVE_LIBDMALLOC - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `mpe' library (-lmpe). */ -#undef HAVE_LIBMPE - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Define to 1 if you have the `sz' library (-lsz). */ -#undef HAVE_LIBSZ - -/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ -#undef HAVE_LIBWS2_32 - -/* Define to 1 if you have the `z' library (-lz). */ -#undef HAVE_LIBZ - -/* Define to 1 if you have the `longjmp' function. */ -#undef HAVE_LONGJMP - -/* Define to 1 if you have the `lseek64' function. */ -#undef HAVE_LSEEK64 - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if you have the <mach/mach_time.h> header file. */ -#undef HAVE_MACH_MACH_TIME_H - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define if we have MPE support */ -#undef HAVE_MPE - -/* Define to 1 if you have the <mpe.h> header file. */ -#undef HAVE_MPE_H - -/* Define if `MPI_Comm_c2f' and `MPI_Comm_f2c' exists */ -#undef HAVE_MPI_MULTI_LANG_Comm - -/* Define if `MPI_Info_c2f' and `MPI_Info_f2c' exists */ -#undef HAVE_MPI_MULTI_LANG_Info - -/* Define if we have parallel support */ -#undef HAVE_PARALLEL - -/* Define to 1 if you have the <pthread.h> header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the <quadmath.h> header file. */ -#undef HAVE_QUADMATH_H - -/* Define to 1 if you have the `random' function. */ -#undef HAVE_RANDOM - -/* Define to 1 if you have the `rand_r' function. */ -#undef HAVE_RAND_R - -/* Define to 1 if you have the `setjmp' function. */ -#undef HAVE_SETJMP - -/* Define to 1 if you have the <setjmp.h> header file. */ -#undef HAVE_SETJMP_H - -/* Define to 1 if you have the `setsysinfo' function. */ -#undef HAVE_SETSYSINFO - -/* Define to 1 if you have the `siglongjmp' function. */ -#undef HAVE_SIGLONGJMP - -/* Define to 1 if you have the `signal' function. */ -#undef HAVE_SIGNAL - -/* Define to 1 if you have the `sigprocmask' function. */ -#undef HAVE_SIGPROCMASK - -/* Define to 1 if you have the `sigsetjmp' function. */ -#undef HAVE_SIGSETJMP - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if you have the `srandom' function. */ -#undef HAVE_SRANDOM - -/* Define to 1 if you have the `stat64' function. */ -#undef HAVE_STAT64 - -/* Define if `struct stat' has the `st_blocks' field */ -#undef HAVE_STAT_ST_BLOCKS - -/* Define to 1 if you have the <stddef.h> header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define if `struct text_info' is defined */ -#undef HAVE_STRUCT_TEXT_INFO - -/* Define if `struct videoconfig' is defined */ -#undef HAVE_STRUCT_VIDEOCONFIG - -/* Define to 1 if you have the `symlink' function. */ -#undef HAVE_SYMLINK - -/* Define to 1 if you have the `system' function. */ -#undef HAVE_SYSTEM - -/* Define to 1 if you have the <sys/ioctl.h> header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the <sys/resource.h> header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/timeb.h> header file. */ -#undef HAVE_SYS_TIMEB_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <szlib.h> header file. */ -#undef HAVE_SZLIB_H - -/* Define if we have thread safe support */ -#undef HAVE_THREADSAFE - -/* Define if `timezone' is a global variable */ -#undef HAVE_TIMEZONE - -/* Define if the ioctl TIOCGETD is defined */ -#undef HAVE_TIOCGETD - -/* Define if the ioctl TIOGWINSZ is defined */ -#undef HAVE_TIOCGWINSZ - -/* Define to 1 if you have the `tmpfile' function. */ -#undef HAVE_TMPFILE - -/* Define if `tm_gmtoff' is a member of `struct tm' */ -#undef HAVE_TM_GMTOFF - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vasprintf' function. */ -#undef HAVE_VASPRINTF - -/* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF - -/* Define to 1 if you have the `waitpid' function. */ -#undef HAVE_WAITPID - -/* Define if your system has window style path name. */ -#undef HAVE_WINDOW_PATH - -/* Define to 1 if you have the <winsock2.h> header file. */ -#undef HAVE_WINSOCK2_H - -/* Define to 1 if you have the <zlib.h> header file. */ -#undef HAVE_ZLIB_H - -/* Define to 1 if you have the `_getvideoconfig' function. */ -#undef HAVE__GETVIDEOCONFIG - -/* Define to 1 if you have the `_scrsize' function. */ -#undef HAVE__SCRSIZE - -/* Define if the compiler understands __inline */ -#undef HAVE___INLINE - -/* Define if the compiler understands __inline__ */ -#undef HAVE___INLINE__ - -/* Define if HDF5's high-level library headers should be included in hdf5.h */ -#undef INCLUDE_HL - -/* Define if your system can convert long double to (unsigned) long long - values correctly. */ -#undef LDOUBLE_TO_LLONG_ACCURATE - -/* Define if your system converts long double to (unsigned) long values with - special algorithm. */ -#undef LDOUBLE_TO_LONG_SPECIAL - -/* Define if your system can convert (unsigned) long long to long double - values correctly. */ -#undef LLONG_TO_LDOUBLE_CORRECT - -/* Define if your system can convert (unsigned) long to long double values - with special algorithm. */ -#undef LONG_TO_LDOUBLE_SPECIAL - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define if the metadata trace file code is to be compiled in */ -#undef METADATA_TRACE_FILE - -/* Define if we can violate pointer alignment restrictions */ -#undef NO_ALIGNMENT_RESTRICTIONS - -/* Define if deprecated public API symbols are disabled */ -#undef NO_DEPRECATED_SYMBOLS - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Determine the maximum decimal precision in C */ -#undef PAC_C_MAX_REAL_PRECISION - -/* Define Fortran Maximum Real Decimal Precision */ -#undef PAC_FC_MAX_REAL_PRECISION - -/* Width for printf() for type `long long' or `__int64', use `ll' */ -#undef PRINTF_LL_WIDTH - -/* The size of `char', as computed by sizeof. */ -#undef SIZEOF_CHAR - -/* The size of `double', as computed by sizeof. */ -#undef SIZEOF_DOUBLE - -/* The size of `float', as computed by sizeof. */ -#undef SIZEOF_FLOAT - -/* The size of `int', as computed by sizeof. */ -#undef SIZEOF_INT - -/* The size of `int16_t', as computed by sizeof. */ -#undef SIZEOF_INT16_T - -/* The size of `int32_t', as computed by sizeof. */ -#undef SIZEOF_INT32_T - -/* The size of `int64_t', as computed by sizeof. */ -#undef SIZEOF_INT64_T - -/* The size of `int8_t', as computed by sizeof. */ -#undef SIZEOF_INT8_T - -/* The size of `int_fast16_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST16_T - -/* The size of `int_fast32_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST32_T - -/* The size of `int_fast64_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST64_T - -/* The size of `int_fast8_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST8_T - -/* The size of `int_least16_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST16_T - -/* The size of `int_least32_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST32_T - -/* The size of `int_least64_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST64_T - -/* The size of `int_least8_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST8_T - -/* The size of `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* The size of `long double', as computed by sizeof. */ -#undef SIZEOF_LONG_DOUBLE - -/* The size of `long long', as computed by sizeof. */ -#undef SIZEOF_LONG_LONG - -/* The size of `off64_t', as computed by sizeof. */ -#undef SIZEOF_OFF64_T - -/* The size of `off_t', as computed by sizeof. */ -#undef SIZEOF_OFF_T - -/* The size of `ptrdiff_t', as computed by sizeof. */ -#undef SIZEOF_PTRDIFF_T - -/* The size of `short', as computed by sizeof. */ -#undef SIZEOF_SHORT - -/* The size of `size_t', as computed by sizeof. */ -#undef SIZEOF_SIZE_T - -/* The size of `ssize_t', as computed by sizeof. */ -#undef SIZEOF_SSIZE_T - -/* The size of `uint16_t', as computed by sizeof. */ -#undef SIZEOF_UINT16_T - -/* The size of `uint32_t', as computed by sizeof. */ -#undef SIZEOF_UINT32_T - -/* The size of `uint64_t', as computed by sizeof. */ -#undef SIZEOF_UINT64_T - -/* The size of `uint8_t', as computed by sizeof. */ -#undef SIZEOF_UINT8_T - -/* The size of `uint_fast16_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST16_T - -/* The size of `uint_fast32_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST32_T - -/* The size of `uint_fast64_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST64_T - -/* The size of `uint_fast8_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST8_T - -/* The size of `uint_least16_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST16_T - -/* The size of `uint_least32_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST32_T - -/* The size of `uint_least64_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST64_T - -/* The size of `uint_least8_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST8_T - -/* The size of `unsigned', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED - -/* The size of `_Quad', as computed by sizeof. */ -#undef SIZEOF__QUAD - -/* The size of `__float128', as computed by sizeof. */ -#undef SIZEOF___FLOAT128 - -/* The size of `__int64', as computed by sizeof. */ -#undef SIZEOF___INT64 - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if strict file format checks are enabled */ -#undef STRICT_FORMAT_CHECKS - -/* Define if your system supports pthread_attr_setscope(&attribute, - PTHREAD_SCOPE_SYSTEM) call. */ -#undef SYSTEM_SCOPE_THREADS - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define using v1.6 public API symbols by default */ -#undef USE_16_API_DEFAULT - -/* Define if a memory checking tool will be used on the library, to cause - library to be very picky about memory operations and also disable the - internal free list manager code. */ -#undef USING_MEMCHECKER - -/* Version number of package */ -#undef VERSION - -/* Data accuracy is prefered to speed during data conversions */ -#undef WANT_DATA_ACCURACY - -/* Check exception handling functions during data conversions */ -#undef WANT_DCONV_EXCEPTION - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long int' if <sys/types.h> does not define. */ -#undef off_t - -/* Define to `long' if <sys/types.h> does not define. */ -#undef ptrdiff_t - -/* Define to `unsigned long' if <sys/types.h> does not define. */ -#undef size_t - -/* Define to `long' if <sys/types.h> does not define. */ -#undef ssize_t diff --git a/src/H5detect.c b/src/H5detect.c index 5daf883..ee02c52 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -608,7 +608,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /* Module Setup */\n\ /****************/\n\ \n\ -#define H5T_PACKAGE /*suppress error about including H5Tpkg.h*/\n\ +#include \"H5Tmodule.h\" /* This source code file is part of the H5T module */\n\ \n\ \n\ /***********/\n\ @@ -667,7 +667,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) printf("\n\ \n\ /*-------------------------------------------------------------------------\n\ - * Function: H5TN_init_interface\n\ + * Function: H5T__init_native\n\ *\n\ * Purpose: Initialize pre-defined native datatypes from code generated\n\ * during the library configuration by H5detect.\n\ @@ -681,12 +681,12 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) *-------------------------------------------------------------------------\n\ */\n\ herr_t\n\ -H5TN_init_interface(void)\n\ +H5T__init_native(void)\n\ {\n\ H5T_t *dt = NULL;\n\ herr_t ret_value = SUCCEED;\n\ \n\ - FUNC_ENTER_NOAPI(FAIL)\n"); + FUNC_ENTER_PACKAGE\n"); for(i = 0; i < nd; i++) { /* The native endianess of this machine */ @@ -809,7 +809,7 @@ done:\n\ } /* end if */\n\ } /* end if */\n\ \n\ - FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5TN_init_interface() */\n"); + FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5T__init_native() */\n"); /* Print the ALIGNMENT and signal-handling status as comments */ printf("\n" diff --git a/src/H5overflow.h b/src/H5overflow.h deleted file mode 100644 index dc4ed2d..0000000 --- a/src/H5overflow.h +++ /dev/null @@ -1,2254 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* 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. - */ - -/* Assignment checks for unsigned */ - -/* 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) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_INT - #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) -#endif /* src: unsigned dst: int */ - -/* src: unsigned, dst: int64_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_INT64_T - #define ASSIGN_unsigned_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_INT64_T - #define ASSIGN_unsigned_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_INT64_T */ - #define ASSIGN_unsigned_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: unsigned 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) -#elif H5_SIZEOF_INT > H5_SIZEOF_UNSIGNED - #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) -#endif /* src: int dst: unsigned */ - -/* src: int, dst: int64_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_INT64_T - #define ASSIGN_int_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_INT64_T - #define ASSIGN_int_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_INT64_T */ - #define ASSIGN_int_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: int64_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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: int dst: h5_stat_size_t */ - - -/* Assignment checks for int64_t */ - -/* src: int64_t, dst: unsigned */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_int64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_int64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_int64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: unsigned */ - -/* src: int64_t, dst: int */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_INT - #define ASSIGN_int64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_INT - #define ASSIGN_int64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_INT */ - #define ASSIGN_int64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: int */ - -/* src: int64_t, dst: uint8_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT8_T - #define ASSIGN_int64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT8_T - #define ASSIGN_int64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_int64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint8_t */ - -/* src: int64_t, dst: uint16_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT16_T - #define ASSIGN_int64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT16_T - #define ASSIGN_int64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_int64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint16_t */ - -/* src: int64_t, dst: uint32_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT32_T - #define ASSIGN_int64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT32_T - #define ASSIGN_int64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_int64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint32_t */ - -/* src: int64_t, dst: uint64_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT64_T - #define ASSIGN_int64_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT64_T - #define ASSIGN_int64_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_int64_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint64_t */ - -/* src: int64_t, dst: ptrdiff_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_int64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_int64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_int64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: ptrdiff_t */ - -/* src: int64_t, dst: size_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_SIZE_T - #define ASSIGN_int64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_SIZE_T - #define ASSIGN_int64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_int64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: size_t */ - -/* src: int64_t, dst: ssize_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_int64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_int64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_int64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: ssize_t */ - -/* src: int64_t, dst: haddr_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_HADDR_T - #define ASSIGN_int64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_HADDR_T - #define ASSIGN_int64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_int64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: haddr_t */ - -/* src: int64_t, dst: hsize_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_int64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_int64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_int64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: hsize_t */ - -/* src: int64_t, dst: hssize_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_int64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_int64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_int64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: hssize_t */ - -/* src: int64_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_int64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_int64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_int64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t 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) -#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) -#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) -#endif /* src: uint8_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: uint8_t dst: int */ - -/* src: uint8_t, dst: int64_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint8_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint8_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint8_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: uint16_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: uint16_t dst: int */ - -/* src: uint16_t, dst: int64_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint16_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint16_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint16_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: uint32_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: uint32_t dst: int */ - -/* src: uint32_t, dst: int64_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint32_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint32_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint32_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: uint64_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: uint64_t dst: int */ - -/* src: uint64_t, dst: int64_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint64_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint64_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint64_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: ptrdiff_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: ptrdiff_t dst: int */ - -/* src: ptrdiff_t, dst: int64_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_INT64_T - #define ASSIGN_ptrdiff_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_INT64_T - #define ASSIGN_ptrdiff_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_ptrdiff_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: size_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: size_t dst: int */ - -/* src: size_t, dst: int64_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: ssize_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: ssize_t dst: int */ - -/* src: ssize_t, dst: int64_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_ssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_ssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_ssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: haddr_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: haddr_t dst: int */ - -/* src: haddr_t, dst: int64_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_INT64_T - #define ASSIGN_haddr_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_INT64_T - #define ASSIGN_haddr_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_haddr_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: hsize_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: hsize_t dst: int */ - -/* src: hsize_t, dst: int64_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_hsize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_hsize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_hsize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: hssize_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: hssize_t dst: int */ - -/* src: hssize_t, dst: int64_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_hssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_hssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_hssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: h5_stat_size_t dst: unsigned */ - -/* 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) -#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) -#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) -#endif /* src: h5_stat_size_t dst: int */ - -/* src: h5_stat_size_t, dst: int64_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_h5_stat_size_t_TO_int64_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_INT64_T - #define ASSIGN_h5_stat_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_h5_stat_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: int64_t */ - -/* 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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#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) -#endif /* src: h5_stat_size_t dst: hssize_t */ - -#endif /* H5overflow_H */ - diff --git a/src/H5private.h b/src/H5private.h index 738d4ff..56061bf 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1463,6 +1463,16 @@ extern char *strdup(const char *s); #define HDpthread_self_ulong() ((unsigned long)pthread_self()) #endif /* HDpthread_self_ulong */ +/* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ +/* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ +#define H5_STRINGIZE(x) #x +#define H5_TOSTRING(x) H5_STRINGIZE(x) + +/* Macro for "glueing" together items, for re-scanning macros */ +#define H5_GLUE(x,y) x##y +#define H5_GLUE3(x,y,z) x##y##z +#define H5_GLUE4(w,x,y,z) w##x##y##z + /* * A macro for detecting over/under-flow when casting between types */ @@ -1782,10 +1792,12 @@ extern char H5_lib_vers_info_g[]; typedef struct H5_api_struct { H5TS_mutex_t init_lock; /* API entrance mutex */ hbool_t H5_libinit_g; /* Has the library been initialized? */ + hbool_t H5_libterm_g; /* Is the library being shutdown? */ } H5_api_t; /* Macros for accessing the global variables */ -#define H5_INIT_GLOBAL H5_g.H5_libinit_g +#define H5_INIT_GLOBAL (H5_g.H5_libinit_g) +#define H5_TERM_GLOBAL (H5_g.H5_libterm_g) /* Macro for first thread initialization */ #ifdef H5_HAVE_WIN_THREADS @@ -1824,9 +1836,11 @@ extern H5_api_t H5_g; /* extern global variables */ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ +extern hbool_t H5_libterm_g; /* Is the library being shutdown? */ /* Macros for accessing the global variables */ -#define H5_INIT_GLOBAL H5_libinit_g +#define H5_INIT_GLOBAL (H5_libinit_g) +#define H5_TERM_GLOBAL (H5_libterm_g) #endif /* H5_HAVE_THREADSAFE */ @@ -1846,101 +1860,110 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ #endif -/* Macros for defining interface initialization routines */ -#ifdef H5_INTERFACE_INIT_FUNC -static int H5_interface_initialize_g = 0; -static herr_t H5_INTERFACE_INIT_FUNC(void); -#define H5_INTERFACE_INIT(err) \ - /* Initialize this interface or bust */ \ - if (!H5_interface_initialize_g) { \ - H5_interface_initialize_g = 1; \ - if (H5_INTERFACE_INIT_FUNC()<0) { \ - H5_interface_initialize_g = 0; \ - HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "interface initialization failed") \ - } \ - } -#else /* H5_INTERFACE_INIT_FUNC */ -#define H5_INTERFACE_INIT(err) -#endif /* H5_INTERFACE_INIT_FUNC */ +/* Macros for referencing package initialization symbols */ +#define H5_PACKAGE_INIT_VAR(x) H5_GLUE(x, _init_g) +#define H5_PACKAGE_INIT_FUNC(x) H5_GLUE(x, __init_package) + +/* Macros for defining package initialization routines */ +#ifdef H5_MY_PKG +#define H5_PKG_INIT_VAR H5_PACKAGE_INIT_VAR(H5_MY_PKG) +#define H5_PKG_INIT_FUNC H5_PACKAGE_INIT_FUNC(H5_MY_PKG) +#define H5_PACKAGE_YES_INIT(err) \ + /* Initialize this interface or bust */ \ + if(!H5_PKG_INIT_VAR && !H5_TERM_GLOBAL) { \ + H5_PKG_INIT_VAR = TRUE; \ + if(H5_PKG_INIT_FUNC() < 0) { \ + H5_PKG_INIT_VAR = FALSE; \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "interface initialization failed") \ + } \ + } +#define H5_PACKAGE_NO_INIT(err) \ + /* Initialize this interface or bust */ \ + if(!H5_PKG_INIT_VAR && !H5_TERM_GLOBAL) \ + H5_PKG_INIT_VAR = TRUE; +#define H5_PACKAGE_INIT(pkg_init, err) H5_GLUE3(H5_PACKAGE_, pkg_init, _INIT)(err) +#else /* H5_MY_PKG */ +#define H5_PKG_INIT_VAR (TRUE) +#define H5_PACKAGE_INIT(pkg_init, err) +#endif /* H5_MY_PKG */ #ifndef NDEBUG -#define FUNC_ENTER_CHECK_NAME(asrt) \ - { \ - static hbool_t func_check = FALSE; \ +#define FUNC_ENTER_CHECK_NAME(asrt) \ + { \ + static hbool_t func_check = FALSE; \ \ - if(!func_check) { \ - /* Check function naming status */ \ - HDassert(asrt); \ + if(!func_check) { \ + /* Check function naming status */ \ + HDassert(asrt); \ \ - /* Don't check again */ \ - func_check = TRUE; \ - } /* end if */ \ + /* Don't check again */ \ + func_check = TRUE; \ + } /* end if */ \ } /* end scope */ #else /* NDEBUG */ #define FUNC_ENTER_CHECK_NAME(asrt) #endif /* NDEBUG */ -#define FUNC_ENTER_COMMON(asrt) \ - hbool_t err_occurred = FALSE; \ +#define FUNC_ENTER_COMMON(asrt) \ + hbool_t err_occurred = FALSE; \ + \ FUNC_ENTER_CHECK_NAME(asrt); -#define FUNC_ENTER_COMMON_NOERR(asrt) \ +#define FUNC_ENTER_COMMON_NOERR(asrt) \ FUNC_ENTER_CHECK_NAME(asrt); /* Threadsafety initialization code for API routines */ #define FUNC_ENTER_API_THREADSAFE \ - /* Initialize the thread-safe code */ \ + /* Initialize the thread-safe code */ \ H5_FIRST_THREAD_INIT \ - \ - /* Grab the mutex for the library */ \ + \ + /* Grab the mutex for the library */ \ H5_API_UNSET_CANCEL \ H5_API_LOCK /* Local variables for API routines */ #define FUNC_ENTER_API_VARS \ - MPE_LOG_VARS \ + MPE_LOG_VARS \ H5TRACE_DECL -#define FUNC_ENTER_API_COMMON \ +#define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ FUNC_ENTER_API_THREADSAFE; -#define FUNC_ENTER_API_INIT(err) \ - /* Initialize the library */ \ - if(!(H5_INIT_GLOBAL)) { \ - H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) \ - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \ - "library initialization failed") \ - } \ +#define FUNC_ENTER_API_INIT(err) \ + /* Initialize the library */ \ + if(!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \ + H5_INIT_GLOBAL = TRUE; \ + if(H5_init_library() < 0) \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed") \ + } /* end if */ \ \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ + /* Initialize the package, if appropriate */ \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - BEGIN_MPE_LOG + BEGIN_MPE_LOG /* Use this macro for all "normal" API functions */ -#define FUNC_ENTER_API(err) {{ \ +#define FUNC_ENTER_API(err) {{ \ FUNC_ENTER_API_COMMON \ - FUNC_ENTER_API_INIT(err); \ - /* Clear thread error stack entering public functions */ \ - H5E_clear_stack(NULL); \ + FUNC_ENTER_API_INIT(err); \ + /* Clear thread error stack entering public functions */ \ + H5E_clear_stack(NULL); \ { /* * Use this macro for API functions that shouldn't clear the error stack * like H5Eprint and H5Ewalk. */ -#define FUNC_ENTER_API_NOCLEAR(err) {{ \ +#define FUNC_ENTER_API_NOCLEAR(err) {{ \ FUNC_ENTER_API_COMMON \ - FUNC_ENTER_API_INIT(err); \ + FUNC_ENTER_API_INIT(err); \ { /* @@ -1949,7 +1972,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * are: H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT {{ \ +#define FUNC_ENTER_API_NOINIT {{ \ FUNC_ENTER_API_COMMON \ H5_PUSH_FUNC \ BEGIN_MPE_LOG \ @@ -1962,38 +1985,120 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * are: H5close, H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ +#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ - FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ + FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG \ { /* Note: this macro only works when there's _no_ interface initialization routine for the module */ -#define FUNC_ENTER_NOAPI_INIT(err) \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ +#define FUNC_ENTER_NOAPI_INIT(err) \ + /* Initialize the package, if appropriate */ \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC /* Use this macro for all "normal" non-API functions */ -#define FUNC_ENTER_NOAPI(err) { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - FUNC_ENTER_NOAPI_INIT(err) \ - { +#define FUNC_ENTER_NOAPI(err) { \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_NOAPI_INIT(err) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* Use this macro for all non-API functions, which propagate errors, but don't issue them */ +#define FUNC_ENTER_NOAPI_NOERR { \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_NOAPI_INIT(-) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - static functions, since they must be called from a function in the + * interface, the library and interface must already be + * initialized. + * - functions which are called during library shutdown, since we don't + * want to re-initialize the library. + */ +#define FUNC_ENTER_NOAPI_NOINIT { \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + H5_PUSH_FUNC \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - static functions, since they must be called from a function in the + * interface, the library and interface must already be + * initialized. + * - functions which are called during library shutdown, since we don't + * want to re-initialize the library. + * - functions that propagate, but don't issue errors + */ +#define FUNC_ENTER_NOAPI_NOINIT_NOERR { \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + H5_PUSH_FUNC \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - functions which shouldn't push their name on the function stack + * (so far, just the H5CS routines themselves) + * + */ +#define FUNC_ENTER_NOAPI_NOFS { \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + \ + /* Initialize the package, if appropriate */ \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - functions which shouldn't push their name on the function stack + * (so far, just the H5CS routines themselves) + * + * This macro is used for functions which fit the above categories _and_ + * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack) + * + */ +#define FUNC_ENTER_NOAPI_NOERR_NOFS { \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI + * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set + * up a metadata tag. */ +#define FUNC_ENTER_NOAPI_TAG(dxpl_id, tag, err) { \ + haddr_t prev_tag = HADDR_UNDEF; \ + hid_t tag_dxpl_id = dxpl_id; \ + \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ + FUNC_ENTER_NOAPI_INIT(err) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +#define FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, tag, err) { \ + haddr_t prev_tag = HADDR_UNDEF; \ + hid_t tag_dxpl_id = dxpl_id; \ + \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ + H5_PUSH_FUNC \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for all "normal" package-level functions */ #define FUNC_ENTER_PACKAGE { \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ - { + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ - { + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use the following macro as replacement for the FUNC_ENTER_PACKAGE * macro when the function needs to set up a metadata tag. */ @@ -2003,21 +2108,27 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ if(H5AC_tag(tag_dxpl_id, tag, &prev_tag) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ H5_PUSH_FUNC \ - { + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC { \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ - { + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ - { + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ +/* And that shouldn't push their name on the function stack */ +#define FUNC_ENTER_STATIC_NOERR_NOFS { \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use the following macro as replacement for the FUNC_ENTER_STATIC * macro when the function needs to set up a metadata tag. */ @@ -2027,76 +2138,9 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ if(H5AC_tag(tag_dxpl_id, tag, &prev_tag) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ H5_PUSH_FUNC \ - { - -/* Use this macro for all non-API functions, which propagate errors, but don't issue them */ -#define FUNC_ENTER_NOAPI_NOERR { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ - FUNC_ENTER_NOAPI_INIT(-) \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - static functions, since they must be called from a function in the - * interface, the library and interface must already be - * initialized. - * - functions which are called during library shutdown, since we don't - * want to re-initialize the library. - */ -#define FUNC_ENTER_NOAPI_NOINIT { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - H5_PUSH_FUNC \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - static functions, since they must be called from a function in the - * interface, the library and interface must already be - * initialized. - * - functions which are called during library shutdown, since we don't - * want to re-initialize the library. - * - functions that propagate, but don't issue errors - */ -#define FUNC_ENTER_NOAPI_NOINIT_NOERR { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ - H5_PUSH_FUNC \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - functions which shouldn't push their name on the function stack - * (so far, just the H5CS routines themselves) - * - * This macro is used for functions which fit the above categories _and_ - * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack) - * - */ -#define FUNC_ENTER_NOAPI_NOERR_NOFS { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ - { - -/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI - * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set - * up a metadata tag. */ -#define FUNC_ENTER_NOAPI_TAG(dxpl_id, tag, err) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - hid_t tag_dxpl_id = dxpl_id; \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - FUNC_ENTER_NOAPI_INIT(err) \ - { - -#define FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, tag, err) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - hid_t tag_dxpl_id = dxpl_id; \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - H5_PUSH_FUNC \ - { + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /*------------------------------------------------------------------------- @@ -2113,35 +2157,39 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); H5_API_SET_CANCEL #define FUNC_LEAVE_API(ret_value) \ - FINISH_MPE_LOG \ - H5TRACE_RETURN(ret_value); \ - H5_POP_FUNC \ - if(err_occurred) \ - (void)H5E_dump_api_stack(TRUE); \ - FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + FINISH_MPE_LOG \ + H5TRACE_RETURN(ret_value); \ + H5_POP_FUNC \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ + FUNC_LEAVE_API_THREADSAFE \ + return(ret_value); \ }} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ - FINISH_MPE_LOG \ - H5TRACE_RETURN(ret_value); \ - FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + FINISH_MPE_LOG \ + H5TRACE_RETURN(ret_value); \ + FUNC_LEAVE_API_THREADSAFE \ + return(ret_value); \ }} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ - H5_POP_FUNC \ - return(ret_value); \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + H5_POP_FUNC \ + return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI_VOID \ - H5_POP_FUNC \ - return; \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + H5_POP_FUNC \ + return; \ } /*end scope from beginning of FUNC_ENTER*/ /* @@ -2150,135 +2198,146 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * (so far, just the H5CS routines themselves) */ #define FUNC_LEAVE_NOAPI_NOFS(ret_value) \ - return(ret_value); \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ /* Use this macro when exiting a function that set up a metadata tag */ -#define FUNC_LEAVE_NOAPI_TAG(ret_value, err) \ - if(H5AC_tag(tag_dxpl_id, prev_tag, NULL)<0) \ - HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - H5_POP_FUNC \ - return(ret_value); \ - } /*end scope from end of FUNC_ENTER*/ \ +#define FUNC_LEAVE_NOAPI_TAG(ret_value, err) \ + ; \ + } /*end scope from end of FUNC_ENTER*/ \ + if(H5AC_tag(tag_dxpl_id, prev_tag, NULL) < 0) \ + HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + H5_POP_FUNC \ + return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ + /****************************************/ /* Revisions to FUNC_ENTER/LEAVE Macros */ /****************************************/ -/* Macros for referencing package initialization symbols */ -#define H5_PACKAGE_INIT_VAR(x) H5_GLUE3(H5_, x, _init_g) -#define H5_PACKAGE_INIT_FUNC(x) H5_GLUE(x, __pkg_init) - /* Macros to check if a package is initialized */ -#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg)); +#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg)); #define H5_CHECK_PACKAGE_INIT_REG_NO(asrt) #define H5_CHECK_PACKAGE_INIT_INIT_YES(asrt) #define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt) +#define H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) /* Macros to initialize package, if a package initialization routine is defined */ -#define H5_PKG_YES_INIT(pkg) \ - if(!H5_PACKAGE_INIT_VAR(pkg)) { \ - if(H5_GLUE(pkg, _pkg_init)() < 0) { \ - /* (Can't use H5E_THROW here) */ \ +#define H5_PKG_YES_INIT(pkg) \ + if(!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) { \ + H5_PACKAGE_INIT_VAR(pkg) = TRUE; \ + if(H5_PACKAGE_INIT_FUNC(pkg)() < 0) { \ + H5_PACKAGE_INIT_VAR(pkg) = FALSE; \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ } /* end if */ -#define H5_PKG_NO_INIT(pkg) - -/* Macros to declare package initialization symbols, if a package initialization routine is defined */ -#define H5_PKG_YES_INIT_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(H5_MY_PKG); -#define H5_PKG_NO_INIT_VAR(pkg) -#define H5_PKG_YES_INIT_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); -#define H5_PKG_NO_INIT_FUNC(pkg) +#define H5_PKG_NO_INIT(pkg) \ + if(!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) \ + H5_PACKAGE_INIT_VAR(pkg) = TRUE; +#define H5_PKG_INIT(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) + +/* Macros to declare package initialization function, if a package initialization routine is defined */ +#ifdef H5_PKG_SINGLE_SOURCE +#define H5_PKG_DECLARE_YES_FUNC(pkg) static herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); +#else /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_YES_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); +#endif /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_NO_FUNC(pkg) /* Declare package initialization symbols (if in a package) */ -#define H5_DECLARE_PKG_VAR(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT_VAR)(pkg) -#define H5_DECLARE_PKG_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT_FUNC)(pkg) +#ifdef H5_PKG_SINGLE_SOURCE +#define H5_PKG_DECLARE_VAR(pkg) static hbool_t H5_PACKAGE_INIT_VAR(pkg); +#else /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(pkg); +#endif /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_DECLARE_, pkg_init, _FUNC)(pkg) #ifdef H5_MY_PKG -H5_DECLARE_PKG_VAR(H5_MY_PKG_INIT, H5_MY_PKG) -H5_DECLARE_PKG_FUNC(H5_MY_PKG_INIT, H5_MY_PKG) +H5_PKG_DECLARE_VAR(H5_MY_PKG) +H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG) #endif /* H5_MY_PKG */ /* API re-entrance variable */ extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */ /* Macros for entering different scopes of routines */ -#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ - FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \ +#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ + FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* This interface should be initialized already */ \ - /* (except for package initialization routines :-) */ \ - H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ + /* This interface should be initialized already */ \ + /* (except for package initialization routines :-) */ \ + H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ { -#define H5_PRIVATE_ENTER(pkg, pkg_init) \ - FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \ +#define H5_PRIVATE_ENTER(pkg, pkg_init) \ + FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_PKG_INIT(pkg_init, pkg) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{ -#define H5_PUBLIC_ENTER(pkg, pkg_init) \ - FUNC_ENTER_API_VARS \ +#define H5_PUBLIC_ENTER(pkg, pkg_init) \ + FUNC_ENTER_API_VARS \ FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \ + FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \ \ - /* Clear thread error stack when entering public functions */ \ - H5E_clear_stack(NULL); \ + /* Clear thread error stack when entering public functions */ \ + H5E_clear_stack(NULL); \ \ - /* Initialize the library or bust */ \ - if(!(H5_INIT_GLOBAL)) { \ + /* Initialize the library or bust */ \ + if(!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \ H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) { \ - /* (Can't use H5E_THROW here) */ \ + if(H5_init_library() < 0) { \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ + } /* end if */ \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_PKG_INIT(pkg_init, pkg) \ \ - /* Check for re-entering API routine */ \ - HDassert(!H5_api_entered_g); \ - H5_api_entered_g = TRUE; \ + /* Check for re-entering API routine */ \ + HDassert(!H5_api_entered_g); \ + H5_api_entered_g = TRUE; \ \ - /* Start logging MPI's MPE information */ \ - BEGIN_MPE_LOG \ + /* Start logging MPI's MPE information */ \ + BEGIN_MPE_LOG \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{{ /* Macros for substituting the package name */ -#define FUNC_ENT_STATIC H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENT_PKGINIT H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, INIT) -#define FUNC_ENT_PKG H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENT_PRIV H5_PRIVATE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) -#define FUNC_ENT_PUB H5_PUBLIC_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) +#define FUNC_ENT_STATIC(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG) +#define FUNC_ENT_PKGINIT(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, INIT) +#define FUNC_ENT_PKG(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG) +#define FUNC_ENT_PRIV(pkg, pkg_init) H5_PRIVATE_ENTER(pkg, pkg_init) +#define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init) /* Macros for substituting a function prefix */ #define FUNC_PREFIX_STATIC static @@ -2288,23 +2347,23 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through #define FUNC_PREFIX_PUB /* Macros for declaring error variables */ -#define FUNC_ERR_VAR_ERR(ret_typ, err) \ - hbool_t past_catch = FALSE; \ +#define FUNC_ERR_VAR_ERR(ret_typ, err) \ + hbool_t past_catch = FALSE; \ ret_typ fail_value = err; -#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ +#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ hbool_t past_catch = FALSE; #define FUNC_ERR_VAR_NOERR(ret_typ, err) /* Use this macro when entering all functions */ -#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ -H5_GLUE(FUNC_PREFIX_, scope) \ -ret_typ \ -func \ -/* Open function */ \ -{ \ - ret_typ ret_value = ret_init; \ - H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ - H5_GLUE(FUNC_ENT_, scope) +#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ +H5_GLUE(FUNC_PREFIX_, scope) \ +ret_typ \ +func \ +/* Open function */ \ +{ \ + ret_typ ret_value = ret_init; \ + H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ + H5_GLUE(FUNC_ENT_, scope)(H5_MY_PKG, H5_MY_PKG_INIT) /* Macros for label when a function initialization can fail */ #define H5_PRIV_YES_FUNC_INIT_FAILED func_init_failed: @@ -2312,73 +2371,73 @@ func \ #define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED) /* Macros for leaving different scopes of routines */ -#define FUNC_LEAVE_PKGINIT \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKGINIT \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_STATIC \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_STATIC \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PKG \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKG \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PRIV \ - /* Leave scope for this type of function */ \ - }} \ +#define FUNC_LEAVE_PRIV \ + /* Leave scope for this type of function */ \ + }} \ \ - /* Label for errors during FUNC_ENTER */ \ - H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ + /* Label for errors during FUNC_ENTER */ \ + H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PUB \ - /* Leave scope for this type of function */ \ - }}} \ +#define FUNC_LEAVE_PUB \ + /* Leave scope for this type of function */ \ + }}} \ \ - /* Label for errors during FUNC_ENTER */ \ -func_init_failed: \ + /* Label for errors during FUNC_ENTER */ \ +func_init_failed: \ \ - /* Dump error stack if an error occurred during API routine */ \ - if(ret_value == fail_value) \ - (void)H5E_dump_api_stack(TRUE); \ + /* Dump error stack if an error occurred during API routine */ \ + if(ret_value == fail_value) \ + (void)H5E_dump_api_stack(TRUE); \ \ - /* Finish the API tracing info */ \ - H5TRACE_RETURN(ret_value); \ + /* Finish the API tracing info */ \ + H5TRACE_RETURN(ret_value); \ \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC \ \ - /* Finish the MPE tracing info */ \ - FINISH_MPE_LOG \ + /* Finish the MPE tracing info */ \ + FINISH_MPE_LOG \ \ - /* Check for leaving API routine */ \ - HDassert(H5_api_entered_g); \ - H5_api_entered_g = FALSE; \ + /* Check for leaving API routine */ \ + HDassert(H5_api_entered_g); \ + H5_api_entered_g = FALSE; \ \ - /* Release thread-safety semaphore */ \ + /* Release thread-safety semaphore */ \ FUNC_LEAVE_API_THREADSAFE /* Use this macro when leaving all functions */ -#define END_FUNC(scope) \ - /* Scope-specific function conclusion */ \ - H5_GLUE(FUNC_LEAVE_, scope) \ +#define END_FUNC(scope) \ + /* Scope-specific function conclusion */ \ + H5_GLUE(FUNC_LEAVE_, scope) \ \ - /* Leave routine */ \ - return(ret_value); \ + /* Leave routine */ \ + return(ret_value); \ \ - /* Close Function */ \ + /* Close Function */ \ } /* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient). @@ -2387,23 +2446,13 @@ func_init_failed: \ haddr_t prv_tag = HADDR_UNDEF; \ hid_t my_dxpl_id = dxpl; \ if(H5AC_tag(my_dxpl_id, tag, &prv_tag) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") #define H5_END_TAG(err) \ if(H5AC_tag(my_dxpl_id, prv_tag, NULL) <0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ } -/* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ -/* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ -#define H5_STRINGIZE(x) #x -#define H5_TOSTRING(x) H5_STRINGIZE(x) - -/* Macro for "glueing" together items, for re-scanning macros */ -#define H5_GLUE(x,y) x##y -#define H5_GLUE3(x,y,z) x##y##z -#define H5_GLUE4(w,x,y,z) w##x##y##z - /* Compile-time "assert" macro */ #define HDcompile_assert(e) ((void)sizeof(char[ !!(e) ? 1 : -1])) /* Variants that are correct, but generate compile-time warnings in some circumstances: @@ -2416,21 +2465,30 @@ H5_DLL herr_t H5_init_library(void); H5_DLL void H5_term_library(void); /* Functions to terminate interfaces */ -H5_DLL int H5A_term_interface(void); -H5_DLL int H5AC_term_interface(void); -H5_DLL int H5D_term_interface(void); -H5_DLL int H5E_term_interface(void); -H5_DLL int H5F_term_interface(void); -H5_DLL int H5FS_term_interface(void); -H5_DLL int H5G_term_interface(void); -H5_DLL int H5I_term_interface(void); -H5_DLL int H5L_term_interface(void); -H5_DLL int H5P_term_interface(void); -H5_DLL int H5PL_term_interface(void); -H5_DLL int H5R_term_interface(void); -H5_DLL int H5S_term_interface(void); -H5_DLL int H5T_term_interface(void); -H5_DLL int H5Z_term_interface(void); +H5_DLL int H5A_term_package(void); +H5_DLL int H5A_top_term_package(void); +H5_DLL int H5AC_term_package(void); +H5_DLL int H5D_term_package(void); +H5_DLL int H5D_top_term_package(void); +H5_DLL int H5E_term_package(void); +H5_DLL int H5F_term_package(void); +H5_DLL int H5FD_term_package(void); +H5_DLL int H5FL_term_package(void); +H5_DLL int H5FS_term_package(void); +H5_DLL int H5G_term_package(void); +H5_DLL int H5G_top_term_package(void); +H5_DLL int H5I_term_package(void); +H5_DLL int H5L_term_package(void); +H5_DLL int H5P_term_package(void); +H5_DLL int H5PL_term_package(void); +H5_DLL int H5R_term_package(void); +H5_DLL int H5R_top_term_package(void); +H5_DLL int H5S_term_package(void); +H5_DLL int H5S_top_term_package(void); +H5_DLL int H5SL_term_package(void); +H5_DLL int H5T_term_package(void); +H5_DLL int H5T_top_term_package(void); +H5_DLL int H5Z_term_package(void); /* Checksum functions */ H5_DLL uint32_t H5_checksum_fletcher32(const void *data, size_t len); diff --git a/src/H5public.h b/src/H5public.h index 0650988..1c617d1 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 231 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 232 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.231" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.232" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5trace.c b/src/H5trace.c index 66b3a0c..f212bef 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5trace.c - * Aug 21 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5trace.c + * Aug 21 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Internal code for tracing API calls + * Purpose: Internal code for tracing API calls * *------------------------------------------------------------------------- */ @@ -27,18 +27,17 @@ /****************/ /* Module Setup */ /****************/ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ - +#define H5I_FRIEND /*suppress error about including H5Ipkg */ /***********/ /* 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() */ @@ -83,36 +82,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 * *------------------------------------------------------------------------- @@ -120,14 +119,14 @@ double H5_trace(const double *returning, const char *func, const char *type, ...) { - va_list ap; - char buf[64], *rest; - const char *argname; - int argno = 0, ptr, asize_idx; - hssize_t asize[16]; - hssize_t i; - void *vp = NULL; - FILE *out = H5_debug_g.trace; + va_list ap; + char buf[64], *rest; + const char *argname; + int argno = 0, ptr, asize_idx; + hssize_t asize[16]; + hssize_t i; + void *vp = NULL; + FILE *out = H5_debug_g.trace; H5_timer_t event_time; static H5_timer_t first_time = {0.0F, 0.0F, 0.0F}; static int current_depth = 0; @@ -206,48 +205,48 @@ H5_trace(const double *returning, const char *func, const char *type, ...) /* Parse the argument types */ for(argno = 0; *type; argno++, type += (HDisupper(*type) ? 2 : 1)) { - /* Count levels of indirection */ - for(ptr = 0; '*' == *type; type++) + /* Count levels of indirection */ + for(ptr = 0; '*' == *type; type++) ptr++; - if('[' == *type) { - if('a' == type[1]) { - asize_idx = (int)HDstrtol(type + 2, &rest, 10); + if('[' == *type) { + if('a' == type[1]) { + asize_idx = (int)HDstrtol(type + 2, &rest, 10); HDassert(0 <= asize_idx && asize_idx < (int) NELMTS(asize)); - HDassert(']'==*rest); - type = rest + 1; - } else { - rest = (char *)HDstrchr(type, ']'); - HDassert(rest); - type = rest + 1; - asize_idx = -1; - } - } /* end if */ + HDassert(']'==*rest); + type = rest + 1; + } else { + rest = (char *)HDstrchr(type, ']'); + HDassert(rest); + type = rest + 1; + asize_idx = -1; + } + } /* end if */ else - asize_idx = -1; - - /* - * The argument name. Leave off the `_id' part. If the argument - * 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 */ - if(argname) { - unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */ - - if(!HDstrcmp(argname + n, "_id")) { - HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); - buf[MIN((int)sizeof(buf) - 1, n)] = '\0'; - argname = buf; - } /* end if */ - fprintf(out, "%s%s=", argno?", ":"", argname); - } /* end if */ + asize_idx = -1; + + /* + * The argument name. Leave off the `_id' part. If the argument + * 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 */ + if(argname) { + unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */ + + if(!HDstrcmp(argname + n, "_id")) { + HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); + buf[MIN((int)sizeof(buf) - 1, n)] = '\0'; + argname = buf; + } /* end if */ + fprintf(out, "%s%s=", argno?", ":"", argname); + } /* end if */ else - argname = ""; + argname = ""; - /* The value */ - if(ptr) + /* The value */ + if(ptr) vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */ - switch(type[0]) { + switch(type[0]) { case 'a': if(ptr) { if(vp) @@ -268,7 +267,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "0x%lx", (unsigned long)vp); else fprintf(out, "NULL"); - } /* end if */ + } /* end if */ else { hbool_t bool_var = va_arg(ap, hbool_t); /*lint !e732 Loss of sign not really occuring */ @@ -2588,7 +2587,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else fprintf(out, "BADTYPE(%c)", type[0]); goto error; - } /* end switch */ + } /* end switch */ } /* end for */ /* Display event time for return */ @@ -2599,10 +2598,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) error: va_end(ap); if(returning) - fprintf(out, ";\n"); + fprintf(out, ";\n"); else { - last_call_depth = current_depth++; - fprintf (out, ")"); + last_call_depth = current_depth++; + fprintf (out, ")"); } /* end else */ HDfflush(out); diff --git a/src/H5version.h b/src/H5version.h deleted file mode 100644 index b955a8f..0000000 --- a/src/H5version.h +++ /dev/null @@ -1,564 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_vers -- do not edit */ -/* Add new versioned symbols to H5vers.txt file */ - - -#ifndef _H5version_H -#define _H5version_H - -/* Issue error if contradicting macros have been defined. */ -#if (defined(H5_USE_16_API) || defined(H5_USE_18_API)) && defined(H5_NO_DEPRECATED_SYMBOLS) - #error "Can't choose old API versions when deprecated APIs are disabled" -#endif /* (defined(H5_USE_16_API) || defined(H5_USE_18_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. - * - * Note: If an application has already chosen a particular version for an - * API symbol, the individual API version macro takes priority. - */ -#if defined(H5_USE_16_API_DEFAULT) && !defined(H5_USE_16_API) - #define H5_USE_16_API 1 -#endif /* H5_USE_16_API_DEFAULT && !H5_USE_16_API */ - -#if defined(H5_USE_18_API_DEFAULT) && !defined(H5_USE_18_API) - #define H5_USE_18_API 1 -#endif /* H5_USE_18_API_DEFAULT && !H5_USE_18_API */ - - -#ifdef H5_USE_16_API - -/*************/ -/* Functions */ -/*************/ - -#if !defined(H5Acreate_vers) - #define H5Acreate_vers 1 -#endif /* !defined(H5Acreate_vers) */ - -#if !defined(H5Aiterate_vers) - #define H5Aiterate_vers 1 -#endif /* !defined(H5Aiterate_vers) */ - -#if !defined(H5Dcreate_vers) - #define H5Dcreate_vers 1 -#endif /* !defined(H5Dcreate_vers) */ - -#if !defined(H5Dopen_vers) - #define H5Dopen_vers 1 -#endif /* !defined(H5Dopen_vers) */ - -#if !defined(H5Eclear_vers) - #define H5Eclear_vers 1 -#endif /* !defined(H5Eclear_vers) */ - -#if !defined(H5Eget_auto_vers) - #define H5Eget_auto_vers 1 -#endif /* !defined(H5Eget_auto_vers) */ - -#if !defined(H5Eprint_vers) - #define H5Eprint_vers 1 -#endif /* !defined(H5Eprint_vers) */ - -#if !defined(H5Epush_vers) - #define H5Epush_vers 1 -#endif /* !defined(H5Epush_vers) */ - -#if !defined(H5Eset_auto_vers) - #define H5Eset_auto_vers 1 -#endif /* !defined(H5Eset_auto_vers) */ - -#if !defined(H5Ewalk_vers) - #define H5Ewalk_vers 1 -#endif /* !defined(H5Ewalk_vers) */ - -#if !defined(H5Gcreate_vers) - #define H5Gcreate_vers 1 -#endif /* !defined(H5Gcreate_vers) */ - -#if !defined(H5Gopen_vers) - #define H5Gopen_vers 1 -#endif /* !defined(H5Gopen_vers) */ - -#if !defined(H5Pget_filter_vers) - #define H5Pget_filter_vers 1 -#endif /* !defined(H5Pget_filter_vers) */ - -#if !defined(H5Pget_filter_by_id_vers) - #define H5Pget_filter_by_id_vers 1 -#endif /* !defined(H5Pget_filter_by_id_vers) */ - -#if !defined(H5Pinsert_vers) - #define H5Pinsert_vers 1 -#endif /* !defined(H5Pinsert_vers) */ - -#if !defined(H5Pregister_vers) - #define H5Pregister_vers 1 -#endif /* !defined(H5Pregister_vers) */ - -#if !defined(H5Rdereference_vers) - #define H5Rdereference_vers 1 -#endif /* !defined(H5Rdereference_vers) */ - -#if !defined(H5Rget_obj_type_vers) - #define H5Rget_obj_type_vers 1 -#endif /* !defined(H5Rget_obj_type_vers) */ - -#if !defined(H5Tarray_create_vers) - #define H5Tarray_create_vers 1 -#endif /* !defined(H5Tarray_create_vers) */ - -#if !defined(H5Tcommit_vers) - #define H5Tcommit_vers 1 -#endif /* !defined(H5Tcommit_vers) */ - -#if !defined(H5Tget_array_dims_vers) - #define H5Tget_array_dims_vers 1 -#endif /* !defined(H5Tget_array_dims_vers) */ - -#if !defined(H5Topen_vers) - #define H5Topen_vers 1 -#endif /* !defined(H5Topen_vers) */ - -/************/ -/* Typedefs */ -/************/ - -#if !defined(H5E_auto_t_vers) - #define H5E_auto_t_vers 1 -#endif /* !defined(H5E_auto_t_vers) */ - -#if !defined(H5Z_class_t_vers) - #define H5Z_class_t_vers 1 -#endif /* !defined(H5Z_class_t_vers) */ - -#endif /* H5_USE_16_API */ - -#ifdef H5_USE_18_API - -/*************/ -/* Functions */ -/*************/ - -#if !defined(H5Acreate_vers) - #define H5Acreate_vers 2 -#endif /* !defined(H5Acreate_vers) */ - -#if !defined(H5Aiterate_vers) - #define H5Aiterate_vers 2 -#endif /* !defined(H5Aiterate_vers) */ - -#if !defined(H5Dcreate_vers) - #define H5Dcreate_vers 2 -#endif /* !defined(H5Dcreate_vers) */ - -#if !defined(H5Dopen_vers) - #define H5Dopen_vers 2 -#endif /* !defined(H5Dopen_vers) */ - -#if !defined(H5Eclear_vers) - #define H5Eclear_vers 2 -#endif /* !defined(H5Eclear_vers) */ - -#if !defined(H5Eget_auto_vers) - #define H5Eget_auto_vers 2 -#endif /* !defined(H5Eget_auto_vers) */ - -#if !defined(H5Eprint_vers) - #define H5Eprint_vers 2 -#endif /* !defined(H5Eprint_vers) */ - -#if !defined(H5Epush_vers) - #define H5Epush_vers 2 -#endif /* !defined(H5Epush_vers) */ - -#if !defined(H5Eset_auto_vers) - #define H5Eset_auto_vers 2 -#endif /* !defined(H5Eset_auto_vers) */ - -#if !defined(H5Ewalk_vers) - #define H5Ewalk_vers 2 -#endif /* !defined(H5Ewalk_vers) */ - -#if !defined(H5Fget_info_vers) - #define H5Fget_info_vers 1 -#endif /* !defined(H5Fget_info_vers) */ - -#if !defined(H5Gcreate_vers) - #define H5Gcreate_vers 2 -#endif /* !defined(H5Gcreate_vers) */ - -#if !defined(H5Gopen_vers) - #define H5Gopen_vers 2 -#endif /* !defined(H5Gopen_vers) */ - -#if !defined(H5Pget_filter_vers) - #define H5Pget_filter_vers 2 -#endif /* !defined(H5Pget_filter_vers) */ - -#if !defined(H5Pget_filter_by_id_vers) - #define H5Pget_filter_by_id_vers 2 -#endif /* !defined(H5Pget_filter_by_id_vers) */ - -#if !defined(H5Pinsert_vers) - #define H5Pinsert_vers 2 -#endif /* !defined(H5Pinsert_vers) */ - -#if !defined(H5Pregister_vers) - #define H5Pregister_vers 2 -#endif /* !defined(H5Pregister_vers) */ - -#if !defined(H5Rdereference_vers) - #define H5Rdereference_vers 1 -#endif /* !defined(H5Rdereference_vers) */ - -#if !defined(H5Rget_obj_type_vers) - #define H5Rget_obj_type_vers 2 -#endif /* !defined(H5Rget_obj_type_vers) */ - -#if !defined(H5Tarray_create_vers) - #define H5Tarray_create_vers 2 -#endif /* !defined(H5Tarray_create_vers) */ - -#if !defined(H5Tcommit_vers) - #define H5Tcommit_vers 2 -#endif /* !defined(H5Tcommit_vers) */ - -#if !defined(H5Tget_array_dims_vers) - #define H5Tget_array_dims_vers 2 -#endif /* !defined(H5Tget_array_dims_vers) */ - -#if !defined(H5Topen_vers) - #define H5Topen_vers 2 -#endif /* !defined(H5Topen_vers) */ - -/************/ -/* Typedefs */ -/************/ - -#if !defined(H5E_auto_t_vers) - #define H5E_auto_t_vers 2 -#endif /* !defined(H5E_auto_t_vers) */ - -#if !defined(H5Z_class_t_vers) - #define H5Z_class_t_vers 2 -#endif /* !defined(H5Z_class_t_vers) */ - -#endif /* H5_USE_18_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 - * specifying an invalid API version. - */ - -/*************/ -/* Functions */ -/*************/ - -#if !defined(H5Acreate_vers) || H5Acreate_vers == 2 - #ifndef H5Acreate_vers - #define H5Acreate_vers 2 - #endif /* H5Acreate_vers */ - #define H5Acreate H5Acreate2 -#elif H5Acreate_vers == 1 - #define H5Acreate H5Acreate1 -#else /* H5Acreate_vers */ - #error "H5Acreate_vers set to invalid value" -#endif /* H5Acreate_vers */ - -#if !defined(H5Aiterate_vers) || H5Aiterate_vers == 2 - #ifndef H5Aiterate_vers - #define H5Aiterate_vers 2 - #endif /* H5Aiterate_vers */ - #define H5Aiterate H5Aiterate2 - #define H5A_operator_t H5A_operator2_t -#elif H5Aiterate_vers == 1 - #define H5Aiterate H5Aiterate1 - #define H5A_operator_t H5A_operator1_t -#else /* H5Aiterate_vers */ - #error "H5Aiterate_vers set to invalid value" -#endif /* H5Aiterate_vers */ - -#if !defined(H5Dcreate_vers) || H5Dcreate_vers == 2 - #ifndef H5Dcreate_vers - #define H5Dcreate_vers 2 - #endif /* H5Dcreate_vers */ - #define H5Dcreate H5Dcreate2 -#elif H5Dcreate_vers == 1 - #define H5Dcreate H5Dcreate1 -#else /* H5Dcreate_vers */ - #error "H5Dcreate_vers set to invalid value" -#endif /* H5Dcreate_vers */ - -#if !defined(H5Dopen_vers) || H5Dopen_vers == 2 - #ifndef H5Dopen_vers - #define H5Dopen_vers 2 - #endif /* H5Dopen_vers */ - #define H5Dopen H5Dopen2 -#elif H5Dopen_vers == 1 - #define H5Dopen H5Dopen1 -#else /* H5Dopen_vers */ - #error "H5Dopen_vers set to invalid value" -#endif /* H5Dopen_vers */ - -#if !defined(H5Eclear_vers) || H5Eclear_vers == 2 - #ifndef H5Eclear_vers - #define H5Eclear_vers 2 - #endif /* H5Eclear_vers */ - #define H5Eclear H5Eclear2 -#elif H5Eclear_vers == 1 - #define H5Eclear H5Eclear1 -#else /* H5Eclear_vers */ - #error "H5Eclear_vers set to invalid value" -#endif /* H5Eclear_vers */ - -#if !defined(H5Eget_auto_vers) || H5Eget_auto_vers == 2 - #ifndef H5Eget_auto_vers - #define H5Eget_auto_vers 2 - #endif /* H5Eget_auto_vers */ - #define H5Eget_auto H5Eget_auto2 -#elif H5Eget_auto_vers == 1 - #define H5Eget_auto H5Eget_auto1 -#else /* H5Eget_auto_vers */ - #error "H5Eget_auto_vers set to invalid value" -#endif /* H5Eget_auto_vers */ - -#if !defined(H5Eprint_vers) || H5Eprint_vers == 2 - #ifndef H5Eprint_vers - #define H5Eprint_vers 2 - #endif /* H5Eprint_vers */ - #define H5Eprint H5Eprint2 -#elif H5Eprint_vers == 1 - #define H5Eprint H5Eprint1 -#else /* H5Eprint_vers */ - #error "H5Eprint_vers set to invalid value" -#endif /* H5Eprint_vers */ - -#if !defined(H5Epush_vers) || H5Epush_vers == 2 - #ifndef H5Epush_vers - #define H5Epush_vers 2 - #endif /* H5Epush_vers */ - #define H5Epush H5Epush2 -#elif H5Epush_vers == 1 - #define H5Epush H5Epush1 -#else /* H5Epush_vers */ - #error "H5Epush_vers set to invalid value" -#endif /* H5Epush_vers */ - -#if !defined(H5Eset_auto_vers) || H5Eset_auto_vers == 2 - #ifndef H5Eset_auto_vers - #define H5Eset_auto_vers 2 - #endif /* H5Eset_auto_vers */ - #define H5Eset_auto H5Eset_auto2 -#elif H5Eset_auto_vers == 1 - #define H5Eset_auto H5Eset_auto1 -#else /* H5Eset_auto_vers */ - #error "H5Eset_auto_vers set to invalid value" -#endif /* H5Eset_auto_vers */ - -#if !defined(H5Ewalk_vers) || H5Ewalk_vers == 2 - #ifndef H5Ewalk_vers - #define H5Ewalk_vers 2 - #endif /* H5Ewalk_vers */ - #define H5Ewalk H5Ewalk2 - #define H5E_error_t H5E_error2_t - #define H5E_walk_t H5E_walk2_t -#elif H5Ewalk_vers == 1 - #define H5Ewalk H5Ewalk1 - #define H5E_error_t H5E_error1_t - #define H5E_walk_t H5E_walk1_t -#else /* H5Ewalk_vers */ - #error "H5Ewalk_vers set to invalid value" -#endif /* H5Ewalk_vers */ - -#if !defined(H5Fget_info_vers) || H5Fget_info_vers == 2 - #ifndef H5Fget_info_vers - #define H5Fget_info_vers 2 - #endif /* H5Fget_info_vers */ - #define H5Fget_info H5Fget_info2 - #define H5F_info_t H5F_info2_t -#elif H5Fget_info_vers == 1 - #define H5Fget_info H5Fget_info1 - #define H5F_info_t H5F_info1_t -#else /* H5Fget_info_vers */ - #error "H5Fget_info_vers set to invalid value" -#endif /* H5Fget_info_vers */ - -#if !defined(H5Gcreate_vers) || H5Gcreate_vers == 2 - #ifndef H5Gcreate_vers - #define H5Gcreate_vers 2 - #endif /* H5Gcreate_vers */ - #define H5Gcreate H5Gcreate2 -#elif H5Gcreate_vers == 1 - #define H5Gcreate H5Gcreate1 -#else /* H5Gcreate_vers */ - #error "H5Gcreate_vers set to invalid value" -#endif /* H5Gcreate_vers */ - -#if !defined(H5Gopen_vers) || H5Gopen_vers == 2 - #ifndef H5Gopen_vers - #define H5Gopen_vers 2 - #endif /* H5Gopen_vers */ - #define H5Gopen H5Gopen2 -#elif H5Gopen_vers == 1 - #define H5Gopen H5Gopen1 -#else /* H5Gopen_vers */ - #error "H5Gopen_vers set to invalid value" -#endif /* H5Gopen_vers */ - -#if !defined(H5Pget_filter_vers) || H5Pget_filter_vers == 2 - #ifndef H5Pget_filter_vers - #define H5Pget_filter_vers 2 - #endif /* H5Pget_filter_vers */ - #define H5Pget_filter H5Pget_filter2 -#elif H5Pget_filter_vers == 1 - #define H5Pget_filter H5Pget_filter1 -#else /* H5Pget_filter_vers */ - #error "H5Pget_filter_vers set to invalid value" -#endif /* H5Pget_filter_vers */ - -#if !defined(H5Pget_filter_by_id_vers) || H5Pget_filter_by_id_vers == 2 - #ifndef H5Pget_filter_by_id_vers - #define H5Pget_filter_by_id_vers 2 - #endif /* H5Pget_filter_by_id_vers */ - #define H5Pget_filter_by_id H5Pget_filter_by_id2 -#elif H5Pget_filter_by_id_vers == 1 - #define H5Pget_filter_by_id H5Pget_filter_by_id1 -#else /* H5Pget_filter_by_id_vers */ - #error "H5Pget_filter_by_id_vers set to invalid value" -#endif /* H5Pget_filter_by_id_vers */ - -#if !defined(H5Pinsert_vers) || H5Pinsert_vers == 2 - #ifndef H5Pinsert_vers - #define H5Pinsert_vers 2 - #endif /* H5Pinsert_vers */ - #define H5Pinsert H5Pinsert2 -#elif H5Pinsert_vers == 1 - #define H5Pinsert H5Pinsert1 -#else /* H5Pinsert_vers */ - #error "H5Pinsert_vers set to invalid value" -#endif /* H5Pinsert_vers */ - -#if !defined(H5Pregister_vers) || H5Pregister_vers == 2 - #ifndef H5Pregister_vers - #define H5Pregister_vers 2 - #endif /* H5Pregister_vers */ - #define H5Pregister H5Pregister2 -#elif H5Pregister_vers == 1 - #define H5Pregister H5Pregister1 -#else /* H5Pregister_vers */ - #error "H5Pregister_vers set to invalid value" -#endif /* H5Pregister_vers */ - -#if !defined(H5Rdereference_vers) || H5Rdereference_vers == 2 - #ifndef H5Rdereference_vers - #define H5Rdereference_vers 2 - #endif /* H5Rdereference_vers */ - #define H5Rdereference H5Rdereference2 -#elif H5Rdereference_vers == 1 - #define H5Rdereference H5Rdereference1 -#else /* H5Rdereference_vers */ - #error "H5Rdereference_vers set to invalid value" -#endif /* H5Rdereference_vers */ - -#if !defined(H5Rget_obj_type_vers) || H5Rget_obj_type_vers == 2 - #ifndef H5Rget_obj_type_vers - #define H5Rget_obj_type_vers 2 - #endif /* H5Rget_obj_type_vers */ - #define H5Rget_obj_type H5Rget_obj_type2 -#elif H5Rget_obj_type_vers == 1 - #define H5Rget_obj_type H5Rget_obj_type1 -#else /* H5Rget_obj_type_vers */ - #error "H5Rget_obj_type_vers set to invalid value" -#endif /* H5Rget_obj_type_vers */ - -#if !defined(H5Tarray_create_vers) || H5Tarray_create_vers == 2 - #ifndef H5Tarray_create_vers - #define H5Tarray_create_vers 2 - #endif /* H5Tarray_create_vers */ - #define H5Tarray_create H5Tarray_create2 -#elif H5Tarray_create_vers == 1 - #define H5Tarray_create H5Tarray_create1 -#else /* H5Tarray_create_vers */ - #error "H5Tarray_create_vers set to invalid value" -#endif /* H5Tarray_create_vers */ - -#if !defined(H5Tcommit_vers) || H5Tcommit_vers == 2 - #ifndef H5Tcommit_vers - #define H5Tcommit_vers 2 - #endif /* H5Tcommit_vers */ - #define H5Tcommit H5Tcommit2 -#elif H5Tcommit_vers == 1 - #define H5Tcommit H5Tcommit1 -#else /* H5Tcommit_vers */ - #error "H5Tcommit_vers set to invalid value" -#endif /* H5Tcommit_vers */ - -#if !defined(H5Tget_array_dims_vers) || H5Tget_array_dims_vers == 2 - #ifndef H5Tget_array_dims_vers - #define H5Tget_array_dims_vers 2 - #endif /* H5Tget_array_dims_vers */ - #define H5Tget_array_dims H5Tget_array_dims2 -#elif H5Tget_array_dims_vers == 1 - #define H5Tget_array_dims H5Tget_array_dims1 -#else /* H5Tget_array_dims_vers */ - #error "H5Tget_array_dims_vers set to invalid value" -#endif /* H5Tget_array_dims_vers */ - -#if !defined(H5Topen_vers) || H5Topen_vers == 2 - #ifndef H5Topen_vers - #define H5Topen_vers 2 - #endif /* H5Topen_vers */ - #define H5Topen H5Topen2 -#elif H5Topen_vers == 1 - #define H5Topen H5Topen1 -#else /* H5Topen_vers */ - #error "H5Topen_vers set to invalid value" -#endif /* H5Topen_vers */ - -/************/ -/* Typedefs */ -/************/ - -#if !defined(H5E_auto_t_vers) || H5E_auto_t_vers == 2 - #ifndef H5E_auto_t_vers - #define H5E_auto_t_vers 2 - #endif /* H5E_auto_t_vers */ - #define H5E_auto_t H5E_auto2_t -#elif H5E_auto_t_vers == 1 - #define H5E_auto_t H5E_auto1_t -#else /* H5E_auto_t_vers */ - #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 - #endif /* H5Z_class_t_vers */ - #define H5Z_class_t H5Z_class2_t -#elif H5Z_class_t_vers == 1 - #define H5Z_class_t H5Z_class1_t -#else /* H5Z_class_t_vers */ - #error "H5Z_class_t_vers set to invalid value" -#endif /* H5Z_class_t_vers */ - -#endif /* H5version_H */ - diff --git a/src/Makefile.am b/src/Makefile.am index 662b9a8..86dad23 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,26 +42,26 @@ DISTCLEANFILES=H5pubconf.h # library sources libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ - H5AC.c H5ACmpio.c \ + H5AC.c \ H5B.c H5Bcache.c H5Bdbg.c \ H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \ - H5C.c H5Cmpio.c \ + H5C.c \ H5CS.c \ H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \ H5Dio.c H5Dlayout.c \ - H5Dmpio.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c H5Dvirtual.c \ + H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c H5Dvirtual.c \ H5E.c H5Edeprec.c H5Eint.c \ H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \ H5F.c H5Fint.c H5Faccum.c H5Fcwfs.c \ H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \ - H5Fmount.c H5Fmpi.c H5Fquery.c \ + H5Fmount.c H5Fquery.c \ H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FAstat.c H5FAtest.c \ H5FD.c H5FDcore.c \ - H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ + H5FDfamily.c H5FDint.c H5FDlog.c \ H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ @@ -95,7 +95,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5R.c H5Rdeprec.c \ H5UC.c \ H5RS.c \ - H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ + H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Snone.c H5Spoint.c \ H5Sselect.c H5Stest.c \ H5SL.c \ H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \ @@ -107,9 +107,18 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Topaque.c \ H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ - H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \ - H5Zscaleoffset.c H5Ztrans.c - + H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ + H5Zscaleoffset.c H5Zszip.c H5Ztrans.c + +# Only compile parallel sources if necessary +if BUILD_PARALLEL_CONDITIONAL + libhdf5_la_SOURCES += H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c +endif + +# Only compile the direct VFD if necessary +if DIRECT_VFD_CONDITIONAL + libhdf5_la_SOURCES += H5FDdirect.c +endif # Public headers include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ diff --git a/src/Makefile.in b/src/Makefile.in index 8741540..9c21e0e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,17 @@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -98,22 +108,26 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/lt_vers.am \ - $(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(srcdir)/H5config.h.in \ - $(top_srcdir)/bin/mkinstalldirs $(srcdir)/libhdf5.settings.in \ - $(top_srcdir)/bin/depcomp $(include_HEADERS) \ - $(top_srcdir)/bin/test-driver COPYING noinst_PROGRAMS = H5detect$(EXEEXT) H5make_libsettings$(EXEEXT) + +# Only compile parallel sources if necessary +@BUILD_PARALLEL_CONDITIONAL_TRUE@am__append_1 = H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c + +# Only compile the direct VFD if necessary +@DIRECT_VFD_CONDITIONAL_TRUE@am__append_2 = H5FDdirect.c TESTS = subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ - $(top_srcdir)/m4/aclocal_fc.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/aclocal_fc.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = H5config.h $(top_builddir)/fortran/src/H5config_f.inc CONFIG_CLEAN_FILES = libhdf5.settings CONFIG_CLEAN_VPATH_FILES = @@ -148,59 +162,111 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(settingsdir)" \ "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_la_LIBADD = +am__libhdf5_la_SOURCES_DIST = H5.c H5checksum.c H5dbg.c H5system.c \ + H5timer.c H5trace.c H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c \ + H5Aint.c H5Atest.c H5AC.c H5B.c H5Bcache.c H5Bdbg.c H5B2.c \ + H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c \ + H5B2test.c H5C.c H5CS.c H5D.c H5Dbtree.c H5Dchunk.c \ + H5Dcompact.c H5Dcontig.c H5Ddbg.c H5Ddeprec.c H5Defl.c \ + H5Dfill.c H5Dint.c H5Dio.c H5Dlayout.c H5Doh.c H5Dscatgath.c \ + H5Dselect.c H5Dtest.c H5Dvirtual.c H5E.c H5Edeprec.c H5Eint.c \ + H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c \ + H5EAhdr.c H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c \ + H5EAtest.c H5F.c H5Fint.c H5Faccum.c H5Fcwfs.c H5Fdbg.c \ + H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c H5Fmount.c H5Fquery.c \ + H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c H5FA.c \ + H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ + H5FAstat.c H5FAtest.c H5FD.c H5FDcore.c H5FDfamily.c H5FDint.c \ + H5FDlog.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ + H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \ + H5FSstat.c H5FStest.c H5G.c H5Gbtree2.c H5Gcache.c \ + H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c H5Gint.c \ + H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c \ + H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c H5HF.c \ + H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ + H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c \ + H5HFsection.c H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ + H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c H5HL.c H5HLcache.c \ + H5HLdbg.c H5HLint.c H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c \ + H5lib_settings.c H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ + H5MM.c H5MP.c H5MPtest.c H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ + H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ochunk.c \ + H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ + H5Ofill.c H5Ofsinfo.c H5Oginfo.c H5Olayout.c H5Olinfo.c \ + H5Olink.c H5Omessage.c H5Omtime.c H5Oname.c H5Onull.c \ + H5Opline.c H5Orefcount.c H5Osdspace.c H5Oshared.c H5Ostab.c \ + H5Oshmesg.c H5Otest.c H5Ounknown.c H5P.c H5Pacpl.c H5Pdapl.c \ + H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c H5Pencdec.c H5Pfapl.c \ + H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \ + H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c H5PL.c H5R.c \ + H5Rdeprec.c H5UC.c H5RS.c H5S.c H5Sall.c H5Sdbg.c H5Shyper.c \ + H5Snone.c H5Spoint.c H5Sselect.c H5Stest.c H5SL.c H5SM.c \ + H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c H5ST.c H5T.c \ + H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \ + H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c \ + H5Tfixed.c H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c \ + H5Toh.c H5Topaque.c H5Torder.c H5Tpad.c H5Tprecis.c \ + H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ + H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ + H5Zscaleoffset.c H5Zszip.c H5Ztrans.c H5ACmpio.c H5Cmpio.c \ + H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c H5FDdirect.c +@BUILD_PARALLEL_CONDITIONAL_TRUE@am__objects_1 = H5ACmpio.lo \ +@BUILD_PARALLEL_CONDITIONAL_TRUE@ H5Cmpio.lo H5Dmpio.lo \ +@BUILD_PARALLEL_CONDITIONAL_TRUE@ H5Fmpi.lo H5FDmpi.lo \ +@BUILD_PARALLEL_CONDITIONAL_TRUE@ H5FDmpio.lo H5Smpio.lo +@DIRECT_VFD_CONDITIONAL_TRUE@am__objects_2 = H5FDdirect.lo am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5timer.lo H5trace.lo H5A.lo H5Abtree2.lo H5Adense.lo \ - H5Adeprec.lo H5Aint.lo H5Atest.lo H5AC.lo H5ACmpio.lo H5B.lo \ - H5Bcache.lo H5Bdbg.lo H5B2.lo H5B2cache.lo H5B2dbg.lo \ - H5B2hdr.lo H5B2int.lo H5B2stat.lo H5B2test.lo H5C.lo \ - H5Cmpio.lo H5CS.lo H5D.lo H5Dbtree.lo H5Dchunk.lo \ - H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo H5Defl.lo \ - H5Dfill.lo H5Dint.lo H5Dio.lo H5Dlayout.lo H5Dmpio.lo H5Doh.lo \ - H5Dscatgath.lo H5Dselect.lo H5Dtest.lo H5Dvirtual.lo H5E.lo \ - H5Edeprec.lo H5Eint.lo H5EA.lo H5EAcache.lo H5EAdbg.lo \ - H5EAdblkpage.lo H5EAdblock.lo H5EAhdr.lo H5EAiblock.lo \ - H5EAint.lo H5EAsblock.lo H5EAstat.lo H5EAtest.lo H5F.lo \ - H5Fint.lo H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo H5Fdeprec.lo \ - H5Fefc.lo H5Ffake.lo H5Fio.lo H5Fmount.lo H5Fmpi.lo \ + H5Adeprec.lo H5Aint.lo H5Atest.lo H5AC.lo H5B.lo H5Bcache.lo \ + H5Bdbg.lo H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2hdr.lo \ + H5B2int.lo H5B2stat.lo H5B2test.lo H5C.lo H5CS.lo H5D.lo \ + H5Dbtree.lo H5Dchunk.lo H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo \ + H5Ddeprec.lo H5Defl.lo H5Dfill.lo H5Dint.lo H5Dio.lo \ + H5Dlayout.lo H5Doh.lo H5Dscatgath.lo H5Dselect.lo H5Dtest.lo \ + H5Dvirtual.lo H5E.lo H5Edeprec.lo H5Eint.lo H5EA.lo \ + H5EAcache.lo H5EAdbg.lo H5EAdblkpage.lo H5EAdblock.lo \ + H5EAhdr.lo H5EAiblock.lo H5EAint.lo H5EAsblock.lo H5EAstat.lo \ + H5EAtest.lo H5F.lo H5Fint.lo H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo \ + H5Fdeprec.lo H5Fefc.lo H5Ffake.lo H5Fio.lo H5Fmount.lo \ H5Fquery.lo H5Fsfile.lo H5Fsuper.lo H5Fsuper_cache.lo \ H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo H5FAdblock.lo \ H5FAdblkpage.lo H5FAhdr.lo H5FAstat.lo H5FAtest.lo H5FD.lo \ - H5FDcore.lo H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo \ - H5FDmpi.lo H5FDmpio.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo \ - H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo \ - H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo \ - H5Gcache.lo H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo \ - H5Gint.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \ - H5Goh.lo H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo \ - H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \ - H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \ - H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \ - H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo \ - H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo \ - H5Itest.lo H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo \ - H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \ - H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \ - H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \ - H5Ochunk.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \ - H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo H5Oginfo.lo \ - H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \ - H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ - H5Oshared.lo H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5Ounknown.lo \ - H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo \ - H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \ - H5Pgcpl.lo H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo \ - H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5PL.lo H5R.lo \ - H5Rdeprec.lo H5UC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo \ - H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \ - H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo \ - H5SMmessage.lo H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo \ - H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \ - H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \ - H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \ - H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \ - H5Tvisit.lo H5Tvlen.lo H5TS.lo H5VM.lo H5WB.lo H5Z.lo \ - H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ - H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo + H5FDcore.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo H5FDmulti.lo \ + H5FDsec2.lo H5FDspace.lo H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo \ + H5FScache.lo H5FSdbg.lo H5FSsection.lo H5FSstat.lo H5FStest.lo \ + H5G.lo H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo H5Gdense.lo \ + H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \ + H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo H5Gstab.lo \ + H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \ + H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \ + H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \ + H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \ + H5HGcache.lo H5HGdbg.lo H5HGquery.lo H5HL.lo H5HLcache.lo \ + H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5Itest.lo H5L.lo \ + H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \ + H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \ + H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \ + H5Obtreek.lo H5Ocache.lo H5Ochunk.lo H5Ocont.lo H5Ocopy.lo \ + H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo \ + H5Ofsinfo.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo \ + H5Omessage.lo H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo \ + H5Orefcount.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo \ + H5Oshmesg.lo H5Otest.lo H5Ounknown.lo H5P.lo H5Pacpl.lo \ + H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo H5Pencdec.lo \ + H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo \ + H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo \ + H5Ptest.lo H5PL.lo H5R.lo H5Rdeprec.lo H5UC.lo H5RS.lo H5S.lo \ + H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Snone.lo H5Spoint.lo \ + H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo \ + H5SMcache.lo H5SMmessage.lo H5SMtest.lo H5ST.lo H5T.lo \ + H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo \ + H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo \ + H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo \ + H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo \ + H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo H5TS.lo H5VM.lo H5WB.lo \ + H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ + H5Zscaleoffset.lo H5Zszip.lo H5Ztrans.lo $(am__objects_1) \ + $(am__objects_2) libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -251,7 +317,8 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libhdf5_la_SOURCES) H5detect.c H5make_libsettings.c -DIST_SOURCES = $(libhdf5_la_SOURCES) H5detect.c H5make_libsettings.c +DIST_SOURCES = $(am__libhdf5_la_SOURCES_DIST) H5detect.c \ + H5make_libsettings.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -452,6 +519,11 @@ am__set_b = \ *) \ b='$*';; \ esac +am__DIST_COMMON = $(srcdir)/H5config.h.in $(srcdir)/Makefile.in \ + $(srcdir)/libhdf5.settings.in $(top_srcdir)/bin/depcomp \ + $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \ + $(top_srcdir)/config/conclude.am \ + $(top_srcdir)/config/lt_vers.am COPYING DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ @@ -468,7 +540,6 @@ AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@ -AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -566,6 +637,7 @@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -742,7 +814,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 221 +LT_VERS_REVISION = 222 LT_VERS_AGE = 0 # Our main target, the HDF5 library @@ -757,76 +829,53 @@ MOSTLYCLEANFILES = H5Tinit.c H5lib_settings.c DISTCLEANFILES = H5pubconf.h # library sources -libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ - H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ - H5AC.c H5ACmpio.c \ - H5B.c H5Bcache.c H5Bdbg.c \ - H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \ - H5C.c H5Cmpio.c \ - H5CS.c \ - H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ - H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \ - H5Dio.c H5Dlayout.c \ - H5Dmpio.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c H5Dvirtual.c \ - H5E.c H5Edeprec.c H5Eint.c \ - H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ - H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \ - H5F.c H5Fint.c H5Faccum.c H5Fcwfs.c \ - H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \ - H5Fmount.c H5Fmpi.c H5Fquery.c \ - H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ - H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ - H5FAstat.c H5FAtest.c \ - H5FD.c H5FDcore.c \ - H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ - H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ - H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ - H5G.c H5Gbtree2.c H5Gcache.c \ - H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ - H5Gint.c H5Glink.c \ - H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c \ - H5Gtraverse.c \ - H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ - H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \ - H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ - H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ - H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \ - H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ - H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ - H5MM.c H5MP.c H5MPtest.c \ - H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ - H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ochunk.c \ - H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ - H5Ofill.c H5Ofsinfo.c H5Oginfo.c \ - H5Olayout.c \ - H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \ - H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \ - H5Osdspace.c H5Oshared.c H5Ostab.c \ - H5Oshmesg.c H5Otest.c H5Ounknown.c \ - H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ - H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ - H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ - H5Pgcpl.c H5Pint.c \ - H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ - H5PL.c \ - H5R.c H5Rdeprec.c \ - H5UC.c \ - H5RS.c \ - H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ - H5Sselect.c H5Stest.c \ - H5SL.c \ - H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \ - H5ST.c \ - H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \ - H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c \ - H5Tfixed.c \ - H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ - H5Topaque.c \ - H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ - H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \ - H5Zscaleoffset.c H5Ztrans.c - +libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c \ + H5trace.c H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c \ + H5Atest.c H5AC.c H5B.c H5Bcache.c H5Bdbg.c H5B2.c H5B2cache.c \ + H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c H5C.c \ + H5CS.c H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c \ + H5Ddbg.c H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c H5Dio.c \ + H5Dlayout.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c \ + H5Dvirtual.c H5E.c H5Edeprec.c H5Eint.c H5EA.c H5EAcache.c \ + H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c H5EAiblock.c \ + H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c H5F.c H5Fint.c \ + H5Faccum.c H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c \ + H5Fio.c H5Fmount.c H5Fquery.c H5Fsfile.c H5Fsuper.c \ + H5Fsuper_cache.c H5Ftest.c H5FA.c H5FAcache.c H5FAdbg.c \ + H5FAdblock.c H5FAdblkpage.c H5FAhdr.c H5FAstat.c H5FAtest.c \ + H5FD.c H5FDcore.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmulti.c \ + H5FDsec2.c H5FDspace.c H5FDstdio.c H5FL.c H5FO.c H5FS.c \ + H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ + H5G.c H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c \ + H5Gdeprec.c H5Gent.c H5Gint.c H5Glink.c H5Gloc.c H5Gname.c \ + H5Gnode.c H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c \ + H5Gtraverse.c H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c \ + H5HFdblock.c H5HFdtable.c H5HFhdr.c H5HFhuge.c H5HFiblock.c \ + H5HFiter.c H5HFman.c H5HFsection.c H5HFspace.c H5HFstat.c \ + H5HFtest.c H5HFtiny.c H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ + H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HP.c H5I.c H5Itest.c \ + H5L.c H5Lexternal.c H5lib_settings.c H5MF.c H5MFaggr.c \ + H5MFdbg.c H5MFsection.c H5MM.c H5MP.c H5MPtest.c H5O.c \ + H5Oainfo.c H5Oalloc.c H5Oattr.c H5Oattribute.c H5Obogus.c \ + H5Obtreek.c H5Ocache.c H5Ochunk.c H5Ocont.c H5Ocopy.c H5Odbg.c \ + H5Odrvinfo.c H5Odtype.c H5Oefl.c H5Ofill.c H5Ofsinfo.c \ + H5Oginfo.c H5Olayout.c H5Olinfo.c H5Olink.c H5Omessage.c \ + H5Omtime.c H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \ + H5Osdspace.c H5Oshared.c H5Ostab.c H5Oshmesg.c H5Otest.c \ + H5Ounknown.c H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c H5Pdeprec.c \ + H5Pdxpl.c H5Pencdec.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c \ + H5Pint.c H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \ + H5Ptest.c H5PL.c H5R.c H5Rdeprec.c H5UC.c H5RS.c H5S.c \ + H5Sall.c H5Sdbg.c H5Shyper.c H5Snone.c H5Spoint.c H5Sselect.c \ + H5Stest.c H5SL.c H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c \ + H5SMtest.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \ + H5Tcompound.c H5Tconv.c H5Tcset.c H5Tdbg.c H5Tdeprec.c \ + H5Tenum.c H5Tfields.c H5Tfixed.c H5Tfloat.c H5Tinit.c \ + H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c H5Torder.c \ + H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5VM.c H5WB.c H5Z.c H5Zdeflate.c H5Zfletcher32.c H5Znbit.c \ + H5Zshuffle.c H5Zscaleoffset.c H5Zszip.c H5Ztrans.c \ + $(am__append_1) $(am__append_2) # Public headers include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ @@ -883,7 +932,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -892,7 +940,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; -$(top_srcdir)/config/commence.am $(top_srcdir)/config/lt_vers.am $(top_srcdir)/config/conclude.am: +$(top_srcdir)/config/commence.am $(top_srcdir)/config/lt_vers.am $(top_srcdir)/config/conclude.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -1400,7 +1448,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ - else \ + elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ @@ -1681,6 +1729,8 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-settingsDATA +.PRECIOUS: Makefile + # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. # This tells the Makefiles that these targets are not files to be built but |