diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-12-08 21:37:00 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-12-08 21:37:00 (GMT) |
commit | 7af4786a9b29184596cb31afa80b69a68f00349b (patch) | |
tree | ca6c0c9d6da62a8206fecd2d03d4975086598579 /src | |
parent | 599ee2f4c6efd1def87384b15e83005eef786cd8 (diff) | |
parent | 758b9667b3e07a7562107f19f7dabee027e5bd53 (diff) | |
download | hdf5-7af4786a9b29184596cb31afa80b69a68f00349b.zip hdf5-7af4786a9b29184596cb31afa80b69a68f00349b.tar.gz hdf5-7af4786a9b29184596cb31afa80b69a68f00349b.tar.bz2 |
Merge branch 'develop' into bugfix/version_bounds
Merge from develop.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 88 | ||||
-rw-r--r-- | src/H5A.c | 66 | ||||
-rw-r--r-- | src/H5Aint.c | 85 | ||||
-rw-r--r-- | src/H5Aprivate.h | 4 | ||||
-rw-r--r-- | src/H5Dio.c | 19 | ||||
-rw-r--r-- | src/H5Dpkg.h | 2 | ||||
-rw-r--r-- | src/H5F.c | 167 | ||||
-rw-r--r-- | src/H5FD.c | 18 | ||||
-rw-r--r-- | src/H5Fint.c | 66 | ||||
-rw-r--r-- | src/H5Fmount.c | 7 | ||||
-rw-r--r-- | src/H5Fpkg.h | 25 | ||||
-rw-r--r-- | src/H5Fprivate.h | 15 | ||||
-rw-r--r-- | src/H5Fquery.c | 8 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 61 | ||||
-rw-r--r-- | src/H5I.c | 725 | ||||
-rw-r--r-- | src/H5L.c | 116 | ||||
-rw-r--r-- | src/H5Lprivate.h | 49 | ||||
-rw-r--r-- | src/H5MF.c | 5 | ||||
-rw-r--r-- | src/H5Oflush.c | 2 | ||||
-rw-r--r-- | src/H5Opkg.h | 18 | ||||
-rw-r--r-- | src/H5Oprivate.h | 5 | ||||
-rw-r--r-- | src/H5Pfapl.c | 28 | ||||
-rw-r--r-- | src/H5Pprivate.h | 12 | ||||
-rw-r--r-- | src/H5Tbit.c | 395 | ||||
-rw-r--r-- | src/H5Tcommit.c | 17 | ||||
-rw-r--r-- | src/H5Tconv.c | 90 | ||||
-rw-r--r-- | src/H5Tdbg.c | 227 | ||||
-rw-r--r-- | src/H5Tprivate.h | 6 | ||||
-rw-r--r-- | src/H5private.h | 181 | ||||
-rw-r--r-- | src/H5public.h | 1 | ||||
-rw-r--r-- | src/H5system.c | 2 | ||||
-rw-r--r-- | src/H5trace.c | 30 | ||||
-rw-r--r-- | src/hdf5.h | 52 |
33 files changed, 1209 insertions, 1383 deletions
@@ -19,17 +19,18 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SLprivate.h" /* Skip lists */ -#include "H5Tprivate.h" /* Datatypes */ -#include "H5FSprivate.h" /* File free space */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5FSprivate.h" /* File free space */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SLprivate.h" /* Skip lists */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5FSprivate.h" /* File free space */ /****************/ /* Local Macros */ @@ -80,9 +81,9 @@ hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */ hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */ #endif -char H5_lib_vers_info_g[] = H5_VERS_INFO; +char H5_lib_vers_info_g[] = H5_VERS_INFO; static hbool_t H5_dont_atexit_g = FALSE; -H5_debug_t H5_debug_g; /*debugging info */ +H5_debug_t H5_debug_g; /* debugging info */ /*******************/ @@ -243,11 +244,6 @@ done: * * Return: void * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -281,11 +277,11 @@ H5_term_library(void) */ #define DOWN(F) \ (((n = H5##F##_term_package()) && (at + 8) < sizeof loop)? \ - (sprintf(loop + at, "%s%s", (at ? "," : ""), #F), \ + (HDsprintf(loop + at, "%s%s", (at ? "," : ""), #F), \ at += HDstrlen(loop + at), \ n): \ ((n > 0 && (at + 5) < sizeof loop) ? \ - (sprintf(loop + at, "..."), \ + (HDsprintf(loop + at, "..."), \ at += HDstrlen(loop + at), \ n) : n)) @@ -364,8 +360,8 @@ H5_term_library(void) if(pending) { /* Only display the error message if the user is interested in them. */ if(func) { - fprintf(stderr, "HDF5: infinite loop closing library\n"); - fprintf(stderr, " %s\n", loop); + HDfprintf(stderr, "HDF5: infinite loop closing library\n"); + HDfprintf(stderr, " %s\n", loop); #ifndef NDEBUG HDabort(); #endif /* NDEBUG */ @@ -440,11 +436,6 @@ done: * Failure: negative if this function is called more than * once or if it is called too late. * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -479,11 +470,6 @@ H5dont_atexit(void) * * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, March 11, 2000 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -528,13 +514,6 @@ done: * * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, August 2, 2000 - * - * Modifications: Neil Fortner - * Wednesday, April 8, 2009 - * Added support for factory free lists - * *------------------------------------------------------------------------- */ herr_t @@ -578,9 +557,6 @@ done: * * Return: void * - * Programmer: Robb Matzke - * Wednesday, August 19, 1998 - * *------------------------------------------------------------------------- */ static void @@ -632,7 +608,7 @@ H5_debug_mask(const char *s) } /* end if */ } /* end for */ if (i>=(size_t)H5_NPKGS) - fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); + HDfprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); } /* end if-else */ } else if (HDisdigit(*s)) { @@ -672,8 +648,6 @@ H5_debug_mask(const char *s) * * Return: MPI_SUCCESS * - * Programmer: Mohamad Chaarawi, February 2015 - * *------------------------------------------------------------------------- */ static int H5_mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void H5_ATTR_UNUSED *attr_val, int H5_ATTR_UNUSED *flag) @@ -698,13 +672,6 @@ static int H5_mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED key * * Return: Non-negative on success/Negative on failure * - * Programmer: Unknown - * - * Modifications: - * Robb Matzke, 4 Mar 1998 - * Now use "normal" data types for the interface. Any of the arguments - * may be null pointers - * *------------------------------------------------------------------------- */ herr_t @@ -738,13 +705,6 @@ done: * * Failure: abort() * - * Programmer: Robb Matzke - * Tuesday, April 21, 1998 - * - * Modifications: - * Albert Cheng, May 12, 2001 - * Added verification of H5_VERS_INFO. - * *------------------------------------------------------------------------- */ #define VERSION_MISMATCH_WARNING \ @@ -869,11 +829,6 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -896,11 +851,6 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 30, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -717,8 +717,7 @@ hid_t H5Aget_space(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ - H5S_t *ds = NULL; - hid_t ret_value; + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", attr_id); @@ -727,19 +726,9 @@ H5Aget_space(hid_t attr_id) if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (ds = H5A_get_space(attr))) + if((ret_value = H5A_get_space(attr)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") - - /* Atomize */ - if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") - done: - if(ret_value < 0) { - if(ds && (H5S_close(ds) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - } /* end if */ - FUNC_LEAVE_API(ret_value) } /* H5Aget_space() */ @@ -764,7 +753,6 @@ hid_t H5Aget_type(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ - H5T_t *dt = NULL; hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -774,19 +762,9 @@ H5Aget_type(hid_t attr_id) if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (dt = H5A_get_type(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") - - /* Create an atom */ - if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - + if((ret_value = H5A_get_type(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") done: - if(ret_value < 0) { - if(dt && (H5T_close(dt) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") - } /* end if */ - FUNC_LEAVE_API(ret_value) } /* H5Aget_type() */ @@ -1172,7 +1150,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) if(HDstrcmp(old_name, new_name)) { H5G_loc_t loc; /* Object location */ - if(H5G_loc(loc_id, & loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ @@ -1227,7 +1205,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - if(H5G_loc(loc_id, & loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ @@ -1685,12 +1663,12 @@ H5Aexists(hid_t obj_id, const char *attr_name) H5TRACE2("t", "i*s", obj_id, attr_name); /* check arguments */ - if(H5I_ATTR == H5I_get_type(obj_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + if (H5I_ATTR == H5I_get_type(obj_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + if (H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if (!attr_name || !*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_ind_read_dxpl_id)) < 0) @@ -1726,20 +1704,20 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id); /* check arguments */ - if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + if (H5I_ATTR == H5I_get_type(loc_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + if (H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if (!obj_name || !*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + if (!attr_name || !*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) + if (H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) + if ((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Aint.c b/src/H5Aint.c index 117dbce..5c32e86 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -33,14 +33,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ /****************/ @@ -739,86 +739,89 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) /*------------------------------------------------------------------------- - * Function: H5A_get_space + * Function: H5A_get_space * - * Purpose: Returns dataspace of the attribute. + * Purpose: Returns dataspace of the attribute. * - * Return: Success: dataspace + * Return: Success: A valid ID for the dataspace of an attribute * - * Failure: NULL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Failure: H5I_INVALID_ID * *------------------------------------------------------------------------- */ -H5S_t * +hid_t H5A_get_space(H5A_t *attr) { - H5S_t *ret_value = NULL; + H5S_t *ds = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT HDassert(attr); /* Copy the attribute's dataspace */ - if(NULL == (ret_value = H5S_copy(attr->shared->ds, FALSE, TRUE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy dataspace") + if (NULL == (ds = H5S_copy(attr->shared->ds, FALSE, TRUE))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") + + /* Atomize */ + if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: + if (H5I_INVALID_HID == ret_value && ds && H5S_close(ds) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_space() */ /*------------------------------------------------------------------------- - * Function: H5A_get_type + * Function: H5A_get_type * - * Purpose: Returns datatype of the dataset. + * Purpose: Returns an ID for the datatype of an attribute * - * Return: Success: datatype + * Return: Success: A valid ID for the datatype of an attribute * - * Failure: NULL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ -H5T_t * +hid_t H5A_get_type(H5A_t *attr) { H5T_t *dt = NULL; - H5T_t *ret_value = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT HDassert(attr); /* Patch the datatype's "top level" file pointer */ - if(H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to patch datatype's file pointer") + if (H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to patch datatype's file pointer") - /* - * Copy the attribute's datatype. If the type is a named type then + /* Copy the attribute's datatype. If the type is a named type then * reopen the type before returning it to the user. Make the type * read-only. */ - if(NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy datatype") + if (NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy datatype") /* Mark any datatypes as being in memory now */ - if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "invalid datatype location") /* Lock copied type */ - if(H5T_lock(dt, FALSE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to lock transient datatype") + if (H5T_lock(dt, FALSE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype") - ret_value = dt; + /* Atomize */ + if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") done: - if(!ret_value && dt && (H5T_close(dt) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype") + if (H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_type() */ diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index b285920..9826859 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -76,8 +76,8 @@ typedef struct H5A_attr_iter_op_t { H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr); H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr); H5_DLL H5T_t *H5A_type(const H5A_t *attr); -H5_DLL H5T_t *H5A_get_type(H5A_t *attr); -H5_DLL H5S_t *H5A_get_space(H5A_t *attr); +H5_DLL hid_t H5A_get_type(H5A_t *attr); +H5_DLL hid_t H5A_get_space(H5A_t *attr); H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data); diff --git a/src/H5Dio.c b/src/H5Dio.c index 104a632..aee3c35 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -49,10 +49,6 @@ /* Local Prototypes */ /********************/ -/* Internal I/O routines */ -static herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, - const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf); - /* Setup/teardown routines */ static herr_t H5D__ioinfo_init(H5D_t *dset, #ifndef H5_HAVE_PARALLEL @@ -324,18 +320,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__pre_write - * - * Purpose: Preparation for writing data. + * Function: H5D__pre_write * - * Return: Non-negative on success/Negative on failure + * Purpose: Preparation for writing data. * - * Programmer: Raymond Lu - * 2 November 2012 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf) @@ -962,7 +955,9 @@ const io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI); #endif /* H5_HAVE_PARALLEL */ -done: +#ifdef H5_DEBUG_BUILD + done: +#endif /* H5_DEBUG_BUILD */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__ioinfo_init() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index beb1089..542abd0 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -598,6 +598,8 @@ H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id); H5_DLL herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id); /* Internal I/O routines */ +H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, + const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf); H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, void *buf/*out*/); @@ -21,20 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -377,83 +377,82 @@ done: /*------------------------------------------------------------------------- * Function: H5Fcreate * - * Purpose: This is the primary function for creating HDF5 files . The - * flags parameter determines whether an existing file will be - * overwritten or not. All newly created files are opened for - * both reading and writing. All flags may be combined with the - * bit-wise OR operator (`|') to change the behavior of the file - * create call. + * Purpose: This is the primary function for creating HDF5 files . The + * flags parameter determines whether an existing file will be + * overwritten or not. All newly created files are opened for + * both reading and writing. All flags may be combined with the + * bit-wise OR operator (`|') to change the behavior of the file + * create call. * - * The more complex behaviors of a file's creation and access - * are controlled through the file-creation and file-access - * property lists. The value of H5P_DEFAULT for a template - * value indicates that the library should use the default - * values for the appropriate template. + * The more complex behaviors of a file's creation and access + * are controlled through the file-creation and file-access + * property lists. The value of H5P_DEFAULT for a template + * value indicates that the library should use the default + * values for the appropriate template. * * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for - * the list of file creation and file access properties. + * the list of file creation and file access properties. * - * Return: Success: A file ID - * Failure: FAIL + * Return: Success: A file ID + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ - hid_t ret_value; /*return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id;/* dxpl used by library */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ - if(!filename || !*filename) + if (!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name") + /* In this routine, we only accept the following flags: * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE */ - if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) + if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") + /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ - if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) + if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation") /* Check file creation property list */ - if(H5P_DEFAULT == fcpl_id) + if (H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else - if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) + if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) + if (H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* - * Adjust bit flags by turning on the creation bit and making sure that + /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. */ - if (0==(flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))) - flags |= H5F_ACC_EXCL; /*default*/ + if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) + flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; - /* - * Create a new file or truncate an existing file. - */ - if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) + /* Create a new file or truncate an existing file. */ + if (NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file */ - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) + if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") /* Keep this ID in file object structure */ new_file->file_id = ret_value; done: - if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) + if (ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") FUNC_LEAVE_API(ret_value) @@ -463,46 +462,28 @@ done: /*------------------------------------------------------------------------- * Function: H5Fopen * - * Purpose: This is the primary function for accessing existing HDF5 - * files. The FLAGS argument determines whether writing to an - * existing file will be allowed or not. All flags may be - * combined with the bit-wise OR operator (`|') to change the - * behavior of the file open call. The more complex behaviors - * of a file's access are controlled through the file-access - * property list. - * - * See Also: H5Fpublic.h for a list of possible values for FLAGS. - * - * Return: Success: A file ID - * Failure: FAIL - * - * Modifications: - * Robb Matzke, 1997-07-18 - * File struct creation and destruction is through H5F_new() and - * H5F__dest(). Reading the root symbol table entry is done with - * H5G_decode(). - * - * Robb Matzke, 1997-09-23 - * Most of the work is now done by H5F_open() since H5Fcreate() - * and H5Fopen() originally contained almost identical code. - * - * Robb Matzke, 1998-02-18 - * Added better error checking for the flags and the file access - * property list. It used to be possible to make the library - * dump core by passing an object ID that was not a file access - * property list. - * - * Robb Matzke, 1999-08-02 - * The file access property list is passed to the H5F_open() as - * object IDs. + * Purpose: This is the primary function for accessing existing HDF5 + * files. The FLAGS argument determines whether writing to an + * existing file will be allowed or not. All flags may be + * combined with the bit-wise OR operator (`|') to change the + * behavior of the file open call. The more complex behaviors + * of a file's access are controlled through the file-access + * property list. + * + * See Also: H5Fpublic.h for a list of possible values for FLAGS. + * + * Return: Success: A file ID + * + * Failure: FAIL + * *------------------------------------------------------------------------- */ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -685,28 +666,28 @@ H5Fclose(hid_t file_id) H5TRACE1("e", "i", file_id); /* Check/fix arguments. */ - if(H5I_FILE != H5I_get_type(file_id)) + if (H5I_FILE != H5I_get_type(file_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") /* Flush file if this is the last reference to this id and we have write * intent, unless it will be flushed by the "shared" file being closed. * This is only necessary to replicate previous behaviour, and could be - * disabled by an option/property to improve performance. */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + * disabled by an option/property to improve performance. + */ + if (NULL == (f = (H5F_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { - if((nref = H5I_get_ref(file_id, FALSE)) < 0) + if ((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { + if ((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") - if(nref == 1) - if(H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0) + if (nref == 1) + if (H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } /* end if */ + } - /* - * Decrement reference count on atom. When it reaches zero the file will + /* Decrement reference count on atom. When it reaches zero the file will * be closed. */ - if(H5I_dec_app_ref(file_id) < 0) + if (H5I_dec_app_ref(file_id) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed") done: @@ -119,7 +119,7 @@ H5FD__init_package(void) FUNC_ENTER_PACKAGE if(H5I_register_type(H5I_VFL_CLS) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Reset the file serial numbers */ H5FD_file_serial_no_g = 0; @@ -151,18 +151,18 @@ H5FD_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_PKG_INIT_VAR) { - if(H5I_nmembers(H5I_VFL) > 0) { - (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); + if(H5I_nmembers(H5I_VFL) > 0) { + (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ else { - /* Destroy the VFL driver id group */ - n += (H5I_dec_type_ref(H5I_VFL) > 0); + /* Destroy the VFL driver ID group */ + n += (H5I_dec_type_ref(H5I_VFL) > 0); - /* Mark closed */ + /* Mark closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; - } /* end else */ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) @@ -247,7 +247,7 @@ H5FDregister(const H5FD_class_t *cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping") /* Create the new class ID */ - if((ret_value=H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) + if((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index cf52288..f223195 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -409,39 +409,39 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) H5O_loc_t *oloc; /* Group entry info for object */ switch(olist->obj_type) { - case H5I_ATTR: - oloc = H5A_oloc((H5A_t *)obj_ptr); - break; - - case H5I_GROUP: - oloc = H5G_oloc((H5G_t *)obj_ptr); - break; - - case H5I_DATASET: - oloc = H5D_oloc((H5D_t *)obj_ptr); - break; - - case H5I_DATATYPE: - if(H5T_is_named((H5T_t*)obj_ptr)==TRUE) - oloc = H5T_oloc((H5T_t*)obj_ptr); - else - oloc = NULL; - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: + case H5I_ATTR: + oloc = H5A_oloc((H5A_t *)obj_ptr); + break; + + case H5I_GROUP: + oloc = H5G_oloc((H5G_t *)obj_ptr); + break; + + case H5I_DATASET: + oloc = H5D_oloc((H5D_t *)obj_ptr); + break; + + case H5I_DATATYPE: + if(H5T_is_named((H5T_t*)obj_ptr)==TRUE) + oloc = H5T_oloc((H5T_t*)obj_ptr); + else + oloc = NULL; + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown data object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object") } /* end switch */ if((olist->file_info.local && @@ -1575,7 +1575,7 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi * * Purpose: Flushes cached data. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 3cd5c21..17d7850 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -25,9 +25,6 @@ #include "H5MMprivate.h" /* Memory management */ /* PRIVATE PROTOTYPES */ -static herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, - hid_t plist_id, hid_t dxpl_id); -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); @@ -99,7 +96,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED plist_id, hid_t dxpl_id) { @@ -265,7 +262,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id) { H5G_t *child_group = NULL; /* Child's group in parent mtab */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index cd6a295..c9aba56 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -361,16 +361,16 @@ struct H5F_file_t { * to shared H5F_file_t structs. */ struct H5F_t { - char *open_name; /* Name used to open file */ - char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ - char *extpath; /* Path for searching target external link file */ - H5F_file_t *shared; /* The shared file info */ - unsigned nopen_objs; /* Number of open object headers*/ - H5FO_t *obj_count; /* # of time each object is opened through top file structure */ - hid_t file_id; /* ID of this file */ - hbool_t closing; /* File is in the process of being closed */ - struct H5F_t *parent; /* Parent file that this file is mounted to */ - unsigned nmounts; /* Number of children mounted to this file */ + char *open_name; /* Name used to open file */ + char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ + char *extpath; /* Path for searching target external link file */ + H5F_file_t *shared; /* The shared file info */ + unsigned nopen_objs; /* Number of open object headers */ + H5FO_t *obj_count; /* # of time each object is opened through top file structure */ + hid_t file_id; /* ID of this file */ + hbool_t closing; /* File is in the process of being closed */ + struct H5F_t *parent; /* Parent file that this file is mounted to */ + unsigned nmounts; /* Number of children mounted to this file */ #ifdef H5_HAVE_PARALLEL H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ hbool_t coll_md_write; /* Do all metadata writes collectively */ @@ -400,11 +400,12 @@ H5_DLL herr_t H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t H5_DLL herr_t H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing); H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t meta_dxpl_id, hid_t raw_dxpl_id); H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); -H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, - hid_t meta_dxpl_id, hid_t raw_dxpl_id); +H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_id, hid_t raw_dxpl_id); H5_DLL herr_t H5F_close(H5F_t *f); /* File mount related routines */ +H5_DLL herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id, hid_t dxpl_id); +H5_DLL herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id); H5_DLL herr_t H5F_close_mounts(H5F_t *f); H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key); H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 2ec071f..50325bb 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -18,6 +18,9 @@ #ifndef _H5Fprivate_H #define _H5Fprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5F_t H5F_t; + /* Include package's public header */ #include "H5Fpublic.h" @@ -475,8 +478,8 @@ #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_NAME "driver-id/info" /* File driver ID & info */ -#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ +#define H5F_ACS_FILE_DRV_NAME "vfd_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) */ #define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */ @@ -485,7 +488,7 @@ #define H5F_ACS_FORMAT_HIGH_BOUND_NAME "high_bound" /* 'high' bound of library format versions */ #define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */ #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ -#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ +#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ @@ -584,7 +587,7 @@ #define H5_SIZEOF_CHKSUM 4 /* v1 B-tree node signature */ -#define H5B_MAGIC "TREE" +#define H5B_MAGIC "TREE" /* v2 B-tree signatures */ #define H5B2_HDR_MAGIC "BTHD" /* Header */ @@ -614,7 +617,7 @@ #define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */ /* Global heap signature */ -#define H5HG_MAGIC "GCOL" +#define H5HG_MAGIC "GCOL" /* Local heap signature */ #define H5HL_MAGIC "HEAP" @@ -636,12 +639,12 @@ struct H5B_class_t; struct H5UC_t; struct H5O_loc_t; struct H5HG_heap_t; +struct H5VL_class_t; struct H5P_genplist_t; /* Forward declarations for anonymous H5F objects */ /* Main file structures */ -typedef struct H5F_t H5F_t; typedef struct H5F_file_t H5F_file_t; /* Block aggregation structure */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 580b062..6b641f1 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -32,10 +32,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ /****************/ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 228fb9c..1cc7e15 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -695,29 +695,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Giterate + * Function: H5Giterate * - * Purpose: Iterates over the entries of a group. The LOC_ID and NAME - * identify the group over which to iterate and IDX indicates - * where to start iterating (zero means at the beginning). The - * OPERATOR is called for each member and the iteration - * continues until the operator returns non-zero or all members - * are processed. The operator is passed a group ID for the - * group being iterated, a member name, and OP_DATA for each - * member. + * Purpose: Iterates over the entries of a group. The LOC_ID and NAME + * identify the group over which to iterate and IDX indicates + * where to start iterating (zero means at the beginning). The + * OPERATOR is called for each member and the iteration + * continues until the operator returns non-zero or all members + * are processed. The operator is passed a group ID for the + * group being iterated, a member name, and OP_DATA for each + * member. * - * Note: Deprecated in favor of H5Literate + * NOTE: Deprecated in favor of H5Literate * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * - * Programmer: Robb Matzke - * Monday, March 23, 1998 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ @@ -725,21 +722,21 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_obj; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value; + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_obj; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_p && *idx_p < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") - if(!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + if (!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if (idx_p && *idx_p < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + if (!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set number of objects looked at to zero */ last_obj = 0; @@ -750,11 +747,11 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_func.op_old = op; /* Call private function. */ - if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") + if ((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ - if(idx_p) + if (idx_p) *idx_p = (int)last_obj; done: @@ -12,48 +12,40 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * FILE: H5I.c - Internal storage routines for handling "IDs" + * FILE: H5I.c - Internal storage routines for handling "IDs" * - * REMARKS: ID's which allow objects (void *'s currently) to be bundled - * into "types" for more general storage. + * REMARKS: IDs which allow objects (void * currently) to be bundled + * into "types" for more general storage. * - * DESIGN: The types are stored in an array of pointers to store each - * type in an element. Each "type" node contains a link to a - * hash table to manage the IDs in each type. Allowed types are - * values within the range 1 to H5I_MAX_NUM_TYPES and are given out - * at run-time. Types used by the library are stored in global - * variables defined in H5Ipublic.h. - * - * AUTHOR: Quincey Koziol - * - * MODIFICATIONS: - * 1/3/96 - Starting writing specs & coding prototype - * 1/7/96 - Finished coding prototype - * 6/10/97 - Moved into HDF5 library - * 5/18/04 - Expanded to allow registration of new types at run-time + * DESIGN: The types are stored in an array of pointers to store each + * type in an element. Each "type" node contains a link to a + * hash table to manage the IDs in each type. Allowed types are + * values within the range 1 to H5I_MAX_NUM_TYPES and are given out + * at run-time. Types used by the library are stored in global + * variables defined in H5Ipublic.h. */ #include "H5Imodule.h" /* This source code file is part of the H5I module */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Ipkg.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip Lists */ /* Define this to compile in support for dumping ID information */ /* #define H5I_DEBUG_OUTPUT */ #ifndef H5I_DEBUG_OUTPUT -#include "H5Gprivate.h" /* Groups */ +#include "H5Gprivate.h" /* Groups */ #else /* H5I_DEBUG_OUTPUT */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Tprivate.h" /* Datatypes */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Tprivate.h" /* Datatypes */ #endif /* H5I_DEBUG_OUTPUT */ /* Local Macros */ @@ -194,23 +186,19 @@ H5I_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Iregister_type + * Function: H5Iregister_type * - * Purpose: Public interface to H5I_register_type. Creates a new type - * of ID's to give out. A specific number (RESERVED) of type - * entries may be reserved to enable "constant" values to be handed - * out which are valid IDs in the type, but which do not map to any - * data structures and are not allocated dynamically later. HASH_SIZE is - * the minimum hash table size to use for the type. FREE_FUNC is - * called with an object pointer when the object is removed from - * the type. + * Purpose: Public interface to H5I_register_type. Creates a new type + * of ID's to give out. A specific number (RESERVED) of type + * entries may be reserved to enable "constant" values to be handed + * out which are valid IDs in the type, but which do not map to any + * data structures and are not allocated dynamically later. HASH_SIZE is + * the minimum hash table size to use for the type. FREE_FUNC is + * called with an object pointer when the object is removed from + * the type. * - * Return: Success: Type ID of the new type - * Failure: H5I_BADID - * - * Programmers: Nathaniel Furrer - * James Laird - * Friday, April 30, 2004 + * Return: Success: Type ID of the new type + * Failure: H5I_BADID * *------------------------------------------------------------------------- */ @@ -278,18 +266,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_register_type + * Function: H5I_register_type * - * Purpose: Creates a new type of ID's to give out. - * The class is initialized or its reference count is incremented + * Purpose: Creates a new type of ID's to give out. + * The class is initialized or its reference count is incremented * (if it is already initialized). * - * Return: Success: Type ID of the new type - * Failure: H5I_BADID - * - * Programmers: Nathaniel Furrer - * James Laird - * Friday, April 30, 2004 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -343,17 +326,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Itype_exists + * Function: H5Itype_exists * * Purpose: Query function to inform the user if a given type is * currently registered with the library. * - * Return: Success: 1 if the type is registered, 0 if it is not - * Failure: Negative - * - * Programmer: James Laird - * Nathaniel Furrer - * Tuesday, June 29, 2004 + * Return: Success: 1 if the type is registered, 0 if it is not + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -365,10 +344,10 @@ H5Itype_exists(H5I_type_t type) FUNC_ENTER_API(FAIL) H5TRACE1("t", "It", type); - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_id_type_list_g[type]) ret_value = FALSE; done: @@ -409,9 +388,9 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members) * an error when the supplied type does not exist. */ if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") if(NULL == H5I_id_type_list_g[type]) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") if(num_members) { int64_t members; @@ -693,15 +672,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iregister + * Function: H5Iregister * - * Purpose: Public interface to H5I_register. - * - * Return: Success: New object id. - * Failure: Negative + * Purpose: Public interface to H5I_register. * - * Programmer: Nathaniel Furrer - * James Laird + * Return: Success: New object id. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -724,58 +700,54 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_register + * Function: H5I_register * - * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. - * This routine does _not_ check for unique-ness of the objects, - * if you register an object twice, you will get two different - * IDs for it. This routine does make certain that each ID in a - * type is unique. IDs are created by getting a unique number - * for the type the ID is in and incorporating the type into - * the ID which is returned to the user. - * - * Return: Success: New object id. - * Failure: Negative + * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. + * This routine does _not_ check for unique-ness of the objects, + * if you register an object twice, you will get two different + * IDs for it. This routine does make certain that each ID in a + * type is unique. IDs are created by getting a unique number + * for the type the ID is in and incorporating the type into + * the ID which is returned to the user. * - * Programmer: Unknown + * Return: Success: New object id + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *id_ptr; /*ptr to the new ID information */ - hid_t new_id; /*new ID */ - hid_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ + hid_t new_id = -1; /* new ID */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) - HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") + if ((NULL == type_ptr) || (type_ptr->init_count <= 0)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, H5I_INVALID_HID, "invalid type") + if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) + HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") - /* Create the struct & it's ID */ + /* Create the struct & its ID */ new_id = H5I_MAKE(type, type_ptr->nextid); id_ptr->id = new_id; - id_ptr->count = 1; /*initial reference count*/ + id_ptr->count = 1; /* initial reference count */ id_ptr->app_count = !!app_ref; id_ptr->obj_ptr = object; /* Insert into the type */ - if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") + if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert ID node into skip list") type_ptr->id_count++; type_ptr->nextid++; - /* - * Sanity check for the 'nextid' getting too large and wrapping around. - */ + /* Sanity check for the 'nextid' getting too large and wrapping around */ HDassert(type_ptr->nextid <= ID_MASK); /* Set return value */ @@ -789,27 +761,23 @@ done: /*------------------------------------------------------------------------- * Function: H5I_register_with_id * - * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. - * This routine will check to ensure the supplied ID is not already - * in use, and ensure that it is a valid ID for the given type, - * but will NOT check to ensure the OBJECT is not already - * registered (thus, it is possible to register one object under - * multiple IDs). + * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. + * This routine will check to ensure the supplied ID is not already + * in use, and ensure that it is a valid ID for the given type, + * but will NOT check to ensure the OBJECT is not already + * registered (thus, it is possible to register one object under + * multiple IDs). * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Mike McGreevy - * Wednesday, July 21, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *id_ptr; /*ptr to the new ID information */ - herr_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr; /* ptr to the type */ + H5I_id_info_t *id_ptr; /* ptr to the new ID information */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1199,10 +1167,10 @@ H5I_remove(hid_t id) /* Check arguments */ type = H5I_TYPE(id); if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; if(type_ptr == NULL || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") /* Remove the node from the type */ if(NULL == (ret_value = H5I__remove_common(type_ptr, id))) @@ -1238,7 +1206,7 @@ H5Idec_ref(hid_t id) /* Check arguments */ if(id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual decrement operation */ if((ret_value = H5I_dec_app_ref(id)) < 0) @@ -1371,16 +1339,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_dec_app_ref_always_close - * - * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID, - * even when the free routine fails + * Function: H5I_dec_app_ref_always_close * - * Return: Success: New app. reference count. - * Failure: Negative + * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID, + * even when the free routine fails * - * Programmer: Quincey Koziol - * Sept 16, 2010 + * Return: Success: New app. reference count. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1398,7 +1363,7 @@ H5I_dec_app_ref_always_close(hid_t id) ret_value = H5I_dec_app_ref(id); /* Check for failure */ - if(ret_value < 0) { + if (ret_value < 0) { /* * If an object is closing, we can remove the ID even though the free * method might fail. This can happen when a mandatory filter fails to @@ -1408,7 +1373,7 @@ H5I_dec_app_ref_always_close(hid_t id) H5I_remove(id); HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1416,15 +1381,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iinc_ref - * - * Purpose: Increments the number of references outstanding for an ID. + * Function: H5Iinc_ref * - * Return: Success: New reference count - * Failure: Negative + * Purpose: Increments the number of references outstanding for an ID. * - * Programmer: Quincey Koziol - * Dec 7, 2003 + * Return: Success: New reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1437,11 +1399,11 @@ H5Iinc_ref(hid_t id) H5TRACE1("Is", "i", id); /* Check arguments */ - if(id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + if (id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual increment operation */ - if((ret_value = H5I_inc_ref(id, TRUE)) < 0) + if ((ret_value = H5I_inc_ref(id, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count") done: @@ -1450,15 +1412,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_inc_ref - * - * Purpose: Increment the reference count for an object. + * Function: H5I_inc_ref * - * Return: Success: The new reference count. - * Failure: Negative + * Purpose: Increment the reference count for an object. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Return: Success: The new reference count. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1474,8 +1433,8 @@ H5I_inc_ref(hid_t id, hbool_t app_ref) HDassert(id >= 0); /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + if (NULL == (id_ptr = H5I__find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Adjust reference counts */ ++(id_ptr->count); @@ -1491,15 +1450,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_ref - * - * Purpose: Retrieves the number of references outstanding for an ID. + * Function: H5Iget_ref * - * Return: Success: Reference count - * Failure: Negative + * Purpose: Retrieves the number of references outstanding for an ID. * - * Programmer: Quincey Koziol - * Dec 7, 2003 + * Return: Success: Reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1512,11 +1468,11 @@ H5Iget_ref(hid_t id) H5TRACE1("Is", "i", id); /* Check arguments */ - if(id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + if (id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual retrieve operation */ - if((ret_value = H5I_get_ref(id, TRUE)) < 0) + if ((ret_value = H5I_get_ref(id, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") done: @@ -1525,15 +1481,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_ref + * Function: H5I_get_ref * - * Purpose: Retrieve the reference count for an object. - * - * Return: Success: The reference count. - * Failure: Negative + * Purpose: Retrieve the reference count for an object. * - * Programmer: Quincey Koziol - * Saturday, Decemeber 6, 2003 + * Return: Success: The reference count. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1549,8 +1502,8 @@ H5I_get_ref(hid_t id, hbool_t app_ref) HDassert(id >= 0); /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + if (NULL == (id_ptr = H5I__find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Set return value */ ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count); @@ -1561,16 +1514,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iinc_type_ref + * Function: H5Iinc_type_ref * - * Purpose: Increments the number of references outstanding for an ID type. + * Purpose: Increments the number of references outstanding for an ID type. * - * Return: Success: New reference count - * Failure: Negative - * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Return: Success: New reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1583,14 +1532,14 @@ H5Iinc_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || type >= H5I_next_type) + if (type <= 0 || type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual increment operation */ - if((ret_value = H5I__inc_type_ref(type)) < 0) + if ((ret_value = H5I__inc_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID type ref count") done: @@ -1599,16 +1548,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__inc_type_ref - * - * Purpose: Increment the reference count for an ID type. + * Function: H5I__inc_type_ref * - * Return: Success: The new reference count. - * Failure: Negative + * Purpose: Increment the reference count for an ID type. * - * Programmer: James Laird - * Nat Furrer - * Friday, April 30, 2004 + * Return: Success: The new reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1625,8 +1570,8 @@ H5I__inc_type_ref(H5I_type_t type) /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + if (!type_ptr) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ ret_value = (int)(++(type_ptr->init_count)); @@ -1637,24 +1582,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Idec_type_ref - * - * Purpose: Decrements the reference count on an entire type of IDs. - * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling - * the free-func for each ID's object and then adding the ID - * struct to the ID free list. Public interface to - * H5I_dec_type_ref. - * Returns the number of references to the type on success; a - * return value of 0 means that the type will have to be - * re-initialized before it can be used again (and should probably - * be set to H5I_UNINIT). - * - * Return: Number of references to type on success/Negative on failure - * - * Programmer: Nathaniel Furrer - * James Laird + * Function: H5Idec_type_ref + * + * Purpose: Decrements the reference count on an entire type of IDs. + * If the type reference count becomes zero then the type is + * destroyed along with all atoms in that type regardless of + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. Public interface to + * H5I_dec_type_ref. + * Returns the number of references to the type on success; a + * return value of 0 means that the type will have to be + * re-initialized before it can be used again (and should probably + * be set to H5I_UNINIT). + * + * NOTE: Using an error type to also represent a count is semantially + * incorrect. We should consider fixing this in a future major + * release (DER). + * + * Return: Success: Number of references to type + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1666,7 +1613,7 @@ H5Idec_type_ref(H5I_type_t type) FUNC_ENTER_API(FAIL) H5TRACE1("e", "It", type); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I_dec_type_ref(type); @@ -1677,22 +1624,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_dec_type_ref - * - * Purpose: Decrements the reference count on an entire type of IDs. - * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling - * the free-func for each ID's object and then adding the ID - * struct to the ID free list. - * Returns the number of references to the type on success; a - * return value of 0 means that the type will have to be - * re-initialized before it can be used again (and should probably - * be set to H5I_UNINIT). - * - * Return: Number of references to type on success/Negative on failure - * - * Programmer: Unknown + * Function: H5I_dec_type_ref + * + * Purpose: Decrements the reference count on an entire type of IDs. + * If the type reference count becomes zero then the type is + * destroyed along with all atoms in that type regardless of + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. + * Returns the number of references to the type on success; a + * return value of 0 means that the type will have to be + * re-initialized before it can be used again (and should probably + * be set to H5I_UNINIT). + * + * Return: Success: Number of references to type + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1704,27 +1650,26 @@ H5I_dec_type_ref(H5I_type_t type) FUNC_ENTER_NOAPI(FAIL) - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + if (type_ptr == NULL || type_ptr->init_count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - /* - * Decrement the number of users of the atomic type. If this is the + /* Decrement the number of users of the atomic type. If this is the * last user of the type then release all atoms from the type and * free all memory it used. The free function is invoked for each atom * being freed. */ - if(1 == type_ptr->init_count) { + if (1 == type_ptr->init_count) { H5I__destroy_type(type); ret_value = 0; - } /* end if */ + } else { --(type_ptr->init_count); ret_value = (herr_t)type_ptr->init_count; - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1732,16 +1677,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_type_ref - * - * Purpose: Retrieves the number of references outstanding for a type. + * Function: H5Iget_type_ref * - * Return: Success: Reference count - * Failure: Negative + * Purpose: Retrieves the number of references outstanding for a type. * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Return: Success: Reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1754,14 +1695,14 @@ H5Iget_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || type >= H5I_next_type) + if (type <= 0 || type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual retrieve operation */ - if((ret_value = H5I__get_type_ref(type)) < 0) + if ((ret_value = H5I__get_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID type ref count") done: @@ -1770,25 +1711,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_type_ref - * - * Purpose: Retrieve the reference count for an ID type. + * Function: H5I__get_type_ref * - * Return: Success: The reference count. + * Purpose: Retrieve the reference count for an ID type. * - * Failure: Negative + * Return: Success: The reference count. * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Failure: Negative * *------------------------------------------------------------------------- */ static int H5I__get_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - int ret_value = -1; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1797,7 +1734,7 @@ H5I__get_type_ref(H5I_type_t type) /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr) + if (!type_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ @@ -1809,17 +1746,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iis_valid + * Function: H5Iis_valid * - * Purpose: Check if the given id is valid. An id is valid if it is in + * Purpose: Check if the given id is valid. An id is valid if it is in * use and has an application reference count of at least 1. * - * Return: Success: TRUE if the id is valid, FALSE otherwise. + * Return: Success: TRUE if the id is valid, FALSE otherwise. * - * Failure: Negative (never fails currently) - * - * Programmer: Neil Fortner - * Friday, October 31, 2008 (boo) + * Failure: Negative (never fails currently) * *------------------------------------------------------------------------- */ @@ -1835,9 +1769,7 @@ H5Iis_valid(hid_t id) /* Find the ID */ if (NULL == (id_ptr = H5I__find_id(id))) ret_value = FALSE; - - /* Check if the found id is an internal id */ - else if (!id_ptr->app_count) + else if (!id_ptr->app_count) /* Check if the found id is an internal id */ ret_value = FALSE; done: @@ -1846,19 +1778,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__search_cb - * - * Purpose: Callback routine for H5Isearch, when it calls H5I_iterate. - * Calls "user" callback search function, and then sets return - * value, based on the result of that callback. + * Function: H5I__search_cb * - * Return: Success: The first object in the type for which FUNC - * returns non-zero. NULL if FUNC returned zero - * for every object in the type. - * Failure: NULL + * Purpose: Callback routine for H5Isearch, when it calls H5I_iterate. + * Calls "user" callback search function, and then sets return + * value, based on the result of that callback. * - * Programmer: Quincey Koziol - * Friday, March 30, 2012 + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -1871,7 +1800,7 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) FUNC_ENTER_STATIC_NOERR ret_value = (*udata->app_cb)(obj, id, udata->app_key); - if(ret_value > 0) + if (ret_value > 0) udata->ret_obj = obj; FUNC_LEAVE_NOAPI(ret_value) @@ -1879,26 +1808,22 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) /*------------------------------------------------------------------------- - * Function: H5Isearch + * Function: H5Isearch * - * Purpose: Apply function FUNC to each member of type TYPE and return a - * pointer to the first object for which FUNC returns non-zero. - * The FUNC should take a pointer to the object and the KEY as - * arguments and return non-zero to terminate the search (zero - * to continue). Public interface to H5I_search. + * Purpose: Apply function FUNC to each member of type TYPE and return a + * pointer to the first object for which FUNC returns non-zero. + * The FUNC should take a pointer to the object and the KEY as + * arguments and return non-zero to terminate the search (zero + * to continue). Public interface to H5I_search. * - * Limitation: Currently there is no way to start searching from where a - * previous search left off. + * Limitation: Currently there is no way to start searching from where a + * previous search left off. * - * Return: Success: The first object in the type for which FUNC - * returns non-zero. NULL if FUNC returned zero - * for every object in the type. - * - * Failure: NULL + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. * - * Programmer: James Laird - * Nathaniel Furrer - * Friday, April 23, 2004 + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -1912,7 +1837,7 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) H5TRACE3("*x", "Itx*x", type, func, key); /* Check arguments */ - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Set up udata struct */ @@ -1934,17 +1859,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__iterate_cb + * Function: H5I__iterate_cb * - * Purpose: Callback routine for H5I_iterate, invokes "user" callback + * Purpose: Callback routine for H5I_iterate, invokes "user" callback * function, and then sets return value, based on the result of * that callback. * - * Return: Success: Non-negative on success - * Failure: Negative - * - * Programmer: Quincey Koziol - * Thursday, October 3, 2013 + * Return: Success: Non-negative on success + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1976,29 +1898,25 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /*------------------------------------------------------------------------- * Function: H5I_iterate * - * Purpose: Apply function FUNC to each member of type TYPE (with - * non-zero application reference count if app_ref is TRUE). - * Stop if FUNC returns a non zero value (i.e. anything - * other than H5_ITER_CONT). + * Purpose: Apply function FUNC to each member of type TYPE (with + * non-zero application reference count if app_ref is TRUE). + * Stop if FUNC returns a non zero value (i.e. anything + * other than H5_ITER_CONT). * - * If FUNC returns a positive value (i.e. H5_ITER_STOP), - * return SUCCEED. + * If FUNC returns a positive value (i.e. H5_ITER_STOP), + * return SUCCEED. * - * If FUNC returns a negative value (i.e. H5_ITER_ERROR), - * return FAIL. + * If FUNC returns a negative value (i.e. H5_ITER_ERROR), + * return FAIL. * - * The FUNC should take a pointer to the object and the - * udata as arguments and return non-zero to terminate - * siteration, and zero to continue. - * - * Limitation: Currently there is no way to start the iteration from - * where a previous iteration left off. + * The FUNC should take a pointer to the object and the + * udata as arguments and return non-zero to terminate + * siteration, and zero to continue. * - * Return: Success: SUCCEED - * Failure: FAIL + * Limitation: Currently there is no way to start the iteration from + * where a previous iteration left off. * - * Programmer: John Mainzer - * Monday, December 6, 2011 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -2011,12 +1929,12 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; /* Only iterate through ID list if it is initialized and there are IDs in type */ - if(type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { + if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ herr_t iter_status; /* Iteration status */ @@ -2026,9 +1944,9 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re iter_udata.app_ref = app_ref; /* Iterate over IDs */ - if((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) + if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -2036,16 +1954,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__find_id - * - * Purpose: Given an object ID find the info struct that describes the - * object. + * Function: H5I__find_id * - * Return: Success: Ptr to the object's info struct. + * Purpose: Given an object ID find the info struct that describes the + * object. * - * Failure: NULL + * Return: Success: A pointer to the object's info struct. * - * Programmer: Unknown + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -2060,12 +1976,12 @@ H5I__find_id(hid_t id) /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_DONE(NULL) + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_DONE(NULL) type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->init_count <= 0) - HGOTO_DONE(NULL) + if (!type_ptr || type_ptr->init_count <= 0) + HGOTO_DONE(NULL) /* Locate the ID node for the ID */ ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id); @@ -2076,17 +1992,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_name - * - * Purpose: Gets a name of an object from its ID. + * Function: H5Iget_name * - * Return: Success: The length of name. + * Purpose: Gets a name of an object from its ID. * - * Failure: -1 + * Return: Success: The length of the name * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: July 26, 2002 + * Failure: -1 * * Comments: Public function * If `name' is non-NULL then write up to `size' bytes into that @@ -2110,12 +2022,12 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) H5TRACE3("Zs", "ixz", id, name, size); /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + if (H5G_loc(id, &loc) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + if ((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) @@ -2123,30 +2035,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_file_id + * Function: H5Iget_file_id * - * Purpose: The public version of H5I_get_file_id(), obtains the file + * Purpose: The public version of H5I_get_file_id(), obtains the file * ID given an object ID. User has to close this ID. * - * Return: Success: file ID - * - * Failure: a negative value + * Return: Success: The file ID associated with the object * - * Programmer: Raymond Lu - * Oct 27, 2003 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Iget_file_id(hid_t obj_id) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); - if((ret_value = H5I_get_file_id(obj_id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID") + if ((ret_value = H5I_get_file_id(obj_id, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") done: FUNC_LEAVE_API(ret_value) @@ -2154,50 +2063,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_file_id + * Function: H5I_get_file_id * - * Purpose: The private version of H5Iget_file_id(), obtains the file + * Purpose: The private version of H5Iget_file_id(), obtains the file * ID given an object ID. * - * Return: Success: file ID - * Failure: a negative value + * Return: Success: The file ID associated with the object * - * Programmer: Raymond Lu - * Oct 27, 2003 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5I_get_file_id(hid_t obj_id, hbool_t app_ref) { - H5I_type_t type; /* ID type */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Get object type */ type = H5I_TYPE(obj_id); - if(type == H5I_FILE) { + if (type == H5I_FILE) { /* Increment reference count on file ID */ if(H5I_inc_ref(obj_id, app_ref) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") /* Set return value */ ret_value = obj_id; - } /* end if */ - else if(type == H5I_DATATYPE || type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) { + } + else if (type == H5I_DATATYPE || type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) { H5G_loc_t loc; /* Location of object */ /* Get the object location information */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") /* Get the file ID for the object */ if((ret_value = H5F_get_id(loc.oloc->file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get file ID") - } /* end if */ + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get file ID") + } else - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid object ID") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2206,34 +2113,29 @@ done: #ifdef H5I_DEBUG_OUTPUT /*------------------------------------------------------------------------- - * Function: H5I__debug_cb + * Function: H5I__debug_cb * - * Purpose: Dump the contents of an ID to stderr for debugging. + * Purpose: Dump the contents of an ID to stderr for debugging. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Robb Matzke - * Friday, February 19, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ - H5G_name_t *path = NULL; - int ret_value = H5_ITER_CONT; /* Return value */ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ + H5G_name_t *path = NULL; FUNC_ENTER_STATIC_NOERR - fprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); - fprintf(stderr, " count = %u\n", item->count); - fprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); + HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); + HDfprintf(stderr, " count = %u\n", item->count); + HDfprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); /* Get the group location, so we get get the name */ - switch(type) { + switch (type) { case H5I_GROUP: path = H5G_nameof((H5G_t*)item->obj_ptr); break; @@ -2246,31 +2148,40 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) path = H5T_nameof((H5T_t*)item->obj_ptr); break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: break; /* Other types of IDs are not stored in files */ - } /* end switch*/ + } - if(path) { - if(path->user_path_r) - fprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); - if(path->full_path_r) - fprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); - } /* end if */ + if (path) { + if (path->user_path_r) + HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); + if (path->full_path_r) + HDfprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5I__debug_cb() */ /*------------------------------------------------------------------------- - * Function: H5I__debug - * - * Purpose: Dump the contents of a type to stderr for debugging. + * Function: H5I__debug * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Dump the contents of a type to stderr for debugging. * - * Programmer: Robb Matzke - * Friday, February 19, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -2281,17 +2192,17 @@ H5I__debug(H5I_type_t type) FUNC_ENTER_STATIC_NOERR - fprintf(stderr, "Dumping ID type %d\n", (int)type); + HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; /* Header */ - fprintf(stderr, " init_count = %u\n", type_ptr->init_count); - fprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - fprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); - fprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); + HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); + HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); + HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); /* List */ - fprintf(stderr, " List:\n"); + HDfprintf(stderr, " List:\n"); H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type); FUNC_LEAVE_NOAPI(SUCCEED) @@ -50,18 +50,6 @@ typedef struct { hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_gi_t; -/* User data for path traversal routine for getting link info by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ - - /* Out */ - H5L_info_t *linfo; /* Buffer to return to user */ -} H5L_trav_gibi_t; - /* User data for path traversal callback to creating a link */ typedef struct { H5F_t *file; /* Pointer to the file */ @@ -108,47 +96,11 @@ typedef struct { void *buf; /* User buffer */ } H5L_trav_gv_t; -/* User data for path traversal routine for getting link value by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ - size_t size; /* Size of user buffer */ - - /* Out */ - void *buf; /* User buffer */ -} H5L_trav_gvbi_t; - /* User data for path traversal routine for removing link */ typedef struct { hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_rm_t; -/* User data for path traversal routine for removing link by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ -} H5L_trav_rmbi_t; - -/* User data for path traversal routine for getting name by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - size_t size; /* Size of name buffer */ - hid_t dxpl_id; /* DXPL to use in callback */ - - /* Out */ - char *name; /* Buffer to return name to user */ - ssize_t name_len; /* Length of full name */ -} H5L_trav_gnbi_t; - /********************/ /* Local Prototypes */ /********************/ @@ -185,8 +137,6 @@ static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, - hid_t dxpl_id); static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -866,17 +816,17 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ - if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") + if((ret_value = H5L_exists(&loc, name, lapl_id, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1181,24 +1131,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Literate + * Function: H5Literate * - * Purpose: Iterates over links in a group, with user callback routine, + * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. * * Same pattern of behavior as H5Giterate. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. - * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Programmer: Quincey Koziol - * Thursday, November 16, 2006 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ @@ -1206,25 +1152,25 @@ herr_t H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value; /* Return value */ + H5I_type_t id_type; /* Type of ID */ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data); /* Check arguments */ id_type = H5I_get_type(grp_id); - if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if (!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1235,8 +1181,8 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + if ((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ if(idx_p) @@ -2930,7 +2876,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__exists + * Function: H5L_exists * * Purpose: Returns whether a link exists in a group * @@ -2944,13 +2890,13 @@ done: * *------------------------------------------------------------------------- */ -static htri_t -H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) +htri_t +H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -2966,7 +2912,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L__exists() */ +} /* H5L_exists() */ /*------------------------------------------------------------------------- diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index dd243a6..8a2bd34 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -48,6 +48,54 @@ /* Library Private Typedefs */ /****************************/ +/* User data for path traversal routine for getting link value by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ + size_t size; /* Size of user buffer */ + + /* Out */ + void *buf; /* User buffer */ +} H5L_trav_gvbi_t; + +/* User data for path traversal routine for getting link info by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ + + /* Out */ + H5L_info_t *linfo; /* Buffer to return to user */ +} H5L_trav_gibi_t; + +/* User data for path traversal routine for getting name by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + size_t size; /* Size of name buffer */ + hid_t dxpl_id; /* DXPL to use in callback */ + + /* Out */ + char *name; /* Buffer to return name to user */ + ssize_t name_len; /* Length of full name */ +} H5L_trav_gnbi_t; + +/* User data for path traversal routine for removing link by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ +} H5L_trav_rmbi_t; + /* Structure for external link traversal callback property */ typedef struct H5L_elink_cb_t { H5L_elink_traverse_t func; @@ -81,6 +129,7 @@ H5_DLL herr_t H5L_move(H5G_loc_t *src_loc, const char *src_name, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id); +H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, @@ -3247,7 +3247,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* for self referential FSMs */ haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ /* for self referential FSMs */ - H5FS_stat_t fs_stat; /* Information for hdr FSM */ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ hbool_t reset_ring = FALSE; /* Whether we set the ring */ @@ -3310,6 +3309,9 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) reset_ring = TRUE; #ifndef NDEBUG +{ + H5FS_stat_t fs_stat; /* Information for hdr FSM */ + /* Verify that sm_hdr_fspace is floating if it exists */ if(sm_hdr_fspace) { /* Query free space manager info for this type */ @@ -3357,6 +3359,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) HDassert(fs_stat.alloc_sect_size == 0); } /* end if */ } /* end if */ +} #endif /* NDEBUG */ /* Free the space in the metadata aggregator. Do this via the diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 9764f56..b1592dd 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -405,7 +405,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id, hbool_ case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") break; } /* end switch */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 9c482b0..13e0e3e 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -247,20 +247,20 @@ struct H5O_msg_class_t { }; struct H5O_mesg_t { - const H5O_msg_class_t *type; /*type of message */ - hbool_t dirty; /*raw out of date wrt native */ - uint8_t flags; /*message flags */ - H5O_msg_crt_idx_t crt_idx; /*message creation index */ - unsigned chunkno; /*chunk number for this mesg */ - void *native; /*native format message */ - uint8_t *raw; /*ptr to raw data */ - size_t raw_size; /*size with alignment */ + const H5O_msg_class_t *type; /* type of message */ + hbool_t dirty; /* raw out of date wrt native */ + uint8_t flags; /* message flags */ + H5O_msg_crt_idx_t crt_idx; /* message creation index */ + unsigned chunkno; /* chunk number for this mesg */ + void *native; /* native format message */ + uint8_t *raw; /* pointer to raw data */ + size_t raw_size; /* size with alignment */ }; /* Struct for storing information about "best" message to move to new chunk */ typedef struct H5O_msg_alloc_info_t { int msgno; /* Index in message array */ - unsigned id; /* Message type ID on disk */ + unsigned id; /* Message type ID on disk */ unsigned chunkno; /* Index in chunk array */ size_t gap_size; /* Size of any "gap" in the chunk immediately after message */ size_t null_size; /* Size of any null message in the chunk immediately after message */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 9382cd5..5cf9dce 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -26,6 +26,7 @@ /* Early typedefs to avoid circular dependencies */ typedef struct H5O_t H5O_t; +typedef struct H5O_fill_t H5O_fill_t; /* Include the public header file for this API */ #include "H5Opublic.h" /* Object header functions */ @@ -309,7 +310,7 @@ typedef struct H5O_linfo_t { * message if it's shared. */ -typedef struct H5O_fill_t { +struct H5O_fill_t { H5O_shared_t sh_loc; /* Shared message info (must be first) */ unsigned version; /* Encoding version number */ @@ -319,7 +320,7 @@ typedef struct H5O_fill_t { H5D_alloc_time_t alloc_time; /* time to allocate space */ H5D_fill_time_t fill_time; /* time to write fill value */ hbool_t fill_defined; /* whether fill value is defined */ -} H5O_fill_t; +}; /* * Link message. diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a1d53cc..d2e1058 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -14,8 +14,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pfapl.c - * February 26 1998 - * Robb Matzke <matzke@llnl.gov> * * Purpose: File access property list class routines * @@ -32,21 +30,21 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5Ppkg.h" /* Property lists */ /* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif @@ -404,8 +402,8 @@ static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { - 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 */ + 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_STATIC diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index a468464..374c117 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -17,6 +17,9 @@ #ifndef _H5Pprivate_H #define _H5Pprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5P_genplist_t H5P_genplist_t; + /* Include package's public header */ #include "H5Ppublic.h" @@ -52,12 +55,7 @@ typedef enum H5P_coll_md_read_flag_t { H5P_USER_TRUE = 1 } H5P_coll_md_read_flag_t; -/* Forward declarations (for prototypes & type definitions) */ -struct H5O_fill_t; -struct H5T_t; - /* Forward declarations for anonymous H5P objects */ -typedef struct H5P_genplist_t H5P_genplist_t; typedef struct H5P_genclass_t H5P_genclass_t; typedef enum H5P_plist_type_t { @@ -145,6 +143,10 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ /* Library Private Prototypes */ /******************************/ +/* Forward declaration of structs used below */ +struct H5O_fill_t; +struct H5T_t; + /* Package initialization routine */ H5_DLL herr_t H5P_init(void); diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 12d1fd1..df6d2c3 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -11,10 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Module Info: Operations on bit vectors. A bit vector is an array of bytes - * with the least-significant bits in the first byte. That is, - * the bytes are in little-endian order. +/* Module Info: Operations on bit vectors. A bit vector is an array of bytes + * with the least-significant bits in the first byte. That is, + * the bytes are in little-endian order. */ #include "H5Tmodule.h" /* This source code file is part of the H5T module */ @@ -29,14 +28,11 @@ /*------------------------------------------------------------------------- - * Function: H5T__bit_copy + * Function: H5T__bit_copy * - * Purpose: Copies bits from one vector to another. + * Purpose: Copies bits from one vector to another. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 + * Return: void * *------------------------------------------------------------------------- */ @@ -50,8 +46,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, FUNC_ENTER_PACKAGE_NOERR - /* - * Normalize the offset to be a byte number and a bit offset within that + /* Normalize the offset to be a byte number and a bit offset within that * byte. */ s_idx = src_offset / 8; @@ -59,8 +54,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, src_offset %= 8; dst_offset %= 8; - /* - * Get things rolling. This means copying bits until we're aligned on a + /* Get things rolling. This means copying bits until we're aligned on a * source byte. This the following example, five bits are copied to the * destination. * @@ -75,30 +69,29 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, * ...+---------------+---------------+ * dst[d_idx+1] dst[d_idx] */ - while(src_offset && size > 0) { - size_t nbits = MIN3(size, 8 - dst_offset, 8 - src_offset); - size_t mask = ((size_t)1 << nbits) - 1; - - dst[d_idx] &= (uint8_t)~(mask << dst_offset); - dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); - - src_offset += nbits; - if(src_offset >= 8) { - s_idx++; - src_offset %= 8; - } /* end if */ - - dst_offset += nbits; - if(dst_offset >= 8) { - d_idx++; - dst_offset %= 8; - } /* end if */ - - size -= nbits; - } /* end while */ - - /* - * The middle bits. We are aligned on a source byte which needs to be + while (src_offset && size > 0) { + size_t nbits = MIN3(size, 8 - dst_offset, 8 - src_offset); + size_t mask = ((size_t)1 << nbits) - 1; + + dst[d_idx] &= (uint8_t)~(mask << dst_offset); + dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); + + src_offset += nbits; + if (src_offset >= 8) { + s_idx++; + src_offset %= 8; + } + + dst_offset += nbits; + if (dst_offset >= 8) { + d_idx++; + dst_offset %= 8; + } + + size -= nbits; + } + + /* The middle bits. We are aligned on a source byte which needs to be * copied to two (or one in the degenerate case) destination bytes. * * src[s_idx] @@ -122,48 +115,48 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, mask_lo = ((size_t)1 << (8 - shift)) - 1; mask_hi = (~mask_lo) & 0xff; - for(/*void*/; size > 8; size -= 8, d_idx++, s_idx++) { - if(shift) { - dst[d_idx + 0] &= (uint8_t)(~(mask_lo << shift)); - dst[d_idx + 0] |= (uint8_t)((src[s_idx] & mask_lo) << shift); - dst[d_idx + 1] &= (uint8_t)(~(mask_hi >> (8 - shift))); - dst[d_idx + 1] |= (uint8_t)((src[s_idx] & mask_hi) >> (8 - shift)); - } /* end if */ + for (/*void*/; size > 8; size -= 8, d_idx++, s_idx++) { + if (shift) { + dst[d_idx + 0] &= (uint8_t)(~(mask_lo << shift)); + dst[d_idx + 0] |= (uint8_t)((src[s_idx] & mask_lo) << shift); + dst[d_idx + 1] &= (uint8_t)(~(mask_hi >> (8 - shift))); + dst[d_idx + 1] |= (uint8_t)((src[s_idx] & mask_hi) >> (8 - shift)); + } else - dst[d_idx] = src[s_idx]; - } /* end for */ + dst[d_idx] = src[s_idx]; + } /* Finish up */ - while(size > 0) { - size_t nbits = (size_t)MIN3 (size, 8 - dst_offset, 8 - src_offset); - size_t mask = ((size_t)1 << nbits) - 1; + while (size > 0) { + size_t nbits = (size_t)MIN3 (size, 8 - dst_offset, 8 - src_offset); + size_t mask = ((size_t)1 << nbits) - 1; - dst[d_idx] &= (uint8_t)(~(mask << dst_offset)); - dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); + dst[d_idx] &= (uint8_t)(~(mask << dst_offset)); + dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); - src_offset += nbits; - if(src_offset >= 8) { - s_idx++; - src_offset %= 8; - } /* end if */ + src_offset += nbits; + if (src_offset >= 8) { + s_idx++; + src_offset %= 8; + } - dst_offset += nbits; - if(dst_offset >= 8) { - d_idx++; - dst_offset %= 8; - } /* end if */ + dst_offset += nbits; + if (dst_offset >= 8) { + d_idx++; + dst_offset %= 8; + } - size -= nbits; - } /* end while */ + size -= nbits; + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_copy() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_shift + * Function: H5T__bit_shift * - * Purpose: Simulation of hardware shifting. Shifts a bit vector + * Purpose: Simulation of hardware shifting. Shifts a bit vector * in a way similar to shifting a variable value, like * value <<= 3, or value >>= 16. SHIFT_DIST is positive for * left shift, negative for right shift. The bit vector starts @@ -173,10 +166,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, * For example, if we have a bit sequence 00011100, offset=2, * size=3, shift_dist=2, the result will be 00010000. * - * Return: void - * - * Programmer: Raymond Lu - * Monday, April 12, 2004 + * Return: void * *------------------------------------------------------------------------- */ @@ -193,25 +183,25 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) HDassert(buf); HDassert(size); - if(shift_dist) { + if (shift_dist) { size_t abs_shift_dist = (size_t)ABS(shift_dist); - if(abs_shift_dist >= size) + if (abs_shift_dist >= size) H5T__bit_set(buf, offset, size, 0); else { size_t buf_size = (size / 8) + 1; /* Size of shift buffer needed */ uint8_t *shift_buf; /* Pointer to shift buffer */ /* Wrap the local buffer for serialized header info */ - if(NULL == (wb = H5WB_wrap(tmp_buf, sizeof(tmp_buf)))) + if (NULL == (wb = H5WB_wrap(tmp_buf, sizeof(tmp_buf)))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't wrap buffer") /* Get a pointer to a buffer that's large enough */ - if(NULL == (shift_buf = (uint8_t *)H5WB_actual(wb, buf_size))) + if (NULL == (shift_buf = (uint8_t *)H5WB_actual(wb, buf_size))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Shift vector by making copies */ - if(shift_dist > 0) { /* left shift */ + if (shift_dist > 0) { /* left shift */ /* Copy part to be shifted to a temporary buffer */ H5T__bit_copy(shift_buf, (size_t)0, buf, offset, size - abs_shift_dist); @@ -220,18 +210,18 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) /* Zero-set the left part*/ H5T__bit_set(buf, offset, abs_shift_dist, 0); - } /* end if */ + } else { /* right shift */ H5T__bit_copy(shift_buf, (size_t)0, buf, offset + abs_shift_dist, size - abs_shift_dist); H5T__bit_copy(buf, offset, shift_buf, (size_t)0, size - abs_shift_dist); H5T__bit_set(buf, offset + size - abs_shift_dist, abs_shift_dist, 0); - } /* end else */ + } } /* end else */ } /* end if */ done: /* Release resources */ - if(wb && H5WB_unwrap(wb) < 0) + if (wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") FUNC_LEAVE_NOAPI(ret_value) @@ -239,27 +229,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__bit_get_d + * Function: H5T__bit_get_d * - * Purpose: Return a small bit sequence as a number. Bit vector starts + * Purpose: Return a small bit sequence as a number. Bit vector starts * at OFFSET and is SIZE bits long. * - * Return: Success: The bit sequence interpretted as an unsigned - * integer. - * - * Failure: 0 + * Return: Success: The bit sequence interpretted as an unsigned + * integer. * - * Programmer: Robb Matzke - * Tuesday, June 23, 1998 + * Failure: 0 * *------------------------------------------------------------------------- */ uint64_t 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 = 0; /* Return value */ + uint64_t val = 0; + size_t i, hs; + uint64_t ret_value = 0; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -271,11 +258,11 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) break; case H5T_ORDER_BE: - for(i = 0, hs = sizeof(val) / 2; i < hs; i++) { + for (i = 0, hs = sizeof(val) / 2; i < hs; i++) { uint8_t tmp = ((uint8_t*)&val)[i]; ((uint8_t*)&val)[i] = ((uint8_t*)&val)[sizeof(val) - (i + 1)]; ((uint8_t*)&val)[sizeof(val) - (i + 1)] = tmp; - } /* end for */ + } break; case H5T_ORDER_ERROR: @@ -285,7 +272,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) default: /* Unknown endianness. Bail out. */ HGOTO_DONE(UFAIL) - } /* end switch */ + } /* Set return value */ ret_value = val; @@ -296,14 +283,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__bit_set_d + * Function: H5T__bit_set_d * - * Purpose: Sets part of a bit vector to the specified unsigned value. + * Purpose: Sets part of a bit vector to the specified unsigned value. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 24, 1998 + * Return: void * *------------------------------------------------------------------------- */ @@ -321,11 +305,11 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) break; case H5T_ORDER_BE: - for(i = 0, hs = sizeof(val) / 2; i < hs; i++) { + for (i = 0, hs = sizeof(val) / 2; i < hs; i++) { uint8_t tmp = ((uint8_t *)&val)[i]; ((uint8_t *)&val)[i] = ((uint8_t *)&val)[sizeof(val) - (i + 1)]; ((uint8_t *)&val)[sizeof(val) - (i + 1)] = tmp; - } /* end for */ + } break; case H5T_ORDER_ERROR: @@ -334,7 +318,7 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) case H5T_ORDER_MIXED: default: HDabort(); - } /* end switch */ + } H5T__bit_copy(buf, offset, (uint8_t*)&val, (size_t)0, size); @@ -343,24 +327,19 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) /*------------------------------------------------------------------------- - * Function: H5T__bit_set + * Function: H5T__bit_set * - * Purpose: Sets or clears bits in a contiguous region of a vector - * beginning at bit OFFSET and continuing for SIZE bits. + * Purpose: Sets or clears bits in a contiguous region of a vector + * beginning at bit OFFSET and continuing for SIZE bits. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ void H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) { - int idx; + int idx; FUNC_ENTER_PACKAGE_NOERR @@ -369,54 +348,51 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) offset %= 8; /* The first partial byte */ - if(size && offset % 8) { - size_t nbits = MIN(size, 8 - offset); - unsigned mask = ((unsigned)1 << nbits) - 1; + if (size && offset % 8) { + size_t nbits = MIN(size, 8 - offset); + unsigned mask = ((unsigned)1 << nbits) - 1; - if(value) - buf[idx] = (uint8_t)(buf[idx] | (mask << offset)); - else - buf[idx] &= (uint8_t)(~(mask << offset)); + if (value) + buf[idx] = (uint8_t)(buf[idx] | (mask << offset)); + else + buf[idx] &= (uint8_t)(~(mask << offset)); - idx++; - size -= nbits; - } /* end if */ + idx++; + size -= nbits; + } /* The middle bytes */ - while(size >= 8) { - buf[idx++] = value ? 0xff : 0x00; - size -= 8; - } /* end while */ + while (size >= 8) { + buf[idx++] = value ? 0xff : 0x00; + size -= 8; + } /* The last partial byte */ - if(size) { - if(value) - buf[idx] |= (uint8_t)(((unsigned)1 << size) - 1); - else - buf[idx] &= (uint8_t)(~(((unsigned)1 << size) - 1)); - } /* end if */ + if (size) { + if (value) + buf[idx] |= (uint8_t)(((unsigned)1 << size) - 1); + else + buf[idx] &= (uint8_t)(~(((unsigned)1 << size) - 1)); + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_set() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_find + * Function: H5T__bit_find * - * Purpose: Finds the first bit with the specified VALUE within a region - * of a bit vector. The region begins at OFFSET and continues - * for SIZE bits, but the region can be searched from the least - * significat end toward the most significant end(H5T_BIT_LSB - * as DIRECTION), or from the most significant end to the least - * significant end(H5T_BIT_MSB as DIRECTION). + * Purpose: Finds the first bit with the specified VALUE within a region + * of a bit vector. The region begins at OFFSET and continues + * for SIZE bits, but the region can be searched from the least + * significat end toward the most significant end(H5T_BIT_LSB + * as DIRECTION), or from the most significant end to the least + * significant end(H5T_BIT_MSB as DIRECTION). * - * Return: Success: The position of the bit found, relative to - * the offset. + * Return: Success: The position of the bit found, relative to + * the offset. * - * Failure: -1 - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -424,9 +400,9 @@ ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value) { - ssize_t base = (ssize_t)offset; - ssize_t idx, i; - size_t iu; + ssize_t base = (ssize_t)offset; + ssize_t idx, i; + size_t iu; ssize_t ret_value = (-1); /* Return value */ /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ @@ -435,16 +411,16 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, /* Some functions call this with value=TRUE */ HDassert(TRUE == 1); - switch(direction) { + switch (direction) { case H5T_BIT_LSB: /* Calculate index */ idx = (ssize_t)(offset / 8); offset %= 8; /* Beginning */ - if(offset) { - for(iu = offset; iu < 8 && size > 0; iu++, size--) - if(value == (hbool_t)((buf[idx] >> iu) & 0x01)) + if (offset) { + for (iu = offset; iu < 8 && size > 0; iu++, size--) + if (value == (hbool_t)((buf[idx] >> iu) & 0x01)) HGOTO_DONE(8 * idx + (ssize_t)iu - base); offset = 0; @@ -452,10 +428,10 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } /* end if */ /* Middle */ - while(size >= 8) { - if((value ? 0x00 : 0xff) != buf[idx]) - for(i = 0; i < 8; i++) - if(value == (hbool_t)((buf[idx] >> i) & 0x01)) + while (size >= 8) { + if ((value ? 0x00 : 0xff) != buf[idx]) + for (i = 0; i < 8; i++) + if (value == (hbool_t)((buf[idx] >> i) & 0x01)) HGOTO_DONE(8 * idx + i - base); size -= 8; @@ -463,8 +439,8 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } /* end while */ /* End */ - for(i = 0; i < (ssize_t)size; i++) - if(value == (hbool_t)((buf[idx] >> i) & 0x01)) + for (i = 0; i < (ssize_t)size; i++) + if (value == (hbool_t)((buf[idx] >> i) & 0x01)) HGOTO_DONE(8 * idx + i - base); break; @@ -474,19 +450,19 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, offset %= 8; /* Beginning */ - if(size > 8 - offset && (offset + size) % 8) { - for(iu = (offset + size) % 8; iu > 0; --iu, --size) - if(value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) + if (size > 8 - offset && (offset + size) % 8) { + for (iu = (offset + size) % 8; iu > 0; --iu, --size) + if (value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) HGOTO_DONE(8 * idx + (ssize_t)(iu - 1) - base); --idx; } /* end if */ /* Middle */ - while(size >= 8) { - if((value ? 0x00 : 0xff) != buf[idx]) { - for(i = 7; i >= 0; --i) - if(value == (hbool_t)((buf[idx] >> i) & 0x01)) + while (size >= 8) { + if ((value ? 0x00 : 0xff) != buf[idx]) { + for (i = 7; i >= 0; --i) + if (value == (hbool_t)((buf[idx] >> i) & 0x01)) HGOTO_DONE(8 * idx + i - base); } /* end if */ @@ -495,11 +471,11 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } /* end while */ /* End */ - if(size > 0) { - for(iu = offset + size; iu > offset; --iu) - if(value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) + if (size > 0) { + for (iu = offset + size; iu > offset; --iu) + if (value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) HGOTO_DONE(8 * idx + (ssize_t)(iu - 1) - base); - } /* end if */ + } break; default: @@ -519,17 +495,14 @@ done: * * Return: The carry-out value. TRUE if overflows, FALSE otherwise. * - * Programmer: Robb Matzke - * Friday, June 26, 1998 - * *------------------------------------------------------------------------- */ hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size) { - size_t idx = start / 8; - unsigned carry = 1; - unsigned acc, mask; + size_t idx = start / 8; + unsigned carry = 1; + unsigned acc, mask; /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ FUNC_ENTER_PACKAGE_NOERR @@ -539,7 +512,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) start %= 8; /* The first partial byte */ - if(start) { + if (start) { if(size + start < 8) mask = ((unsigned)1 << size) - 1; else @@ -552,34 +525,34 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) size -= MIN(size, 8 - start); start = 0; idx++; - } /* end if */ + } /* The middle */ - while(carry && size >= 8) { + while (carry && size >= 8) { acc = buf[idx]; acc++; carry = acc & 0x100; buf[idx] = acc & 0xff; idx++; size -= 8; - } /* end while */ + } /* The last bits */ - if(carry && size > 0) { + if (carry && size > 0) { mask = ((unsigned)1 << size) - 1; acc = buf[idx] & mask; acc++; carry = acc & ((unsigned)1 << size); buf[idx] &= (uint8_t)(~mask); buf[idx] |= (uint8_t)(acc & mask); - } /* end if */ + } FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE) } /* end H5T__bit_inc() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_dec + * Function: H5T__bit_dec * * Purpose: Decrement part of a bit field by substracting 1. The bit * field starts with bit position START and is SIZE bits long. @@ -587,18 +560,15 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) * Return: The "borrow-in" value. It's TRUE if underflows, FALSE * otherwise. * - * Programmer: Raymond Lu - * March 17, 2004 - * *------------------------------------------------------------------------- */ hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size) { - size_t idx = start / 8; + size_t idx = start / 8; size_t pos = start % 8; uint8_t tmp; - unsigned borrow = 0; + unsigned borrow = 0; /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ FUNC_ENTER_PACKAGE_NOERR @@ -607,71 +577,72 @@ H5T__bit_dec(uint8_t *buf, size_t start, size_t size) HDassert(size); /* The first partial byte */ - if((size + start - 1) / 8 > idx) { /*bit sequence doesn't end in the same byte as starts*/ + if ((size + start - 1) / 8 > idx) { + /* The bit sequence doesn't end in the same byte as starts */ + /* Example: a sequence like 11000100 and start = 3. We substract 00001000 from * it and get 10111100. If a sequence is 00000111, we do right shift for START * bits and get 00000000. So we need to borrow from higher byte when we substract * 00001000. */ - if(!(buf[idx] >> pos)) + if (!(buf[idx] >> pos)) borrow = 1; buf[idx] = (uint8_t)(buf[idx] - (1 << pos)); idx++; size -= (8 - pos); /* The middle bytes */ - while(borrow && size >= 8) { - if(buf[idx]) + while (borrow && size >= 8) { + if (buf[idx]) borrow = 0; buf[idx]--; idx++; size -= 8; - } /* end while */ + } /* The last partial byte */ - if(borrow && size > 0) { + if (borrow && size > 0) { /* Similar to the first byte case, where sequence ends in the same byte as starts */ tmp = buf[idx]; buf[idx]--; - if((buf[idx] >> size) != tmp >> size) + if ((buf[idx] >> size) != tmp >> size) buf[idx] = (uint8_t)(buf[idx] + (1 << size)); - } /* end if */ - } /* end if */ - else { /* bit sequence ends in the same byte as starts */ + } + } + else { + /* The bit sequence ends in the same byte as starts */ + /* Example: a sequence like 11000100 and pos=3, size=3. We substract 00001000 * and get 10111100. A bit is borrowed from 6th bit(buf[idx]>>6=00000010, tmp>>6=00000011, * not equal). We need to put this bit back by increment 1000000. */ tmp = buf[idx]; buf[idx] = (uint8_t)(buf[idx] - (1 << pos)); - if((buf[idx] >> (pos + size)) != tmp >> (pos + size)) { + if ((buf[idx] >> (pos + size)) != tmp >> (pos + size)) { buf[idx] = (uint8_t)(buf[idx] + (1 << (pos + size))); borrow = 1; - } /* end if */ - } /* end else */ + } + } FUNC_LEAVE_NOAPI(borrow ? TRUE : FALSE) } /* end H5T__bit_dec() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_neg - * - * Purpose: negate part of a bit sequence. The bit - * field starts with bit position START and is SIZE bits long. + * Function: H5T__bit_neg * - * Return: void + * Purpose: Negate part of a bit sequence. The bit field starts with + * bit position START and is SIZE bits long. * - * Programmer: Raymond Lu - * March 19, 2004 + * Return: void * *------------------------------------------------------------------------- */ void H5T__bit_neg(uint8_t *buf, size_t start, size_t size) { - size_t idx = start / 8; + size_t idx = start / 8; size_t pos = start % 8; uint8_t tmp[1]; @@ -695,17 +666,19 @@ H5T__bit_neg(uint8_t *buf, size_t start, size_t size) buf[idx] = (uint8_t)~(buf[idx]); idx++; size -= 8; - } /* end while */ + } /* The last partial byte */ if(size > 0) { /* Similar to the first byte case, where sequence ends in the same byte as starts */ tmp[0] = (uint8_t)~buf[idx]; H5T__bit_copy(&(buf[idx]), (size_t)0, tmp, (size_t)0, size); - } /* end if */ - } /* end if */ - else /* bit sequence ends in the same byte as starts */ + } + } + else { + /* bit sequence ends in the same byte as starts */ H5T__bit_copy(&(buf[idx]), pos, tmp, pos, size); + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_neg() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 76d1b0c..02a6add 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -26,14 +26,15 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tpkg.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory Management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 84a997e..3f4b489 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -4079,13 +4079,15 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, sp = dp = (uint8_t*)buf; direction = 1; olap = nelmts; - } else if (src_p->shared->size>=dst_p->shared->size) { + } + else if (src_p->shared->size>=dst_p->shared->size) { double olap_d = HDceil((double)(dst_p->shared->size)/ (double)(src_p->shared->size-dst_p->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t*)buf; direction = 1; - } else { + } + else { double olap_d = HDceil((double)(src_p->shared->size)/ (double)(dst_p->shared->size-src_p->shared->size)); olap = (size_t)olap_d; @@ -4127,7 +4129,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (direction>0) { s = sp; d = elmtno<olap ? dbuf : dp; - } else { + } + else { s = sp; d = elmtno+olap >= nelmts ? dbuf : dp; } @@ -4136,7 +4139,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (d==dbuf) { HDassert((dp>=sp && dp<sp+src_p->shared->size) || (sp>=dp && sp<dp+dst_p->shared->size)); - } else { + } + else { HDassert((dp<sp && dp+dst_p->shared->size<=sp) || (sp<dp && sp+src_p->shared->size<=dp)); } @@ -4154,7 +4158,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s[src_p->shared->size-(i+1)] = s[i]; s[i] = tmp1; } - } else if (H5T_ORDER_VAX==src.order) { + } + else if (H5T_ORDER_VAX==src.order) { tsize = src_p->shared->size; HDassert(0 == tsize % 2); @@ -4187,7 +4192,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_set (d, dst.u.f.epos, dst.u.f.esize, FALSE); H5T__bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE); goto padding; - } else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, + } + else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, H5T_BIT_LSB, FALSE)<0) { /* +Inf or -Inf */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ @@ -4210,16 +4216,19 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, *this case.*/ if (H5T_NORM_NONE==dst.u.f.norm) H5T__bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, (size_t)1, TRUE); - } else if(except_ret == H5T_CONV_HANDLED) { + } + else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; goto next; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") goto padding; } - } else if (H5T_NORM_NONE==src.u.f.norm && H5T__bit_find (s, src.u.f.mpos, src.u.f.msize-1, + } + else if (H5T_NORM_NONE==src.u.f.norm && H5T__bit_find (s, src.u.f.mpos, src.u.f.msize-1, H5T_BIT_LSB, TRUE)<0 && H5T__bit_find (s, src.u.f.epos, src.u.f.esize, H5T_BIT_LSB, FALSE)<0) { /*This is a special case for the source of no implied mantissa bit. @@ -4246,11 +4255,13 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, *this case.*/ if (H5T_NORM_NONE==dst.u.f.norm) H5T__bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, (size_t)1, TRUE); - } else if(except_ret == H5T_CONV_HANDLED) { + } + else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; goto next; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") goto padding; @@ -4259,7 +4270,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * still need to handle legacy VAX files so this code must * remain in place. */ - } else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, + } + else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, H5T_BIT_LSB, FALSE)<0) { /* NaN */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ @@ -4275,11 +4287,13 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_copy (d, dst.u.f.sign, s, src.u.f.sign, (size_t)1); H5T__bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE); H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, TRUE); - } else if(except_ret == H5T_CONV_HANDLED) { + } + else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; goto next; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") goto padding; @@ -4292,7 +4306,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ expo = (int64_t)H5T__bit_get_d(s, src.u.f.epos, src.u.f.esize); - if(expo==0) + if (expo==0) denormalized=TRUE; /* @@ -4302,16 +4316,19 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, implied = 1; mpos = src.u.f.mpos; mrsh = 0; - if(0 == expo || H5T_NORM_NONE == src.u.f.norm) { - if((bitno = H5T__bit_find(s, src.u.f.mpos, src.u.f.msize, H5T_BIT_MSB, TRUE)) > 0) { + if (0 == expo || H5T_NORM_NONE == src.u.f.norm) { + if ((bitno = H5T__bit_find(s, src.u.f.mpos, src.u.f.msize, H5T_BIT_MSB, TRUE)) > 0) { msize = (size_t)bitno; - } else if (0==bitno) { + } + else if (0==bitno) { msize = 1; H5T__bit_set(s, src.u.f.mpos, (size_t)1, FALSE); } - } else if (H5T_NORM_IMPLIED==src.u.f.norm) { + } + else if (H5T_NORM_IMPLIED==src.u.f.norm) { msize = src.u.f.msize; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -4328,9 +4345,11 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (0==expo || H5T_NORM_NONE==src.u.f.norm) { HDassert(bitno>=0); expo -= (int64_t)((src.u.f.ebias - 1) + (src.u.f.msize - (size_t)bitno)); - } else if (H5T_NORM_IMPLIED==src.u.f.norm) { + } + else if (H5T_NORM_IMPLIED==src.u.f.norm) { expo -= (int64_t)src.u.f.ebias; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -4353,7 +4372,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, expo = 0; H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); msize = 0; - } else if (expo<=0) { + } + else if (expo<=0) { /* * The exponent is too small to fit in the exponent field, * but by shifting the mantissa to the right we can @@ -4363,7 +4383,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, mrsh += (size_t)(1 - expo); expo = 0; denormalized=TRUE; - } else if (expo>=expo_max) { + } + else if (expo>=expo_max) { /* * The exponent is too large to fit in the available region * or it results in the maximum possible value. Use positive @@ -4383,7 +4404,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, expo = expo_max; H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); msize = 0; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") else if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; @@ -4410,7 +4432,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(carry) implied = 2; } - } else if(H5T__bit_get_d(s, (mpos + (size_t)bitno) - 1, (size_t)1) && denormalized) + } + else if(H5T__bit_get_d(s, (mpos + (size_t)bitno) - 1, (size_t)1) && denormalized) /* For either source or destination, denormalized value doesn't increment carry.*/ H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno); } @@ -4422,13 +4445,16 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (mrsh>dst.u.f.msize+1) { H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); - } else if (mrsh==dst.u.f.msize+1) { + } + else if (mrsh==dst.u.f.msize+1) { H5T__bit_set(d, dst.u.f.mpos+1, dst.u.f.msize-1, FALSE); H5T__bit_set(d, dst.u.f.mpos, (size_t)1, TRUE); - } else if (mrsh==dst.u.f.msize) { + } + else if (mrsh==dst.u.f.msize) { H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); H5T__bit_set_d(d, dst.u.f.mpos, MIN(2, dst.u.f.msize), (hsize_t)implied); - } else { + } + else { if (mrsh>0) { H5T__bit_set(d, dst.u.f.mpos+dst.u.f.msize-mrsh, mrsh, FALSE); @@ -4439,7 +4465,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_copy(d, dst.u.f.mpos, s, (mpos+msize+mrsh-dst.u.f.msize), dst.u.f.msize-mrsh); - } else { + } + else { H5T__bit_copy(d, dst.u.f.mpos+dst.u.f.msize-(mrsh+msize), s, mpos, msize); H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize-(mrsh+msize), @@ -4469,7 +4496,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) { expo = expo_max; H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") else if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index f434543..eb648f3 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -32,9 +32,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Tpkg.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ @@ -74,28 +74,21 @@ /*------------------------------------------------------------------------- - * Function: H5T__print_stats + * Function: H5T__print_stats * - * Purpose: Print statistics about a conversion path. Statistics are - * printed only if all the following conditions are true: + * Purpose: Print statistics about a conversion path. Statistics are + * printed only if all the following conditions are true: * - * 1. The library was compiled with H5T_DEBUG defined. - * 2. Data type debugging is turned on at run time. - * 3. The path was called at least one time. + * 1. The library was compiled with H5T_DEBUG defined. + * 2. Data type debugging is turned on at run time. + * 3. The path was called at least one time. * - * The optional NPRINT argument keeps track of the number of - * conversions paths for which statistics have been shown. If - * its value is zero then table headers are printed before the - * first line of output. + * The optional NPRINT argument keeps track of the number of + * conversions paths for which statistics have been shown. If + * its value is zero then table headers are printed before the + * first line of output. * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Robb Matzke - * Monday, December 14, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -110,34 +103,34 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* FUNC_ENTER_PACKAGE_NOERR #ifdef H5T_DEBUG - if(H5DEBUG(T) && path->stats.ncalls > 0) { - if(nprint && 0 == (*nprint)++) { - HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "Conversion", "Elmts", "Calls", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "----------", "-----", "-----", "----", - "------", "-------", "---------"); - } - if(path->src && path->dst) + if (H5DEBUG(T) && path->stats.ncalls > 0) { + if (nprint && 0 == (*nprint)++) { + HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "Conversion", "Elmts", "Calls", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "----------", "-----", "-----", "----", + "------", "-------", "---------"); + } + if (path->src && path->dst) nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst)); - else if(path->src) + else if (path->src) nbytes = H5T_get_size(path->src); - else if(path->dst) + else if (path->dst) nbytes = H5T_get_size(path->dst); else nbytes = 0; - nbytes *= path->stats.nelmts; - H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); - HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", - path->name, - path->stats.nelmts, - path->stats.ncalls, - path->stats.timer.utime, - path->stats.timer.stime, - path->stats.timer.etime, - bandwidth); + nbytes *= path->stats.nelmts; + H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); + HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", + path->name, + path->stats.nelmts, + path->stats.ncalls, + path->stats.timer.utime, + path->stats.timer.stime, + path->stats.timer.etime, + bandwidth); } #endif FUNC_LEAVE_NOAPI(SUCCEED) @@ -145,24 +138,20 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* /*------------------------------------------------------------------------- - * Function: H5T_debug - * - * Purpose: Prints information about a data type. + * Function: H5T_debug * - * Return: Non-negative on success/Negative on failure + * Purpose: Prints information about a data type. * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5T_debug(const H5T_t *dt, FILE *stream) { - const char *s1 = "", *s2 = ""; - unsigned i; + const char *s1 = ""; + const char *s2 = ""; + unsigned i; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -171,7 +160,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) HDassert(dt); HDassert(stream); - switch(dt->shared->type) { + switch (dt->shared->type) { case H5T_NO_CLASS: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class"); break; @@ -221,9 +210,9 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: s1 = ""; break; - } /* end switch */ + } /* end switch */ - switch(dt->shared->state) { + switch (dt->shared->state) { case H5T_STATE_TRANSIENT: s2 = "[transient]"; break; @@ -245,14 +234,14 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; default: HDassert(0 && "This Should never be executed!"); - } /* end switch */ + } /* end switch */ - fprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); + HDfprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); - if(H5T_IS_ATOMIC(dt->shared)) { - uint64_t tmp; + if (H5T_IS_ATOMIC(dt->shared)) { + uint64_t tmp; - switch(dt->shared->u.atomic.order) { + switch (dt->shared->u.atomic.order) { case H5T_ORDER_ERROR: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "order error"); break; @@ -277,17 +266,16 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: s1 = "order?"; break; - } /* end switch */ + } /* end switch */ + + HDfprintf(stream, ", %s", s1); - fprintf(stream, ", %s", s1); + if (dt->shared->u.atomic.offset) + HDfprintf(stream, ", offset=%lu", (unsigned long) (dt->shared->u.atomic.offset)); + if (dt->shared->u.atomic.prec != 8 * dt->shared->size) + HDfprintf(stream, ", prec=%lu", (unsigned long) (dt->shared->u.atomic.prec)); - if(dt->shared->u.atomic.offset) - fprintf(stream, ", offset=%lu", - (unsigned long) (dt->shared->u.atomic.offset)); - if(dt->shared->u.atomic.prec != 8 * dt->shared->size) - fprintf(stream, ", prec=%lu", - (unsigned long) (dt->shared->u.atomic.prec)); - switch(dt->shared->type) { + switch (dt->shared->type) { case H5T_NO_CLASS: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class"); break; @@ -313,7 +301,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) } /* end switch */ if(s1) - fprintf(stream, ", %s", s1); + HDfprintf(stream, ", %s", s1); break; case H5T_FLOAT: @@ -339,23 +327,24 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; } /* end switch */ - fprintf(stream, ", sign=%lu+1", + HDfprintf(stream, ", sign=%lu+1", (unsigned long)(dt->shared->u.atomic.u.f.sign)); - fprintf(stream, ", mant=%lu+%lu (%s)", + HDfprintf(stream, ", mant=%lu+%lu (%s)", (unsigned long)(dt->shared->u.atomic.u.f.mpos), (unsigned long)(dt->shared->u.atomic.u.f.msize), s1); - fprintf(stream, ", exp=%lu+%lu", + HDfprintf(stream, ", exp=%lu+%lu", (unsigned long)(dt->shared->u.atomic.u.f.epos), (unsigned long)(dt->shared->u.atomic.u.f.esize)); tmp = dt->shared->u.atomic.u.f.ebias >> 32; - if(tmp) { + if (tmp) { size_t hi = (size_t)tmp; size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - fprintf(stream, " bias=0x%08lx%08lx", + HDfprintf(stream, " bias=0x%08lx%08lx", (unsigned long)hi, (unsigned long)lo); - } else { + } + else { size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - fprintf(stream, " bias=0x%08lx", (unsigned long)lo); + HDfprintf(stream, " bias=0x%08lx", (unsigned long)lo); } break; @@ -372,69 +361,73 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: /* No additional info */ break; - } /* end switch */ - } else if(H5T_COMPOUND == dt->shared->type) { - /* Compound data type */ - for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { - fprintf(stream, "\n\"%s\" @%lu", - dt->shared->u.compnd.memb[i].name, - (unsigned long)(dt->shared->u.compnd.memb[i].offset)); - fprintf(stream, " "); - H5T_debug(dt->shared->u.compnd.memb[i].type, stream); - } /* end for */ - fprintf(stream, "\n"); - } else if(H5T_VLEN == dt->shared->type) { - switch(dt->shared->u.vlen.loc) { + } /* end switch */ + } + else if (H5T_COMPOUND == dt->shared->type) { + /* Compound data type */ + for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { + HDfprintf(stream, "\n\"%s\" @%lu", + dt->shared->u.compnd.memb[i].name, + (unsigned long)(dt->shared->u.compnd.memb[i].offset)); + HDfprintf(stream, " "); + H5T_debug(dt->shared->u.compnd.memb[i].type, stream); + } /* end for */ + HDfprintf(stream, "\n"); + } + else if (H5T_VLEN == dt->shared->type) { + switch (dt->shared->u.vlen.loc) { case H5T_LOC_BADLOC: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid datatype location"); break; case H5T_LOC_MEMORY: - fprintf(stream, ", loc=memory"); + HDfprintf(stream, ", loc=memory"); break; case H5T_LOC_DISK: - fprintf(stream, ", loc=disk"); + HDfprintf(stream, ", loc=disk"); break; case H5T_LOC_MAXLOC: default: - fprintf(stream, ", loc=UNKNOWN"); + HDfprintf(stream, ", loc=UNKNOWN"); break; } /* end switch */ - if(H5T_IS_VL_STRING(dt->shared)) + if (H5T_IS_VL_STRING(dt->shared)) /* Variable length string datatype */ - fprintf(stream, ", variable-length"); + HDfprintf(stream, ", variable-length"); else { /* Variable length sequence datatype */ - fprintf(stream, " VLEN "); + HDfprintf(stream, " VLEN "); H5T_debug(dt->shared->parent, stream); - fprintf(stream, "\n"); + HDfprintf(stream, "\n"); } /* end else */ - } else if(H5T_ENUM == dt->shared->type) { + } + else if (H5T_ENUM == dt->shared->type) { size_t base_size; - /* Enumeration data type */ - fprintf(stream, " "); - H5T_debug(dt->shared->parent, stream); - base_size = dt->shared->parent->shared->size; - for(i = 0; i < dt->shared->u.enumer.nmembs; i++) { + /* Enumeration data type */ + HDfprintf(stream, " "); + H5T_debug(dt->shared->parent, stream); + base_size = dt->shared->parent->shared->size; + for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { size_t k; - fprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); - for(k = 0; k < base_size; k++) - fprintf(stream, "%02lx", - (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); - } /* end for */ - fprintf(stream, "\n"); - } else if(H5T_OPAQUE == dt->shared->type) { - fprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); - } else { - /* Unknown */ - fprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); + HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); + for (k = 0; k < base_size; k++) + HDfprintf(stream, "%02lx", (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); + } /* end for */ + HDfprintf(stream, "\n"); + } + else if (H5T_OPAQUE == dt->shared->type) { + HDfprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); + } + else { + /* Unknown */ + HDfprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); } - fprintf(stream, "}"); + HDfprintf(stream, "}"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 42acd8d..5272361 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -27,9 +27,9 @@ typedef struct H5T_t H5T_t; #include "H5MMpublic.h" /* Memory management */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Rprivate.h" /* References */ +#include "H5private.h" /* Generic Functions */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Rprivate.h" /* References */ /* Macro for size of temporary buffers to contain a single element */ #define H5T_ELEM_BUF_SIZE 256 diff --git a/src/H5private.h b/src/H5private.h index ca4ebcf..2f33cff 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -53,7 +53,6 @@ # include <limits.h> # include <math.h> # include <signal.h> -# include <stdarg.h> # include <stdio.h> # include <stdlib.h> # include <string.h> @@ -1688,25 +1687,25 @@ extern char *strdup(const char *s); * information about the package in H5_init_library(). */ typedef enum { - H5_PKG_A, /*Attributes */ - H5_PKG_AC, /*Meta data cache */ - H5_PKG_B, /*B-trees */ - H5_PKG_D, /*Datasets */ - H5_PKG_E, /*Error handling */ - H5_PKG_F, /*Files */ - H5_PKG_G, /*Groups */ - H5_PKG_HG, /*Global heap */ - H5_PKG_HL, /*Local heap */ - H5_PKG_I, /*Interface */ - H5_PKG_MF, /*File memory management */ - H5_PKG_MM, /*Core memory management */ - H5_PKG_O, /*Object headers */ - H5_PKG_P, /*Property lists */ - H5_PKG_S, /*Data spaces */ - H5_PKG_T, /*Data types */ - H5_PKG_V, /*Vector functions */ - H5_PKG_Z, /*Raw data filters */ - H5_NPKGS /*Must be last */ + H5_PKG_A, /* Attributes */ + H5_PKG_AC, /* Metadata cache */ + H5_PKG_B, /* B-trees */ + H5_PKG_D, /* Datasets */ + H5_PKG_E, /* Error handling */ + H5_PKG_F, /* Files */ + H5_PKG_G, /* Groups */ + H5_PKG_HG, /* Global heaps */ + H5_PKG_HL, /* Local heaps */ + H5_PKG_I, /* IDs */ + H5_PKG_MF, /* File memory management */ + H5_PKG_MM, /* Core memory management */ + H5_PKG_O, /* Object headers */ + H5_PKG_P, /* Property lists */ + H5_PKG_S, /* Dataspaces */ + H5_PKG_T, /* Datatypes */ + H5_PKG_V, /* Vector functions */ + H5_PKG_Z, /* Raw data filters */ + H5_NPKGS /* Must be last */ } H5_pkg_t; typedef struct H5_debug_open_stream_t { @@ -1735,76 +1734,90 @@ extern H5_debug_t H5_debug_g; extern char H5libhdf5_settings[]; /* embedded library information */ /*------------------------------------------------------------------------- - * Purpose: These macros are inserted automatically just after the - * FUNC_ENTER() macro of API functions and are used to trace - * application program execution. Unless H5_DEBUG_API has been - * defined they are no-ops. + * Purpose: These macros are inserted automatically just after the + * FUNC_ENTER() macro of API functions and are used to trace + * application program execution. Unless H5_DEBUG_API has been + * defined they are no-ops. * - * Arguments: R - Return type encoded as a string - * T - Argument types encoded as a string - * A0-An - Arguments. The number at the end of the macro name - * indicates the number of arguments. + * Arguments: R - Return type encoded as a string + * T - Argument types encoded as a string + * A0-An - Arguments. The number at the end of the macro name + * indicates the number of arguments. * - * Programmer: Robb Matzke - * - * Modifications: *------------------------------------------------------------------------- */ #ifdef H5_DEBUG_API -#define H5TRACE_DECL const char *RTYPE=NULL; \ - double CALLTIME; -#define H5TRACE0(R,T) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T) -#define H5TRACE1(R,T,A0) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) -#define H5TRACE2(R,T,A0,A1) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) -#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) -#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4) -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5) -#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6) -#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7) -#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8) -#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9) -#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \ - #A10,A10) -#define H5TRACE_RETURN(V) if (RTYPE) { \ - H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \ - RTYPE=NULL; \ - } + +#define H5TRACE_DECL \ + const char *RTYPE = NULL; \ + double CALLTIME; + +#define H5TRACE0(R,T) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T) +#define H5TRACE1(R,T,A0) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) +#define H5TRACE2(R,T,A0,A1) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) +#define H5TRACE3(R,T,A0,A1,A2) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) +#define H5TRACE4(R,T,A0,A1,A2,A3) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4) +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5) +#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6) +#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7) +#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8) +#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8,#A9,A9) +#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8,#A9,A9,#A10,A10) +#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8,#A9,A9,#A10,A10,#A11,A11) + +#define H5TRACE_RETURN(V) \ + if (RTYPE) { \ + H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \ + RTYPE = NULL; \ + } #else -#define H5TRACE_DECL /*void*/ -#define H5TRACE0(R,T) /*void*/ -#define H5TRACE1(R,T,A0) /*void*/ -#define H5TRACE2(R,T,A0,A1) /*void*/ -#define H5TRACE3(R,T,A0,A1,A2) /*void*/ -#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ -#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/ -#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/ -#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/ -#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/ -#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/ -#define H5TRACE_RETURN(V) /*void*/ -#endif +#define H5TRACE_DECL /*void*/ +#define H5TRACE0(R,T) /*void*/ +#define H5TRACE1(R,T,A0) /*void*/ +#define H5TRACE2(R,T,A0,A1) /*void*/ +#define H5TRACE3(R,T,A0,A1,A2) /*void*/ +#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ +#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/ +#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/ +#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/ +#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/ +#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/ +#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) /*void*/ +#define H5TRACE_RETURN(V) /*void*/ +#endif /* H5_DEBUG_API */ H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...); diff --git a/src/H5public.h b/src/H5public.h index 40e6e6e..58d0cd1 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -39,6 +39,7 @@ #endif #ifdef H5_STDC_HEADERS # include <limits.h> /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */ +# include <stdarg.h> /*for variadic functions in H5VLpublic.h */ #endif #ifndef __cplusplus # ifdef H5_HAVE_STDINT_H diff --git a/src/H5system.c b/src/H5system.c index a1cdf19..a8726c2 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -977,7 +977,7 @@ Wround(double arg) float Wroundf(float arg) { - return arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F); + return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); } #endif /* H5_HAVE_WIN32_API */ diff --git a/src/H5trace.c b/src/H5trace.c index 56fb472..5f8ccd1 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -226,9 +226,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) * name is the null pointer then don't print the argument or the * following `='. This is used for return values. */ - argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */ + argname = va_arg(ap, char *); if(argname) { - unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */ + unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); if(!HDstrcmp(argname + n, "_id")) { HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); @@ -242,7 +242,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) /* The value */ if(ptr) - vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */ + vp = va_arg(ap, void *); switch(type[0]) { case 'a': if(ptr) { @@ -252,7 +252,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ + haddr_t addr = va_arg(ap, haddr_t); HDfprintf(out, "%a", addr); } /* end else */ @@ -807,7 +807,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5E_error2_t *error = va_arg(ap, H5E_error2_t *); /*lint !e64 Type mismatch not really occuring */ + H5E_error2_t *error = va_arg(ap, H5E_error2_t *); fprintf(out, "0x%lx", (unsigned long)error); } /* end else */ @@ -1099,7 +1099,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */ + H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); fprintf(out, "0x%lx", (unsigned long)statbuf); } @@ -1133,7 +1133,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - hsize_t hsize = va_arg(ap, hsize_t); /*lint !e732 Loss of sign not really occuring */ + hsize_t hsize = va_arg(ap, hsize_t); if(H5S_UNLIMITED == hsize) HDfprintf(out, "H5S_UNLIMITED"); @@ -1559,7 +1559,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - unsigned iu = va_arg(ap, unsigned); /*lint !e732 Loss of sign not really occuring */ + unsigned iu = va_arg(ap, unsigned); fprintf(out, "%u", iu); asize[argno] = iu; @@ -1803,7 +1803,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - hobj_ref_t ref = va_arg(ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */ + hobj_ref_t ref = va_arg(ap, hobj_ref_t); HDfprintf(out, "Reference Object=%a", ref); } /* end else */ @@ -2001,7 +2001,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - const char *str = va_arg(ap, const char *); /*lint !e64 Type mismatch not really occuring */ + const char *str = va_arg(ap, const char *); fprintf(out, "\"%s\"", str); } /* end else */ @@ -2428,7 +2428,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - unsigned long iul = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ + unsigned long iul = va_arg(ap, unsigned long); fprintf(out, "%lu", iul); asize[argno] = (hssize_t)iul; @@ -2452,7 +2452,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - unsigned long long iull = va_arg(ap, unsigned long long); /*lint !e732 Loss of sign not really occuring */ + unsigned long long iull = va_arg(ap, unsigned long long); fprintf(out, "%llu", iull); asize[argno] = (hssize_t)iull; @@ -2486,7 +2486,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - vp = va_arg (ap, void *); /*lint !e64 Type mismatch not really occuring */ + vp = va_arg (ap, void *); if(vp) fprintf(out, "0x%lx", (unsigned long)vp); @@ -2512,7 +2512,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - size_t size = va_arg(ap, size_t); /*lint !e732 Loss of sign not really occuring */ + size_t size = va_arg(ap, size_t); HDfprintf(out, "%Zu", size); asize[argno] = (hssize_t)size; @@ -2559,7 +2559,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*); /*lint !e64 Type mismatch not really occuring */ + H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*); fprintf(out, "0x%lx", (unsigned long)filter); } /* end else */ @@ -20,35 +20,35 @@ #define _HDF5_H #include "H5public.h" -#include "H5Apublic.h" /* Attributes */ -#include "H5ACpublic.h" /* Metadata cache */ -#include "H5Dpublic.h" /* Datasets */ -#include "H5Epublic.h" /* Errors */ -#include "H5Fpublic.h" /* Files */ -#include "H5FDpublic.h" /* File drivers */ -#include "H5Gpublic.h" /* Groups */ -#include "H5Ipublic.h" /* ID management */ -#include "H5Lpublic.h" /* Links */ -#include "H5MMpublic.h" /* Memory management */ -#include "H5Opublic.h" /* Object headers */ -#include "H5Ppublic.h" /* Property lists */ -#include "H5PLpublic.h" /* Plugins */ -#include "H5Rpublic.h" /* References */ -#include "H5Spublic.h" /* Dataspaces */ -#include "H5Tpublic.h" /* Datatypes */ -#include "H5Zpublic.h" /* Data filters */ +#include "H5Apublic.h" /* Attributes */ +#include "H5ACpublic.h" /* Metadata cache */ +#include "H5Dpublic.h" /* Datasets */ +#include "H5Epublic.h" /* Errors */ +#include "H5Fpublic.h" /* Files */ +#include "H5FDpublic.h" /* File drivers */ +#include "H5Gpublic.h" /* Groups */ +#include "H5Ipublic.h" /* ID management */ +#include "H5Lpublic.h" /* Links */ +#include "H5MMpublic.h" /* Memory management */ +#include "H5Opublic.h" /* Object headers */ +#include "H5Ppublic.h" /* Property lists */ +#include "H5PLpublic.h" /* Plugins */ +#include "H5Rpublic.h" /* References */ +#include "H5Spublic.h" /* Dataspaces */ +#include "H5Tpublic.h" /* Datatypes */ +#include "H5Zpublic.h" /* Data filters */ /* Predefined file drivers */ -#include "H5FDcore.h" /* Files stored entirely in memory */ -#include "H5FDdirect.h" /* Linux direct I/O */ -#include "H5FDfamily.h" /* File families */ -#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /* Usage-partitioned file family */ -#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDcore.h" /* Files stored entirely in memory */ +#include "H5FDdirect.h" /* Linux direct I/O */ +#include "H5FDfamily.h" /* File families */ +#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif #endif |