diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
commit | f1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch) | |
tree | ebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /src/H5Odrvinfo.c | |
parent | 10343c197906415388f2a4c8d292e21d25cf7381 (diff) | |
download | hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2 |
Source formatted
Diffstat (limited to 'src/H5Odrvinfo.c')
-rw-r--r-- | src/H5Odrvinfo.c | 132 |
1 files changed, 60 insertions, 72 deletions
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index dffacfd..9a8b0f1 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -11,7 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - /* Programmer: Quincey Koziol * Thursday, March 1, 2007 * @@ -19,51 +18,48 @@ * in the superblock extension. */ -#include "H5Omodule.h" /* This source code file is part of the H5O module */ - +#include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Opkg.h" /* Object headers */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Opkg.h" /* Object headers */ +#include "H5MMprivate.h" /* Memory management */ -static void *H5O__drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, - unsigned *ioflags, size_t p_size, const uint8_t *p); +static void * H5O__drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); static herr_t H5O__drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O__drvinfo_copy(const void *_mesg, void *_dest); +static void * H5O__drvinfo_copy(const void *_mesg, void *_dest); static size_t H5O__drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__drvinfo_reset(void *_mesg); -static herr_t H5O__drvinfo_debug(H5F_t *f, const void *_mesg, FILE *stream, - int indent, int fwidth); +static herr_t H5O__drvinfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ - H5O_DRVINFO_ID, /*message id number */ - "driver info", /*message name for debugging */ - sizeof(H5O_drvinfo_t), /*native message size */ - 0, /* messages are sharable? */ - H5O__drvinfo_decode, /*decode message */ - H5O__drvinfo_encode, /*encode message */ - H5O__drvinfo_copy, /*copy the native value */ - H5O__drvinfo_size, /*raw message size */ - H5O__drvinfo_reset, /*free internal memory */ - NULL, /* free method */ - NULL, /* file delete method */ - NULL, /* link method */ - NULL, /*set share method */ - NULL, /*can share method */ - NULL, /* pre copy native value to file */ - NULL, /* copy native value to file */ - NULL, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O__drvinfo_debug /*debug the message */ + H5O_DRVINFO_ID, /*message id number */ + "driver info", /*message name for debugging */ + sizeof(H5O_drvinfo_t), /*native message size */ + 0, /* messages are sharable? */ + H5O__drvinfo_decode, /*decode message */ + H5O__drvinfo_encode, /*encode message */ + H5O__drvinfo_copy, /*copy the native value */ + H5O__drvinfo_size, /*raw message size */ + H5O__drvinfo_reset, /*free internal memory */ + NULL, /* free method */ + NULL, /* file delete method */ + NULL, /* link method */ + NULL, /*set share method */ + NULL, /*can share method */ + NULL, /* pre copy native value to file */ + NULL, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__drvinfo_debug /*debug the message */ }}; /* Current version of driver info information */ -#define H5O_DRVINFO_VERSION 0 +#define H5O_DRVINFO_VERSION 0 - /*------------------------------------------------------------------------- * Function: H5O__drvinfo_decode * @@ -80,11 +76,11 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ */ static void * H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, - unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, + size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { - H5O_drvinfo_t *mesg; /* Native message */ - void *ret_value = NULL; /* Return value */ + H5O_drvinfo_t *mesg; /* Native message */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -93,12 +89,12 @@ H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, HDassert(p); /* Version of message */ - if(*p++ != H5O_DRVINFO_VERSION) + if (*p++ != H5O_DRVINFO_VERSION) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") /* Allocate space for message */ - if(NULL == (mesg = (H5O_drvinfo_t *)H5MM_calloc(sizeof(H5O_drvinfo_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message") + if (NULL == (mesg = (H5O_drvinfo_t *)H5MM_calloc(sizeof(H5O_drvinfo_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message") /* Retrieve driver name */ H5MM_memcpy(mesg->name, p, 8); @@ -110,9 +106,9 @@ H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, HDassert(mesg->len); /* Allocate space for buffer */ - if(NULL == (mesg->buf = (uint8_t *)H5MM_malloc(mesg->len))) { + if (NULL == (mesg->buf = (uint8_t *)H5MM_malloc(mesg->len))) { mesg = (H5O_drvinfo_t *)H5MM_xfree(mesg); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info buffer") } /* end if */ /* Copy encoded driver info into buffer */ @@ -125,7 +121,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__drvinfo_decode() */ - /*------------------------------------------------------------------------- * Function: H5O__drvinfo_encode * @@ -139,7 +134,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; @@ -161,7 +157,6 @@ H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__drvinfo_encode() */ - /*------------------------------------------------------------------------- * Function: H5O__drvinfo_copy * @@ -179,26 +174,27 @@ H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar static void * H5O__drvinfo_copy(const void *_mesg, void *_dest) { - const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; - H5O_drvinfo_t *dest = (H5O_drvinfo_t *)_dest; - void *ret_value = NULL; /* Return value */ + const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; + H5O_drvinfo_t * dest = (H5O_drvinfo_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC /* Sanity check */ HDassert(mesg); - if(!dest && NULL == (dest = (H5O_drvinfo_t *)H5MM_malloc(sizeof(H5O_drvinfo_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for shared message table message") + if (!dest && NULL == (dest = (H5O_drvinfo_t *)H5MM_malloc(sizeof(H5O_drvinfo_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed for shared message table message") /* Shallow copy the fields */ *dest = *mesg; /* Copy the buffer */ - if(NULL == (dest->buf = (uint8_t *)H5MM_malloc(mesg->len))) { - if(dest != _dest) + if (NULL == (dest->buf = (uint8_t *)H5MM_malloc(mesg->len))) { + if (dest != _dest) dest = (H5O_drvinfo_t *)H5MM_xfree(dest); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } /* end if */ H5MM_memcpy(dest->buf, mesg->buf, mesg->len); @@ -209,7 +205,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__drvinfo_copy() */ - /*------------------------------------------------------------------------- * Function: H5O__drvinfo_size * @@ -227,8 +222,8 @@ done: static size_t H5O__drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { - const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; - size_t ret_value = 0; /* Return value */ + const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -236,15 +231,14 @@ H5O__drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_ HDassert(f); HDassert(mesg); - ret_value = 1 + /* Version number */ - 8 + /* Driver name */ - 2 + /* Buffer length */ - mesg->len; /* Buffer */ + ret_value = 1 + /* Version number */ + 8 + /* Driver name */ + 2 + /* Buffer length */ + mesg->len; /* Buffer */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__drvinfo_size() */ - /*------------------------------------------------------------------------- * Function: H5O__drvinfo_reset * @@ -261,7 +255,7 @@ H5O__drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_ static herr_t H5O__drvinfo_reset(void *_mesg) { - H5O_drvinfo_t *mesg = (H5O_drvinfo_t *) _mesg; + H5O_drvinfo_t *mesg = (H5O_drvinfo_t *)_mesg; FUNC_ENTER_STATIC_NOERR @@ -274,7 +268,6 @@ H5O__drvinfo_reset(void *_mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__drvinfo_reset() */ - /*------------------------------------------------------------------------- * Function: H5O__drvinfo_debug * @@ -288,8 +281,7 @@ H5O__drvinfo_reset(void *_mesg) *------------------------------------------------------------------------- */ static herr_t -H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, - int indent, int fwidth) +H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; @@ -302,12 +294,8 @@ H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Driver name:", mesg->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Buffer size:", mesg->len); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Driver name:", mesg->name); + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Buffer size:", mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__drvinfo_debug() */ - - |