summaryrefslogtreecommitdiffstats
path: root/src/H5Z.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /src/H5Z.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'src/H5Z.c')
-rw-r--r--src/H5Z.c564
1 files changed, 261 insertions, 303 deletions
diff --git a/src/H5Z.c b/src/H5Z.c
index 60b2ebe..ac7756e 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -11,60 +11,60 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5Zmodule.h" /* This source code file is part of the H5Z module */
-
-
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5PLprivate.h" /* Plugins */
-#include "H5Sprivate.h" /* Dataspace functions */
-#include "H5Zpkg.h" /* Data filters */
+#include "H5Zmodule.h" /* This source code file is part of the H5Z module */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5PLprivate.h" /* Plugins */
+#include "H5Sprivate.h" /* Dataspace functions */
+#include "H5Zpkg.h" /* Data filters */
#ifdef H5_HAVE_SZLIB_H
-# include "szlib.h"
+#include "szlib.h"
#endif
/* Local typedefs */
#ifdef H5Z_DEBUG
typedef struct H5Z_stats_t {
struct {
- hsize_t total; /* total number of bytes processed */
- hsize_t errors; /* bytes of total attributable to errors */
- H5_timevals_t times; /* execution time including errors */
- } stats[2]; /* 0 = output, 1 = input */
+ hsize_t total; /* total number of bytes processed */
+ hsize_t errors; /* bytes of total attributable to errors */
+ H5_timevals_t times; /* execution time including errors */
+ } stats[2]; /* 0 = output, 1 = input */
} H5Z_stats_t;
#endif /* H5Z_DEBUG */
typedef struct H5Z_object_t {
- H5Z_filter_t filter_id; /* ID of the filter we're looking for */
- htri_t found; /* Whether we find an object using the filter */
+ H5Z_filter_t filter_id; /* ID of the filter we're looking for */
+ htri_t found; /* Whether we find an object using the filter */
#ifdef H5_HAVE_PARALLEL
- hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */
-#endif /* H5_HAVE_PARALLEL */
+ hbool_t
+ sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */
+#endif /* H5_HAVE_PARALLEL */
} H5Z_object_t;
/* Enumerated type for dataset creation prelude callbacks */
typedef enum {
- H5Z_PRELUDE_CAN_APPLY, /* Call "can apply" callback */
- H5Z_PRELUDE_SET_LOCAL /* Call "set local" callback */
+ H5Z_PRELUDE_CAN_APPLY, /* Call "can apply" callback */
+ H5Z_PRELUDE_SET_LOCAL /* Call "set local" callback */
} H5Z_prelude_type_t;
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
/* Local variables */
-static size_t H5Z_table_alloc_g = 0;
-static size_t H5Z_table_used_g = 0;
-static H5Z_class2_t *H5Z_table_g = NULL;
+static size_t H5Z_table_alloc_g = 0;
+static size_t H5Z_table_used_g = 0;
+static H5Z_class2_t *H5Z_table_g = NULL;
#ifdef H5Z_DEBUG
-static H5Z_stats_t *H5Z_stat_table_g = NULL;
+static H5Z_stats_t *H5Z_stat_table_g = NULL;
#endif /* H5Z_DEBUG */
/* Local functions */
@@ -73,7 +73,6 @@ static int H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t obj_id, void *key)
static int H5Z__check_unregister_group_cb(void *obj_ptr, hid_t obj_id, void *key);
static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key);
-
/*-------------------------------------------------------------------------
* Function: H5Z__init_package
*
@@ -85,7 +84,7 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key);
herr_t
H5Z__init_package(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -99,7 +98,7 @@ H5Z__init_package(void)
if (H5Z_register(H5Z_SCALEOFFSET) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter")
- /* External filters */
+ /* External filters */
#ifdef H5_HAVE_FILTER_DEFLATE
if (H5Z_register(H5Z_DEFLATE) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter")
@@ -114,7 +113,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__init_package() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_term_package
*
@@ -126,43 +124,37 @@ done:
int
H5Z_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR) {
+ if (H5_PKG_INIT_VAR) {
#ifdef H5Z_DEBUG
- char comment[16], bandwidth[32];
- int dir, nprint = 0;
- size_t i;
+ char comment[16], bandwidth[32];
+ int dir, nprint = 0;
+ size_t i;
- if(H5DEBUG(Z)) {
- for(i = 0; i < H5Z_table_used_g; i++) {
- for(dir = 0; dir<2; dir++) {
+ if (H5DEBUG(Z)) {
+ for (i = 0; i < H5Z_table_used_g; i++) {
+ for (dir = 0; dir < 2; dir++) {
struct {
char *user;
char *system;
char *elapsed;
- } timestrs = {
- H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.user),
- H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.system),
- H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.elapsed)
- };
- if(0 == H5Z_stat_table_g[i].stats[dir].total)
+ } timestrs = {H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.user),
+ H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.system),
+ H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.elapsed)};
+ if (0 == H5Z_stat_table_g[i].stats[dir].total)
goto next;
- if(0 == nprint++) {
+ if (0 == nprint++) {
/* Print column headers */
HDfprintf(H5DEBUG(Z), "H5Z: filter statistics "
- "accumulated over life of library:\n");
- HDfprintf(H5DEBUG(Z),
- " %-16s %10s %10s %8s %8s %8s %10s\n",
- "Filter", "Total", "Errors", "User",
- "System", "Elapsed", "Bandwidth");
- HDfprintf(H5DEBUG(Z),
- " %-16s %10s %10s %8s %8s %8s %10s\n",
- "------", "-----", "------", "----",
- "------", "-------", "---------");
+ "accumulated over life of library:\n");
+ HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total",
+ "Errors", "User", "System", "Elapsed", "Bandwidth");
+ HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----",
+ "------", "----", "------", "-------", "---------");
} /* end if */
/* Truncate the comment to fit in the field */
@@ -174,32 +166,25 @@ H5Z_term_package(void)
* units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or
* the word `Inf' if the elapsed time is zero.
*/
- H5_bandwidth(bandwidth,
- (double)(H5Z_stat_table_g[i].stats[dir].total),
- H5Z_stat_table_g[i].stats[dir].times.elapsed);
+ H5_bandwidth(bandwidth, (double)(H5Z_stat_table_g[i].stats[dir].total),
+ H5Z_stat_table_g[i].stats[dir].times.elapsed);
/* Print the statistics */
- HDfprintf(H5DEBUG(Z),
- " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE
- " %8s %8s %8s %10s\n",
- (dir ? "<" : ">"), comment,
- H5Z_stat_table_g[i].stats[dir].total,
- H5Z_stat_table_g[i].stats[dir].errors,
- timestrs.user,
- timestrs.system,
- timestrs.elapsed,
- bandwidth);
- next:
+ HDfprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n",
+ (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total,
+ H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system,
+ timestrs.elapsed, bandwidth);
+next:
free(timestrs.user);
free(timestrs.system);
free(timestrs.elapsed);
} /* end for */
- } /* end for */
- } /* end if */
-#endif /* H5Z_DEBUG */
+ } /* end for */
+ } /* end if */
+#endif /* H5Z_DEBUG */
/* Free the table of filters */
- if(H5Z_table_g) {
+ if (H5Z_table_g) {
H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g);
#ifdef H5Z_DEBUG
@@ -218,7 +203,6 @@ H5Z_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5Z_term_package() */
-
/*-------------------------------------------------------------------------
* Function: H5Zregister
*
@@ -230,17 +214,17 @@ H5Z_term_package(void)
herr_t
H5Zregister(const void *cls)
{
- const H5Z_class2_t *cls_real = (const H5Z_class2_t *) cls; /* "Real" class pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5Z_class2_t *cls_real = (const H5Z_class2_t *)cls; /* "Real" class pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- H5Z_class2_t cls_new; /* Translated class struct */
+ H5Z_class2_t cls_new; /* Translated class struct */
#endif
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "*x", cls);
/* Check args */
- if (cls_real==NULL)
+ if (cls_real == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class")
/* Check H5Z_class_t version number; this is where a function to convert
@@ -256,26 +240,26 @@ H5Zregister(const void *cls)
if (cls_real->version != H5Z_CLASS_T_VERS) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Assume it is an old "H5Z_class1_t" instead */
- const H5Z_class1_t *cls_old = (const H5Z_class1_t *) cls;
+ const H5Z_class1_t *cls_old = (const H5Z_class1_t *)cls;
/* Translate to new H5Z_class2_t */
- cls_new.version = H5Z_CLASS_T_VERS;
- cls_new.id = cls_old->id;
+ cls_new.version = H5Z_CLASS_T_VERS;
+ cls_new.id = cls_old->id;
cls_new.encoder_present = 1;
cls_new.decoder_present = 1;
- cls_new.name = cls_old->name;
- cls_new.can_apply = cls_old->can_apply;
- cls_new.set_local = cls_old->set_local;
- cls_new.filter = cls_old->filter;
+ cls_new.name = cls_old->name;
+ cls_new.can_apply = cls_old->can_apply;
+ cls_new.set_local = cls_old->set_local;
+ cls_new.filter = cls_old->filter;
/* Set cls_real to point to the translated structure */
cls_real = &cls_new;
-#else /* H5_NO_DEPRECATED_SYMBOLS */
+#else /* H5_NO_DEPRECATED_SYMBOLS */
/* Deprecated symbols not allowed, throw an error */
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- } /* end if */
+ } /* end if */
if (cls_real->id < 0 || cls_real->id > H5Z_FILTER_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
@@ -292,7 +276,6 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
/*-------------------------------------------------------------------------
* Function: H5Z_register
*
@@ -304,10 +287,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Z_register (const H5Z_class2_t *cls)
+H5Z_register(const H5Z_class2_t *cls)
{
- size_t i;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t i;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -322,7 +305,7 @@ H5Z_register (const H5Z_class2_t *cls)
/* Filter not already registered */
if (i >= H5Z_table_used_g) {
if (H5Z_table_used_g >= H5Z_table_alloc_g) {
- size_t n = MAX(H5Z_MAX_NFILTERS, 2 * H5Z_table_alloc_g);
+ size_t n = MAX(H5Z_MAX_NFILTERS, 2 * H5Z_table_alloc_g);
H5Z_class2_t *table = (H5Z_class2_t *)H5MM_realloc(H5Z_table_g, n * sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
H5Z_stats_t *stat_table = (H5Z_stats_t *)H5MM_realloc(H5Z_stat_table_g, n * sizeof(H5Z_stats_t));
@@ -340,22 +323,21 @@ H5Z_register (const H5Z_class2_t *cls)
/* Initialize */
i = H5Z_table_used_g++;
- H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ H5MM_memcpy(H5Z_table_g + i, cls, sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
- HDmemset(H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t));
+ HDmemset(H5Z_stat_table_g + i, 0, sizeof(H5Z_stats_t));
#endif /* H5Z_DEBUG */
- } /* end if */
+ } /* end if */
/* Filter already registered */
else {
/* Replace old contents */
- H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ H5MM_memcpy(H5Z_table_g + i, cls, sizeof(H5Z_class2_t));
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
}
-
/*-------------------------------------------------------------------------
* Function: H5Zunregister
*
@@ -368,7 +350,7 @@ done:
herr_t
H5Zunregister(H5Z_filter_t id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "Zf", id);
@@ -380,14 +362,13 @@ H5Zunregister(H5Z_filter_t id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters")
/* Do it */
- if(H5Z__unregister(id) < 0)
+ if (H5Z__unregister(id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Zunregister() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__unregister
*
@@ -401,9 +382,9 @@ done:
herr_t
H5Z__unregister(H5Z_filter_t filter_id)
{
- size_t filter_index; /* Local index variable for filter */
- H5Z_object_t object; /* Object to pass to callbacks */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t filter_index; /* Local index variable for filter */
+ H5Z_object_t object; /* Object to pass to callbacks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -419,10 +400,10 @@ H5Z__unregister(H5Z_filter_t filter_id)
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered")
/* Initialize the structure object for iteration */
- object.filter_id = filter_id;
- object.found = FALSE;
+ object.filter_id = filter_id;
+ object.found = FALSE;
#ifdef H5_HAVE_PARALLEL
- object.sanity_checked = FALSE;
+ object.sanity_checked = FALSE;
#endif /* H5_HAVE_PARALLEL */
/* Iterate through all opened datasets, returns a failure if any of them uses the filter */
@@ -430,14 +411,16 @@ H5Z__unregister(H5Z_filter_t filter_id)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
if (object.found)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a dataset is still using it")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL,
+ "can't unregister filter because a dataset is still using it")
/* Iterate through all opened groups, returns a failure if any of them uses the filter */
if (H5I_iterate(H5I_GROUP, H5Z__check_unregister_group_cb, &object, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
if (object.found)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a group is still using it")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL,
+ "can't unregister filter because a group is still using it")
/* Iterate through all opened files and flush them */
if (H5I_iterate(H5I_FILE, H5Z__flush_file_cb, &object, FALSE) < 0)
@@ -445,9 +428,11 @@ H5Z__unregister(H5Z_filter_t filter_id)
/* Remove filter from table */
/* Don't worry about shrinking table size (for now) */
- HDmemmove(&H5Z_table_g[filter_index], &H5Z_table_g[filter_index+1], sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index));
+ HDmemmove(&H5Z_table_g[filter_index], &H5Z_table_g[filter_index + 1],
+ sizeof(H5Z_class2_t) * ((H5Z_table_used_g - 1) - filter_index));
#ifdef H5Z_DEBUG
- HDmemmove(&H5Z_stat_table_g[filter_index], &H5Z_stat_table_g[filter_index+1], sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-filter_index));
+ HDmemmove(&H5Z_stat_table_g[filter_index], &H5Z_stat_table_g[filter_index + 1],
+ sizeof(H5Z_stats_t) * ((H5Z_table_used_g - 1) - filter_index));
#endif /* H5Z_DEBUG */
H5Z_table_used_g--;
@@ -455,7 +440,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__unregister() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__check_unregister
*
@@ -470,8 +454,8 @@ done:
static htri_t
H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id)
{
- H5P_genplist_t *plist; /* Property list */
- htri_t ret_value = FALSE; /* Return value */
+ H5P_genplist_t *plist; /* Property list */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC
@@ -487,7 +471,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__check_unregister() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__check_unregister_group_cb
*
@@ -505,17 +488,17 @@ done:
static int
H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
{
- hid_t ocpl_id = -1;
- H5Z_object_t *object = (H5Z_object_t *)key;
- htri_t filter_in_pline = FALSE;
- int ret_value = FALSE; /* Return value */
+ hid_t ocpl_id = -1;
+ H5Z_object_t *object = (H5Z_object_t *)key;
+ htri_t filter_in_pline = FALSE;
+ int ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC
HDassert(obj_ptr);
/* Get the group creation property */
- if((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0)
+ if ((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list")
/* Check if the filter is in the group creation property list */
@@ -527,7 +510,7 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void
*/
if (filter_in_pline) {
object->found = TRUE;
- ret_value = TRUE;
+ ret_value = TRUE;
}
done:
@@ -538,7 +521,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__check_unregister_group_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__check_unregister_dset_cb
*
@@ -556,10 +538,10 @@ done:
static int
H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
{
- hid_t ocpl_id = -1;
- H5Z_object_t *object = (H5Z_object_t *)key;
- htri_t filter_in_pline = FALSE;
- int ret_value = FALSE; /* Return value */
+ hid_t ocpl_id = -1;
+ H5Z_object_t *object = (H5Z_object_t *)key;
+ htri_t filter_in_pline = FALSE;
+ int ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC
@@ -578,7 +560,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *
*/
if (filter_in_pline) {
object->found = TRUE;
- ret_value = TRUE;
+ ret_value = TRUE;
}
done:
@@ -589,7 +571,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__check_unregister_dset_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__flush_file_cb
*
@@ -601,14 +582,13 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id,
- void *key H5_ATTR_PARALLEL_USED)
+H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key H5_ATTR_PARALLEL_USED)
{
- H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
+ H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
#ifdef H5_HAVE_PARALLEL
- H5Z_object_t *object = (H5Z_object_t *)key;
-#endif /* H5_HAVE_PARALLEL */
- int ret_value = FALSE; /* Return value */
+ H5Z_object_t *object = (H5Z_object_t *)key;
+#endif /* H5_HAVE_PARALLEL */
+ int ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC
@@ -617,30 +597,30 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id,
HDassert(key);
/* Do a global flush if the file is opened for write */
- if(H5F_ACC_RDWR & H5F_INTENT(f)) {
+ if (H5F_ACC_RDWR & H5F_INTENT(f)) {
/* When parallel HDF5 is defined, check for collective metadata reads on this
* file and set the flag for metadata I/O in the API context. -QAK, 2018/02/14
*/
#ifdef H5_HAVE_PARALLEL
/* Check if MPIO driver is used */
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */
/* Sanity check for collectively calling H5Zunregister, if requested */
/* (Sanity check assumes that a barrier on one file's comm
* is sufficient (i.e. that there aren't different comms for
* different files). -QAK, 2018/02/14)
*/
- if(H5_coll_api_sanity_check_g && !object->sanity_checked) {
- MPI_Comm mpi_comm; /* File's communicator */
+ if (H5_coll_api_sanity_check_g && !object->sanity_checked) {
+ MPI_Comm mpi_comm; /* File's communicator */
/* Retrieve the file communicator */
- if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f)))
+ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f)))
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get MPI communicator")
/* Issue the barrier */
- if(mpi_comm != MPI_COMM_NULL)
+ if (mpi_comm != MPI_COMM_NULL)
MPI_Barrier(mpi_comm);
/* Set the "sanity checked" flag */
@@ -649,13 +629,13 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id,
/* Check whether to use the collective metadata read DXPL */
coll_md_read = H5F_COLL_MD_READ(f);
- if(H5P_USER_TRUE == coll_md_read)
+ if (H5P_USER_TRUE == coll_md_read)
H5CX_set_coll_metadata_read(TRUE);
} /* end if */
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_PARALLEL */
/* Call the flush routine for mounted file hierarchies */
- if(H5F_flush_mounts((H5F_t *)obj_ptr) < 0)
+ if (H5F_flush_mounts((H5F_t *)obj_ptr) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy")
} /* end if */
@@ -663,7 +643,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__flush_file_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5Zfilter_avail
*
@@ -675,7 +654,7 @@ done:
htri_t
H5Zfilter_avail(H5Z_filter_t id)
{
- htri_t ret_value = FALSE; /* Return value */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "Zf", id);
@@ -691,7 +670,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Zfilter_avail() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_filter_avail
*
@@ -703,10 +681,10 @@ done:
htri_t
H5Z_filter_avail(H5Z_filter_t id)
{
- H5PL_key_t key; /* Key for finding a plugin */
- const H5Z_class2_t *filter_info; /* Filter information */
- size_t i; /* Local index variable */
- htri_t ret_value = FALSE; /* Return value */
+ H5PL_key_t key; /* Key for finding a plugin */
+ const H5Z_class2_t *filter_info; /* Filter information */
+ size_t i; /* Local index variable */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -716,8 +694,8 @@ H5Z_filter_avail(H5Z_filter_t id)
HGOTO_DONE(TRUE)
key.id = (int)id;
- if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
- if(H5Z_register(filter_info) < 0)
+ if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
+ if (H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter")
HGOTO_DONE(TRUE)
} /* end if */
@@ -726,7 +704,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_filter_avail() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__prelude_callback
*
@@ -741,12 +718,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
- hid_t space_id, H5Z_prelude_type_t prelude_type)
+H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hid_t space_id,
+ H5Z_prelude_type_t prelude_type)
{
- H5Z_class2_t *fclass; /* Individual filter information */
- size_t u; /* Local index variable */
- htri_t ret_value = TRUE; /* Return value */
+ H5Z_class2_t *fclass; /* Individual filter information */
+ size_t u; /* Local index variable */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC
@@ -758,7 +735,7 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
if (NULL == (fclass = H5Z_find(pline->filter[u].id))) {
/* Ignore errors from optional filters */
if (pline->filter[u].flags & H5Z_FLAG_OPTIONAL)
- H5E_clear_stack (NULL);
+ H5E_clear_stack(NULL);
else
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located")
} /* end if */
@@ -768,8 +745,8 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
case H5Z_PRELUDE_CAN_APPLY:
/* Check if filter is configured to be able to encode */
if (!fclass->encoder_present)
- HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.");
-
+ HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL,
+ "Filter present but encoding is disabled.");
/* Check if there is a "can apply" callback */
if (fclass->can_apply) {
@@ -800,15 +777,14 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
default:
HDassert("invalid prelude type" && 0);
} /* end switch */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__prelude_callback() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__prepare_prelude_callback_dcpl
*
@@ -825,9 +801,9 @@ done:
static herr_t
H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type)
{
- hid_t space_id = -1; /* ID for dataspace describing chunk */
- H5O_layout_t *dcpl_layout = NULL; /* Dataset's layout information */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t space_id = -1; /* ID for dataspace describing chunk */
+ H5O_layout_t *dcpl_layout = NULL; /* Dataset's layout information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -836,7 +812,7 @@ H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_typ
/* Check if the property list is non-default */
if (dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
- H5P_genplist_t *dc_plist; /* Dataset creation property list object */
+ H5P_genplist_t *dc_plist; /* Dataset creation property list object */
/* Get memory for the layout */
if (NULL == (dcpl_layout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
@@ -852,7 +828,7 @@ H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_typ
/* Check if the dataset is chunked */
if (H5D_CHUNKED == dcpl_layout->type) {
- H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */
+ H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */
/* Get I/O pipeline information */
if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0)
@@ -860,14 +836,14 @@ H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_typ
/* Check if the chunks have filters */
if (dcpl_pline.nused > 0) {
- hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */
- H5S_t *space; /* Dataspace describing chunk */
- size_t u; /* Local index variable */
+ hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */
+ H5S_t * space; /* Dataspace describing chunk */
+ size_t u; /* Local index variable */
/* Create a dataspace for a chunk & set the extent */
- for(u = 0; u < dcpl_layout->u.chunk.ndims; u++)
+ for (u = 0; u < dcpl_layout->u.chunk.ndims; u++)
chunk_dims[u] = dcpl_layout->u.chunk.dim[u];
- if(NULL == (space = H5S_create_simple(dcpl_layout->u.chunk.ndims, chunk_dims, NULL)))
+ if (NULL == (space = H5S_create_simple(dcpl_layout->u.chunk.ndims, chunk_dims, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Get ID for dataspace to pass to filter routines */
@@ -893,7 +869,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__prepare_prelude_callback_dcpl() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_can_apply
*
@@ -912,7 +887,7 @@ done:
herr_t
H5Z_can_apply(hid_t dcpl_id, hid_t type_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -924,7 +899,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_can_apply() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_set_local
*
@@ -943,7 +917,7 @@ done:
herr_t
H5Z_set_local(hid_t dcpl_id, hid_t type_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -955,7 +929,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_set_local() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_can_apply_direct
*
@@ -970,7 +943,7 @@ done:
herr_t
H5Z_can_apply_direct(const H5O_pline_t *pline)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -984,7 +957,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_can_apply_direct() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_set_local_direct
*
@@ -1003,7 +975,7 @@ done:
herr_t
H5Z_set_local_direct(const H5O_pline_t *pline)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1017,7 +989,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_set_local_direct() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_ignore_filters
*
@@ -1039,12 +1010,12 @@ done:
htri_t
H5Z_ignore_filters(hid_t dcpl_id, const H5T_t *type, const H5S_t *space)
{
- H5P_genplist_t *dc_plist; /* Dataset creation property list object */
- H5O_pline_t pline; /* Object's I/O pipeline information */
- H5S_class_t space_class; /* To check class of space */
- H5T_class_t type_class; /* To check if type is VL */
- bool bad_for_filters = FALSE;/* Suitable to have filters */
- htri_t ret_value = FALSE; /* TRUE for ignoring filters */
+ H5P_genplist_t *dc_plist; /* Dataset creation property list object */
+ H5O_pline_t pline; /* Object's I/O pipeline information */
+ H5S_class_t space_class; /* To check class of space */
+ H5T_class_t type_class; /* To check if type is VL */
+ bool bad_for_filters = FALSE; /* Suitable to have filters */
+ htri_t ret_value = FALSE; /* TRUE for ignoring filters */
FUNC_ENTER_NOAPI(FAIL)
@@ -1057,20 +1028,18 @@ H5Z_ignore_filters(hid_t dcpl_id, const H5T_t *type, const H5S_t *space)
/* Get datatype and dataspace classes for quick access */
space_class = H5S_GET_EXTENT_TYPE(space);
- type_class = H5T_get_class(type, FALSE);
+ type_class = H5T_get_class(type, FALSE);
/* These conditions are not suitable for filters */
- bad_for_filters = (H5S_NULL == space_class || H5S_SCALAR == space_class
- || H5T_VLEN == type_class
- || (H5T_STRING == type_class && TRUE == H5T_is_variable_str(type)));
+ bad_for_filters = (H5S_NULL == space_class || H5S_SCALAR == space_class || H5T_VLEN == type_class ||
+ (H5T_STRING == type_class && TRUE == H5T_is_variable_str(type)));
/* When these conditions occur, if there are required filters in pline,
then report a failure, otherwise, set flag that they can be ignored */
if (bad_for_filters) {
size_t ii;
if (pline.nused > 0) {
- for (ii = 0; ii < pline.nused; ii++)
- {
+ for (ii = 0; ii < pline.nused; ii++) {
if (!(pline.filter[ii].flags & H5Z_FLAG_OPTIONAL))
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "not suitable for filters")
}
@@ -1084,7 +1053,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_ignore_filters() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_modify
*
@@ -1095,11 +1063,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
- size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
+H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts,
+ const unsigned int cd_values[/*cd_nelmts*/])
{
- size_t idx; /* Index of filter in pipeline */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t idx; /* Index of filter in pipeline */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1118,7 +1086,7 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline")
/* Change parameters for filter */
- pline->filter[idx].flags = flags;
+ pline->filter[idx].flags = flags;
pline->filter[idx].cd_nelmts = cd_nelmts;
/* Free any existing parameters */
@@ -1127,7 +1095,7 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
/* Set parameters */
if (cd_nelmts > 0) {
- size_t i; /* Local index variable */
+ size_t i; /* Local index variable */
/* Allocate memory or point at internal buffer */
if (cd_nelmts > H5Z_COMMON_CD_VALUES) {
@@ -1143,13 +1111,12 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
pline->filter[idx].cd_values[i] = cd_values[i];
} /* end if */
else
- pline->filter[idx].cd_values = NULL;
+ pline->filter[idx].cd_values = NULL;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_modify() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_append
*
@@ -1160,11 +1127,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
- size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
+H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts,
+ const unsigned int cd_values[/*cd_nelmts*/])
{
- size_t idx;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t idx;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1178,7 +1145,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
* decide to relax this restriction in the future.
*/
if (pline->nused >= H5Z_MAX_NFILTERS)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline")
/* Check for freshly allocated filter pipeline */
if (pline->version == 0)
@@ -1187,7 +1154,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
/* Allocate additional space in the pipeline if it's full */
if (pline->nused >= pline->nalloc) {
H5O_pline_t x;
- size_t n;
+ size_t n;
/* Each filter's data may be stored internally or may be
* a separate block of memory.
@@ -1198,7 +1165,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
*/
for (n = 0; n < pline->nalloc; ++n)
if (pline->filter[n].cd_values == pline->filter[n]._cd_values)
- pline->filter[n].cd_values = (unsigned *)((void *) ~((size_t)NULL));
+ pline->filter[n].cd_values = (unsigned *)((void *)~((size_t)NULL));
x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc);
x.filter = (H5Z_filter_info_t *)H5MM_realloc(pline->filter, x.nalloc * sizeof(x.filter[0]));
@@ -1209,7 +1176,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
* internal data.
*/
for (n = 0; n < pline->nalloc; ++n)
- if (x.filter[n].cd_values == (void *) ~((size_t) NULL))
+ if (x.filter[n].cd_values == (void *)~((size_t)NULL))
x.filter[n].cd_values = x.filter[n]._cd_values;
/* Point to newly allocated buffer */
@@ -1218,13 +1185,13 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
} /* end if */
/* Add the new filter to the pipeline */
- idx = pline->nused;
- pline->filter[idx].id = filter;
- pline->filter[idx].flags = flags;
- pline->filter[idx].name = NULL; /*we'll pick it up later*/
+ idx = pline->nused;
+ pline->filter[idx].id = filter;
+ pline->filter[idx].flags = flags;
+ pline->filter[idx].name = NULL; /*we'll pick it up later*/
pline->filter[idx].cd_nelmts = cd_nelmts;
if (cd_nelmts > 0) {
- size_t i; /* Local index variable */
+ size_t i; /* Local index variable */
/* Allocate memory or point at internal buffer */
if (cd_nelmts > H5Z_COMMON_CD_VALUES) {
@@ -1240,7 +1207,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
pline->filter[idx].cd_values[i] = cd_values[i];
} /* end if */
else
- pline->filter[idx].cd_values = NULL;
+ pline->filter[idx].cd_values = NULL;
pline->nused++;
@@ -1248,7 +1215,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_append() */
-
/*-------------------------------------------------------------------------
* Function: H5Z__find_idx
*
@@ -1262,20 +1228,19 @@ done:
static int
H5Z__find_idx(H5Z_filter_t id)
{
- size_t i; /* Local index variable */
- int ret_value = FAIL; /* Return value */
+ size_t i; /* Local index variable */
+ int ret_value = FAIL; /* Return value */
FUNC_ENTER_STATIC_NOERR
- for(i = 0; i < H5Z_table_used_g; i++)
- if(H5Z_table_g[i].id == id)
+ for (i = 0; i < H5Z_table_used_g; i++)
+ if (H5Z_table_g[i].id == id)
HGOTO_DONE((int)i)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__find_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_find
*
@@ -1289,8 +1254,8 @@ done:
H5Z_class2_t *
H5Z_find(H5Z_filter_t id)
{
- int idx; /* Filter index in global table */
- H5Z_class2_t *ret_value = NULL; /* Return value */
+ int idx; /* Filter index in global table */
+ H5Z_class2_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1305,7 +1270,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5Z_find() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_pipeline
*
@@ -1330,42 +1294,42 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
- unsigned *filter_mask/*in,out*/, H5Z_EDC_t edc_read, H5Z_cb_t cb_struct,
- size_t *nbytes/*in,out*/, size_t *buf_size/*in,out*/, void **buf/*in,out*/)
+H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*in,out*/, H5Z_EDC_t edc_read,
+ H5Z_cb_t cb_struct, size_t *nbytes /*in,out*/, size_t *buf_size /*in,out*/,
+ void **buf /*in,out*/)
{
- size_t idx;
- size_t new_nbytes;
- int fclass_idx; /* Index of filter class in global table */
- H5Z_class2_t *fclass = NULL; /* Filter class pointer */
+ size_t idx;
+ size_t new_nbytes;
+ int fclass_idx; /* Index of filter class in global table */
+ H5Z_class2_t *fclass = NULL; /* Filter class pointer */
#ifdef H5Z_DEBUG
- H5Z_stats_t *fstats = NULL; /* Filter stats pointer */
- H5_timer_t timer; /* Timer for filter operations */
- H5_timevals_t times; /* Elapsed time for each operation */
+ H5Z_stats_t * fstats = NULL; /* Filter stats pointer */
+ H5_timer_t timer; /* Timer for filter operations */
+ H5_timevals_t times; /* Elapsed time for each operation */
#endif
- unsigned failed = 0;
- unsigned tmp_flags;
- size_t i;
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned failed = 0;
+ unsigned tmp_flags;
+ size_t i;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK)));
HDassert(filter_mask);
- HDassert(nbytes && *nbytes>0);
- HDassert(buf_size && *buf_size>0);
+ HDassert(nbytes && *nbytes > 0);
+ HDassert(buf_size && *buf_size > 0);
HDassert(buf && *buf);
HDassert(!pline || pline->nused < H5Z_MAX_NFILTERS);
#ifdef H5Z_DEBUG
H5_timer_init(&timer);
#endif
- if(pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */
- for(i = pline->nused; i > 0; --i) {
+ if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */
+ for (i = pline->nused; i > 0; --i) {
idx = i - 1;
- if(*filter_mask & ((unsigned)1 << idx)) {
+ if (*filter_mask & ((unsigned)1 << idx)) {
failed |= (unsigned)1 << idx;
- continue; /* filter excluded */
+ continue; /* filter excluded */
}
/* If the filter isn't registered and the application doesn't
@@ -1373,19 +1337,20 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
* try to load it dynamically and register it. Otherwise, return failure
*/
if ((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) {
- H5PL_key_t key;
- const H5Z_class2_t *filter_info;
- hbool_t issue_error = FALSE;
+ H5PL_key_t key;
+ const H5Z_class2_t *filter_info;
+ hbool_t issue_error = FALSE;
/* Try loading the filter */
key.id = (int)(pline->filter[idx].id);
- if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
+ if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
/* Register the filter we loaded */
- if(H5Z_register(filter_info) < 0)
+ if (H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
- /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */
- if((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0)
+ /* Search in the table of registered filters again to find the dynamic filter just loaded
+ * and registered */
+ if ((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0)
issue_error = TRUE;
}
else
@@ -1396,9 +1361,11 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
/* Print out the filter name to give more info. But the name is optional for
* the filter */
if (pline->filter[idx].name)
- HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered", pline->filter[idx].name)
+ HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered",
+ pline->filter[idx].name)
else
- HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered")
+ HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL,
+ "required filter (name unavailable) is not registered")
}
} /* end if */
@@ -1411,26 +1378,25 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
tmp_flags = flags | (pline->filter[idx].flags);
tmp_flags |= (edc_read == H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0;
- new_nbytes = (fclass->filter)(tmp_flags,
- pline->filter[idx].cd_nelmts, pline->filter[idx].cd_values,
- *nbytes, buf_size, buf);
+ new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts,
+ pline->filter[idx].cd_values, *nbytes, buf_size, buf);
#ifdef H5Z_DEBUG
H5_timer_stop(&timer);
H5_timer_get_times(timer, &times);
fstats->stats[1].times.elapsed += times.elapsed;
- fstats->stats[1].times.system += times.system;
- fstats->stats[1].times.user += times.user;
+ fstats->stats[1].times.system += times.system;
+ fstats->stats[1].times.user += times.user;
fstats->stats[1].total += MAX(*nbytes, new_nbytes);
- if(0 == new_nbytes)
+ if (0 == new_nbytes)
fstats->stats[1].errors += *nbytes;
#endif
- if(0 == new_nbytes) {
- if((cb_struct.func
- && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data)))
- || !cb_struct.func)
+ if (0 == new_nbytes) {
+ if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *buf_size,
+ cb_struct.op_data))) ||
+ !cb_struct.func)
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read")
*nbytes = *buf_size;
@@ -1441,20 +1407,20 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
*nbytes = new_nbytes;
}
}
- else if(pline) { /* Write */
- for(idx = 0; idx < pline->nused; idx++) {
- if(*filter_mask & ((unsigned)1 << idx)) {
+ else if (pline) { /* Write */
+ for (idx = 0; idx < pline->nused; idx++) {
+ if (*filter_mask & ((unsigned)1 << idx)) {
failed |= (unsigned)1 << idx;
- continue; /* filter excluded */
+ continue; /* filter excluded */
}
- if((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) {
+ if ((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) {
/* Check if filter is optional -- If it isn't, then error */
- if((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0)
+ if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered")
failed |= (unsigned)1 << idx;
H5E_clear_stack(NULL);
- continue; /* filter excluded */
- } /* end if */
+ continue; /* filter excluded */
+ } /* end if */
fclass = &H5Z_table_g[fclass_idx];
@@ -1463,26 +1429,26 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
H5_timer_start(&timer);
#endif
- new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags),
- pline->filter[idx].cd_nelmts, pline->filter[idx].cd_values,
- *nbytes, buf_size, buf);
+ new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts,
+ pline->filter[idx].cd_values, *nbytes, buf_size, buf);
#ifdef H5Z_DEBUG
H5_timer_stop(&timer);
H5_timer_get_times(timer, &times);
fstats->stats[0].times.elapsed += times.elapsed;
- fstats->stats[0].times.system += times.system;
- fstats->stats[0].times.user += times.user;
+ fstats->stats[0].times.system += times.system;
+ fstats->stats[0].times.user += times.user;
fstats->stats[0].total += MAX(*nbytes, new_nbytes);
- if(0 == new_nbytes)
+ if (0 == new_nbytes)
fstats->stats[0].errors += *nbytes;
#endif
- if(0 == new_nbytes) {
- if(0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) {
- if((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data)))
- || !cb_struct.func)
+ if (0 == new_nbytes) {
+ if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) {
+ if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf,
+ *nbytes, cb_struct.op_data))) ||
+ !cb_struct.func)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure")
*nbytes = *buf_size;
@@ -1501,7 +1467,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
-
/*-------------------------------------------------------------------------
* Function: H5Z_filter_info
*
@@ -1514,8 +1479,8 @@ done:
H5Z_filter_info_t *
H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter)
{
- size_t idx; /* Index of filter in pipeline */
- H5Z_filter_info_t *ret_value = NULL; /* Return value */
+ size_t idx; /* Index of filter in pipeline */
+ H5Z_filter_info_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1538,7 +1503,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_filter_info() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_filter_in_pline
*
@@ -1553,8 +1517,8 @@ done:
htri_t
H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter)
{
- size_t idx; /* Index of filter in pipeline */
- htri_t ret_value = TRUE; /* Return value */
+ size_t idx; /* Index of filter in pipeline */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1574,8 +1538,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_filter_in_pline() */
-
-
/*-------------------------------------------------------------------------
* Function: H5Z_all_filters_avail
*
@@ -1589,8 +1551,8 @@ done:
htri_t
H5Z_all_filters_avail(const H5O_pline_t *pline)
{
- size_t i, j; /* Local index variable */
- htri_t ret_value = TRUE; /* Return value */
+ size_t i, j; /* Local index variable */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1613,7 +1575,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_all_filters_avail() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_delete
*
@@ -1646,8 +1607,8 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter)
}
/* Delete filter */
else {
- size_t idx; /* Index of filter in pipeline */
- hbool_t found = FALSE; /* Indicate filter was found in pipeline */
+ size_t idx; /* Index of filter in pipeline */
+ hbool_t found = FALSE; /* Indicate filter was found in pipeline */
/* Locate the filter in the pipeline */
for (idx = 0; idx < pline->nused; idx++)
@@ -1693,7 +1654,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5Zget_filter_info
*
@@ -1720,7 +1680,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Zget_filter_info() */
-
/*-------------------------------------------------------------------------
* Function: H5Z_get_filter_info
*
@@ -1756,4 +1715,3 @@ H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_get_filter_info() */
-