summaryrefslogtreecommitdiffstats
path: root/src/H5Pocpypl.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 14:04:36 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 14:04:36 (GMT)
commitf1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch)
treeebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /src/H5Pocpypl.c
parent10343c197906415388f2a4c8d292e21d25cf7381 (diff)
downloadhdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip
hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz
hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2
Source formatted
Diffstat (limited to 'src/H5Pocpypl.c')
-rw-r--r--src/H5Pocpypl.c364
1 files changed, 176 insertions, 188 deletions
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index d23585c..1f4b31e 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -26,20 +26,18 @@
/* Module Setup */
/****************/
-#include "H5Pmodule.h" /* This source code file is part of the H5P module */
-
+#include "H5Pmodule.h" /* This source code file is part of the H5P module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Ppkg.h" /* Property lists */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Ppkg.h" /* Property lists */
/****************/
/* Local Macros */
@@ -47,43 +45,44 @@
/* ========= Object Copy properties ============ */
/* Definitions for copy options */
-#define H5O_CPY_OPTION_SIZE sizeof(unsigned)
-#define H5O_CPY_OPTION_DEF 0
-#define H5O_CPY_OPTION_ENC H5P__encode_unsigned
-#define H5O_CPY_OPTION_DEC H5P__decode_unsigned
+#define H5O_CPY_OPTION_SIZE sizeof(unsigned)
+#define H5O_CPY_OPTION_DEF 0
+#define H5O_CPY_OPTION_ENC H5P__encode_unsigned
+#define H5O_CPY_OPTION_DEC H5P__decode_unsigned
/* Definitions for merge committed dtype list */
-#define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(H5O_copy_dtype_merge_list_t *)
-#define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL
-#define H5O_CPY_MERGE_COMM_DT_LIST_SET H5P__ocpy_merge_comm_dt_list_set
-#define H5O_CPY_MERGE_COMM_DT_LIST_GET H5P__ocpy_merge_comm_dt_list_get
-#define H5O_CPY_MERGE_COMM_DT_LIST_ENC H5P__ocpy_merge_comm_dt_list_enc
-#define H5O_CPY_MERGE_COMM_DT_LIST_DEC H5P__ocpy_merge_comm_dt_list_dec
-#define H5O_CPY_MERGE_COMM_DT_LIST_DEL H5P__ocpy_merge_comm_dt_list_del
-#define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy
-#define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp
-#define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close
-/* Definitions for callback function when completing the search for a matching committed datatype from the committed dtype list */
-#define H5O_CPY_MCDT_SEARCH_CB_SIZE sizeof(H5O_mcdt_cb_info_t)
-#define H5O_CPY_MCDT_SEARCH_CB_DEF {NULL,NULL}
-
+#define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(H5O_copy_dtype_merge_list_t *)
+#define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL
+#define H5O_CPY_MERGE_COMM_DT_LIST_SET H5P__ocpy_merge_comm_dt_list_set
+#define H5O_CPY_MERGE_COMM_DT_LIST_GET H5P__ocpy_merge_comm_dt_list_get
+#define H5O_CPY_MERGE_COMM_DT_LIST_ENC H5P__ocpy_merge_comm_dt_list_enc
+#define H5O_CPY_MERGE_COMM_DT_LIST_DEC H5P__ocpy_merge_comm_dt_list_dec
+#define H5O_CPY_MERGE_COMM_DT_LIST_DEL H5P__ocpy_merge_comm_dt_list_del
+#define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy
+#define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp
+#define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close
+/* Definitions for callback function when completing the search for a matching committed datatype from the
+ * committed dtype list */
+#define H5O_CPY_MCDT_SEARCH_CB_SIZE sizeof(H5O_mcdt_cb_info_t)
+#define H5O_CPY_MCDT_SEARCH_CB_DEF \
+ { \
+ NULL, NULL \
+ }
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
/* General routines */
static H5O_copy_dtype_merge_list_t *H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list);
-static herr_t H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value);
+static herr_t H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value);
/* Property class callbacks */
static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass);
@@ -94,10 +93,9 @@ static herr_t H5P__ocpy_merge_comm_dt_list_get(hid_t prop_id, const char *name,
static herr_t H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size);
static herr_t H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *value);
static herr_t H5P__ocpy_merge_comm_dt_list_del(hid_t prop_id, const char *name, size_t size, void *value);
-static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char* name, size_t size, void* value);
-static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size);
-static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size, void* value);
-
+static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char *name, size_t size, void *value);
+static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size);
+static herr_t H5P__ocpy_merge_comm_dt_list_close(const char *name, size_t size, void *value);
/*********************/
/* Package Variables */
@@ -105,43 +103,42 @@ static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size,
/* Object copy property list class library initialization object */
const H5P_libclass_t H5P_CLS_OCPY[1] = {{
- "object copy", /* Class name for debugging */
- H5P_TYPE_OBJECT_COPY, /* Class type */
-
- &H5P_CLS_ROOT_g, /* Parent class */
- &H5P_CLS_OBJECT_COPY_g, /* Pointer to class */
- &H5P_CLS_OBJECT_COPY_ID_g, /* Pointer to class ID */
- &H5P_LST_OBJECT_COPY_ID_g, /* Pointer to default property list ID */
- H5P__ocpy_reg_prop, /* Default property registration routine */
-
- NULL, /* Class creation callback */
- NULL, /* Class creation callback info */
- NULL, /* Class copy callback */
- NULL, /* Class copy callback info */
- NULL, /* Class close callback */
- NULL /* Class close callback info */
+ "object copy", /* Class name for debugging */
+ H5P_TYPE_OBJECT_COPY, /* Class type */
+
+ &H5P_CLS_ROOT_g, /* Parent class */
+ &H5P_CLS_OBJECT_COPY_g, /* Pointer to class */
+ &H5P_CLS_OBJECT_COPY_ID_g, /* Pointer to class ID */
+ &H5P_LST_OBJECT_COPY_ID_g, /* Pointer to default property list ID */
+ H5P__ocpy_reg_prop, /* Default property registration routine */
+
+ NULL, /* Class creation callback */
+ NULL, /* Class creation callback info */
+ NULL, /* Class copy callback */
+ NULL, /* Class copy callback info */
+ NULL, /* Class close callback */
+ NULL /* Class close callback info */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
/* Property value defaults */
-static const unsigned H5O_def_ocpy_option_g = H5O_CPY_OPTION_DEF; /* Default object copy flags */
-static const H5O_copy_dtype_merge_list_t *H5O_def_merge_comm_dtype_list_g = H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */
-static const H5O_mcdt_cb_info_t H5O_def_mcdt_cb_g = H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at destination */
+static const unsigned H5O_def_ocpy_option_g = H5O_CPY_OPTION_DEF; /* Default object copy flags */
+static const H5O_copy_dtype_merge_list_t *H5O_def_merge_comm_dtype_list_g =
+ H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */
+static const H5O_mcdt_cb_info_t H5O_def_mcdt_cb_g =
+ H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at
+ destination */
/* Declare a free list to manage the H5O_copy_dtype_merge_list_t struct */
H5FL_DEFINE(H5O_copy_dtype_merge_list_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5P__ocpy_reg_prop
*
@@ -156,33 +153,35 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t);
static herr_t
H5P__ocpy_reg_prop(H5P_genclass_t *pclass)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Register copy options property */
- if(H5P__register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g,
- NULL, NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC,
- NULL, NULL, NULL, NULL) < 0)
+ if (H5P__register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, NULL,
+ NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register merge named dtype list property */
- if(H5P__register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g,
- NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET, H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC,
- H5O_CPY_MERGE_COMM_DT_LIST_DEL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0)
+ if (H5P__register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE,
+ &H5O_def_merge_comm_dtype_list_g, NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET,
+ H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC,
+ H5O_CPY_MERGE_COMM_DT_LIST_DEC, H5O_CPY_MERGE_COMM_DT_LIST_DEL,
+ H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP,
+ H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register property for callback when completing the search for a matching named datatype from the named dtype list */
+ /* Register property for callback when completing the search for a matching named datatype from the named
+ * dtype list */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P__register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if (H5P__register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE,
+ &H5O_def_mcdt_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__ocpy_reg_prop() */
-
/*-------------------------------------------------------------------------
* Function: H5P__free_merge_comm_dtype_list
*
@@ -201,7 +200,7 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list)
FUNC_ENTER_STATIC_NOERR
/* Free the list */
- while(dt_list) {
+ while (dt_list) {
H5O_copy_dtype_merge_list_t *tmp_node;
tmp_node = dt_list->next;
@@ -215,7 +214,6 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list)
FUNC_LEAVE_NOAPI(NULL);
} /* H5P__free_merge_comm_dtype_list */
-
/*--------------------------------------------------------------------------
* Function: H5P__copy_merge_comm_dt_list
*
@@ -232,10 +230,11 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list)
static herr_t
H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value)
{
- const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */
- H5O_copy_dtype_merge_list_t *dst_dt_list = NULL; /* Destination merge named datatype lists */
- H5O_copy_dtype_merge_list_t *dst_dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */
- herr_t ret_value = SUCCEED;
+ const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */
+ H5O_copy_dtype_merge_list_t * dst_dt_list = NULL; /* Destination merge named datatype lists */
+ H5O_copy_dtype_merge_list_t * dst_dt_list_tail = NULL,
+ *tmp_dt_list = NULL; /* temporary merge named datatype lists */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -244,20 +243,20 @@ H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value)
/* Make copy of merge committed dtype list */
src_dt_list = *value;
- while(src_dt_list) {
+ while (src_dt_list) {
/* Copy src_dt_list */
- if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t)))
+ if (NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
- if(NULL == (tmp_dt_list->path = H5MM_strdup(src_dt_list->path)))
+ if (NULL == (tmp_dt_list->path = H5MM_strdup(src_dt_list->path)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Add copied node to dest dtype list */
- if(dst_dt_list_tail) {
+ if (dst_dt_list_tail) {
dst_dt_list_tail->next = tmp_dt_list;
- dst_dt_list_tail = tmp_dt_list;
+ dst_dt_list_tail = tmp_dt_list;
} /* end if */
else {
- dst_dt_list = tmp_dt_list;
+ dst_dt_list = tmp_dt_list;
dst_dt_list_tail = tmp_dt_list;
} /* end else */
tmp_dt_list = NULL;
@@ -270,18 +269,17 @@ H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value)
*value = dst_dt_list;
done:
- if(ret_value < 0) {
+ if (ret_value < 0) {
dst_dt_list = H5P__free_merge_comm_dtype_list(dst_dt_list);
- if(tmp_dt_list) {
+ if (tmp_dt_list) {
tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path);
- tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list);
+ tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list);
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__copy_merge_comm_dt_list() */
-
/*-------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_set
*
@@ -297,9 +295,9 @@ done:
*/
static herr_t
H5P__ocpy_merge_comm_dt_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
- size_t H5_ATTR_UNUSED size, void *value)
+ size_t H5_ATTR_UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -307,14 +305,13 @@ H5P__ocpy_merge_comm_dt_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT
HDassert(value);
/* Make copy of merge committed dtype list */
- if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0)
+ if (H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__ocpy_merge_comm_dt_list_set() */
-
/*-------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_get
*
@@ -330,9 +327,9 @@ done:
*/
static herr_t
H5P__ocpy_merge_comm_dt_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
- size_t H5_ATTR_UNUSED size, void *value)
+ size_t H5_ATTR_UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -340,14 +337,13 @@ H5P__ocpy_merge_comm_dt_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT
HDassert(value);
/* Make copy of merge committed dtype list */
- if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0)
+ if (H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__ocpy_merge_comm_dt_list_get() */
-
/*-------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_enc
*
@@ -366,10 +362,10 @@ done:
static herr_t
H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
{
- const H5O_copy_dtype_merge_list_t * const *dt_list_ptr = (const H5O_copy_dtype_merge_list_t * const *)value;
- uint8_t **pp = (uint8_t **)_pp;
- const H5O_copy_dtype_merge_list_t *dt_list; /* Pointer to merge named datatype list */
- size_t len; /* Length of path component */
+ const H5O_copy_dtype_merge_list_t *const *dt_list_ptr = (const H5O_copy_dtype_merge_list_t *const *)value;
+ uint8_t ** pp = (uint8_t **)_pp;
+ const H5O_copy_dtype_merge_list_t * dt_list; /* Pointer to merge named datatype list */
+ size_t len; /* Length of path component */
FUNC_ENTER_STATIC_NOERR
@@ -378,12 +374,12 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
/* Iterate over merge committed dtype list */
dt_list = *dt_list_ptr;
- while(dt_list) {
+ while (dt_list) {
/* Get length of encoded path */
len = HDstrlen(dt_list->path) + 1;
/* Encode merge committed dtype list */
- if(*pp) {
+ if (*pp) {
H5MM_memcpy(*(char **)pp, dt_list->path, len);
*pp += len;
} /* end if */
@@ -396,7 +392,7 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
} /* end while */
/* Encode the terminator for the string sequence */
- if(*pp)
+ if (*pp)
*(*pp)++ = (uint8_t)'\0';
/* Account for the string sequence terminator */
@@ -405,7 +401,6 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__ocpy_merge_comm_dt_list_enc() */
-
/*-------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_dec
*
@@ -424,11 +419,13 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size)
static herr_t
H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value)
{
- H5O_copy_dtype_merge_list_t **dt_list = (H5O_copy_dtype_merge_list_t **)_value; /* Pointer to merge named datatype list */
- const uint8_t **pp = (const uint8_t **)_pp;
- H5O_copy_dtype_merge_list_t *dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */
- size_t len; /* Length of path component */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_copy_dtype_merge_list_t **dt_list =
+ (H5O_copy_dtype_merge_list_t **)_value; /* Pointer to merge named datatype list */
+ const uint8_t ** pp = (const uint8_t **)_pp;
+ H5O_copy_dtype_merge_list_t *dt_list_tail = NULL,
+ *tmp_dt_list = NULL; /* temporary merge named datatype lists */
+ size_t len; /* Length of path component */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -442,22 +439,22 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value)
/* Decode the string sequence */
len = HDstrlen(*(const char **)pp);
- while(len > 0) {
+ while (len > 0) {
/* Create new node & duplicate string */
- if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t)))
+ if (NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
- if(NULL == (tmp_dt_list->path = H5MM_strdup(*(const char **)pp)))
+ if (NULL == (tmp_dt_list->path = H5MM_strdup(*(const char **)pp)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
*pp += len + 1;
HDassert(len == HDstrlen(tmp_dt_list->path));
/* Add copied node to dtype list */
- if(dt_list_tail) {
+ if (dt_list_tail) {
dt_list_tail->next = tmp_dt_list;
- dt_list_tail = tmp_dt_list;
+ dt_list_tail = tmp_dt_list;
} /* end if */
else {
- *dt_list = tmp_dt_list;
+ *dt_list = tmp_dt_list;
dt_list_tail = tmp_dt_list;
} /* end else */
tmp_dt_list = NULL;
@@ -470,18 +467,17 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value)
*pp += 1;
done:
- if(ret_value < 0) {
+ if (ret_value < 0) {
*dt_list = H5P__free_merge_comm_dtype_list(*dt_list);
- if(tmp_dt_list) {
+ if (tmp_dt_list) {
tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path);
- tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list);
+ tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list);
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P__ocpy_merge_comm_dt_list_dec() */
-
/*--------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_del
*
@@ -497,7 +493,7 @@ done:
*/
static herr_t
H5P__ocpy_merge_comm_dt_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name,
- size_t H5_ATTR_UNUSED size, void *value)
+ size_t H5_ATTR_UNUSED size, void *value)
{
FUNC_ENTER_STATIC_NOERR
@@ -510,7 +506,6 @@ H5P__ocpy_merge_comm_dt_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__ocpy_merge_comm_dt_list_del() */
-
/*--------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_copy
*
@@ -525,10 +520,9 @@ H5P__ocpy_merge_comm_dt_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT
*--------------------------------------------------------------------------
*/
static herr_t
-H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size,
- void *value)
+H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -536,14 +530,13 @@ H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATT
HDassert(value);
/* Make copy of merge committed dtype list */
- if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0)
+ if (H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__ocpy_merge_comm_dt_list_copy() */
-
/*-------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_cmp
*
@@ -561,12 +554,12 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2,
- size_t H5_ATTR_UNUSED size)
+H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, size_t H5_ATTR_UNUSED size)
{
- const H5O_copy_dtype_merge_list_t *dt_list1 = *(H5O_copy_dtype_merge_list_t * const *)_dt_list1, /* Create local aliases for values */
- *dt_list2 = *(H5O_copy_dtype_merge_list_t * const *)_dt_list2;
- herr_t ret_value = 0; /* Return value */
+ const H5O_copy_dtype_merge_list_t *dt_list1 = *(H5O_copy_dtype_merge_list_t *const *)
+ _dt_list1, /* Create local aliases for values */
+ *dt_list2 = *(H5O_copy_dtype_merge_list_t *const *)_dt_list2;
+ herr_t ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -577,13 +570,14 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2,
/* Walk through the lists, comparing each path. For the lists to be the
* same, the paths must be in the same order. */
- while(dt_list1 && dt_list2) {
+ while (dt_list1 && dt_list2) {
HDassert(dt_list1->path);
HDassert(dt_list2->path);
/* Compare paths */
ret_value = HDstrcmp(dt_list1->path, dt_list2->path);
- if(ret_value != 0) HGOTO_DONE(ret_value)
+ if (ret_value != 0)
+ HGOTO_DONE(ret_value)
/* Advance to next node */
dt_list1 = dt_list1->next;
@@ -591,14 +585,15 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2,
} /* end while */
/* Check if one list is longer than the other */
- if(dt_list1) HGOTO_DONE(1)
- if(dt_list2) HGOTO_DONE(-1)
+ if (dt_list1)
+ HGOTO_DONE(1)
+ if (dt_list2)
+ HGOTO_DONE(-1)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__ocpy_merge_comm_dt_list_cmp() */
-
/*--------------------------------------------------------------------------
* Function: H5P__ocpy_merge_comm_dt_list_close
*
@@ -625,7 +620,6 @@ H5P__ocpy_merge_comm_dt_list_close(const char H5_ATTR_UNUSED *name, size_t H5_AT
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__ocpy_merge_comm_dt_list_close() */
-
/*-------------------------------------------------------------------------
* Function: H5Pset_copy_object
*
@@ -650,29 +644,28 @@ H5P__ocpy_merge_comm_dt_list_close(const char H5_ATTR_UNUSED *name, size_t H5_AT
herr_t
H5Pset_copy_object(hid_t plist_id, unsigned cpy_option)
{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", plist_id, cpy_option);
/* Check parameters */
- if(cpy_option & ~H5O_COPY_ALL)
+ if (cpy_option & ~H5O_COPY_ALL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown option specified")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value */
- if(H5P_set(plist, H5O_CPY_OPTION_NAME, &cpy_option) < 0)
+ if (H5P_set(plist, H5O_CPY_OPTION_NAME, &cpy_option) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set copy object flag")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_copy_object() */
-
/*-------------------------------------------------------------------------
* Function: H5Pget_copy_object
*
@@ -688,26 +681,25 @@ done:
herr_t
H5Pget_copy_object(hid_t plist_id, unsigned *cpy_option /*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", plist_id, cpy_option);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get values */
- if(cpy_option)
- if(H5P_get(plist, H5O_CPY_OPTION_NAME, cpy_option) < 0)
+ if (cpy_option)
+ if (H5P_get(plist, H5O_CPY_OPTION_NAME, cpy_option) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object copy flag")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_copy_object() */
-
/*-------------------------------------------------------------------------
* Function: H5Padd_merge_committed_dtype_path
*
@@ -731,50 +723,49 @@ done:
herr_t
H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_copy_dtype_merge_list_t *old_list; /* Merge committed dtype list currently present */
- H5O_copy_dtype_merge_list_t *new_obj = NULL; /* New object to add to list */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5O_copy_dtype_merge_list_t *old_list; /* Merge committed dtype list currently present */
+ H5O_copy_dtype_merge_list_t *new_obj = NULL; /* New object to add to list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", plist_id, path);
/* Check parameters */
- if(!path)
+ if (!path)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no path specified")
- if(path[0] == '\0')
+ if (path[0] == '\0')
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path is empty string")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get dtype list */
- if(H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0)
+ if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list")
/* Add the new path to the list */
- if(NULL == (new_obj = H5FL_CALLOC(H5O_copy_dtype_merge_list_t)))
+ if (NULL == (new_obj = H5FL_CALLOC(H5O_copy_dtype_merge_list_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(NULL == (new_obj->path = H5MM_strdup(path)))
+ if (NULL == (new_obj->path = H5MM_strdup(path)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
new_obj->next = old_list;
/* Update the list stored in the property list */
- if(H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &new_obj) < 0)
+ if (H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &new_obj) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge named dtype list")
done:
- if(ret_value < 0)
- if(new_obj) {
+ if (ret_value < 0)
+ if (new_obj) {
new_obj->path = (char *)H5MM_xfree(new_obj->path);
- new_obj = H5FL_FREE(H5O_copy_dtype_merge_list_t, new_obj);
+ new_obj = H5FL_FREE(H5O_copy_dtype_merge_list_t, new_obj);
} /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Padd_merge_committed_dtype_path() */
-
/*-------------------------------------------------------------------------
* Function: H5Pfree_merge_committed_dtype_paths
*
@@ -794,33 +785,32 @@ done:
herr_t
H5Pfree_merge_committed_dtype_paths(hid_t plist_id)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_copy_dtype_merge_list_t *dt_list; /* Merge committed dtype list currently present */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5O_copy_dtype_merge_list_t *dt_list; /* Merge committed dtype list currently present */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", plist_id);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get dtype list */
- if(H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0)
+ if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed dtype list")
/* Free dtype list */
dt_list = H5P__free_merge_comm_dtype_list(dt_list);
/* Update the list stored in the property list (to NULL) */
- if(H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0)
+ if (H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge committed dtype list")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pfree_merge_committed_dtype_paths() */
-
/*-------------------------------------------------------------------------
* Function: H5Pset_mcdt_search_cb
*
@@ -842,35 +832,34 @@ done:
herr_t
H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_mcdt_cb_info_t cb_info; /* Callback info struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5O_mcdt_cb_info_t cb_info; /* Callback info struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ix*x", plist_id, func, op_data);
/* Check if the callback function is NULL and the user data is non-NULL.
* This is almost certainly an error as the user data will not be used. */
- if(!func && op_data)
+ if (!func && op_data)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* Populate the callback info struct */
- cb_info.func = func;
+ /* Populate the callback info struct */
+ cb_info.func = func;
cb_info.user_data = op_data;
/* Set callback info */
- if(H5P_set(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0)
+ if (H5P_set(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set callback info")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_mcdt_search_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5Pget_mcdt_search_cb
*
@@ -891,28 +880,27 @@ done:
herr_t
H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_mcdt_cb_info_t cb_info; /* Callback info struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5O_mcdt_cb_info_t cb_info; /* Callback info struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*x**x", plist_id, func, op_data);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get callback info */
- if(H5P_get(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0)
+ if (H5P_get(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info")
- if(func)
- *func = cb_info.func;
+ if (func)
+ *func = cb_info.func;
- if(op_data)
- *op_data = cb_info.user_data;
+ if (op_data)
+ *op_data = cb_info.user_data;
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mcdt_search_cb() */
-