mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Merge branch '6153' into blob
Brings the CI fixes: the H5FC_DLL declarations for the H5Zf.c Fortran helpers, and the clang-format pass over this series. Conflict resolution: only the H5Z_modify signature line, where the two branches wrapped the argument list differently. Kept 6153's, which is what clang-format 17 produces. Also formats src/H5Opline.c and src/H5Zscaleoffset.c. Those two carry formatting drift that predates this merge -- they are clean on 6153 but were not on this branch, so the clang-format job would have flagged them here regardless. A whole-tree run using CI's source path and exclusion list now passes. Full build clean; ctest 3458/3459, the one failure being the pre-existing ph5_f90_filtered_writes_no_sel example bug fixed upstream in HDFGroup/hdf5#6633.
This commit is contained in:
@@ -588,6 +588,10 @@ H5FC_DLL int_f h5dont_atexit_c(void);
|
||||
H5FC_DLL herr_t H5Pappend_filter_str_c(hid_t plist, H5Z_filter_t id, unsigned flags, const char *params);
|
||||
H5FC_DLL herr_t H5Pappend_filter_raw_c(hid_t plist, H5Z_filter_t id, unsigned flags, size_t cd_nelmts,
|
||||
const unsigned *cd_values);
|
||||
H5FC_DLL herr_t H5Pmodify_filter_by_idx_str_c(hid_t plist, unsigned filter_idx, unsigned flags,
|
||||
const char *params);
|
||||
H5FC_DLL herr_t H5Pmodify_filter_by_idx_raw_c(hid_t plist, unsigned filter_idx, unsigned flags,
|
||||
size_t cd_nelmts, const unsigned *cd_values);
|
||||
|
||||
/*
|
||||
* Functions from H5Lf.c
|
||||
|
||||
@@ -12531,7 +12531,7 @@ public class H5 implements java.io.Serializable {
|
||||
params_struct.set(ValueLayout.JAVA_INT, 0, H5Z_PARAMS_STRING);
|
||||
params_struct.set(ValueLayout.ADDRESS, 8, str_seg);
|
||||
retVal = org.hdfgroup.javahdf5.hdf5_h.H5Pmodify_filter_by_idx(plist_id, filter_idx, flags,
|
||||
params_struct);
|
||||
params_struct);
|
||||
}
|
||||
catch (HDF5LibraryException e) {
|
||||
throw e;
|
||||
@@ -12576,18 +12576,17 @@ public class H5 implements java.io.Serializable {
|
||||
* addresses an entry by filter ID and resolves to the first match, whereas
|
||||
* this API addresses by pipeline index. The struct is built explicitly. */
|
||||
final int H5Z_PARAMS_CDVALUES = 0;
|
||||
int[] values = (cd_values != null) ? cd_values : new int[0];
|
||||
int[] values = (cd_values != null) ? cd_values : new int[0];
|
||||
try (Arena arena = Arena.ofConfined()) {
|
||||
MemorySegment vals_seg = (values.length > 0)
|
||||
? arena.allocateFrom(ValueLayout.JAVA_INT, values)
|
||||
: MemorySegment.NULL;
|
||||
MemorySegment vals_seg =
|
||||
(values.length > 0) ? arena.allocateFrom(ValueLayout.JAVA_INT, values) : MemorySegment.NULL;
|
||||
MemorySegment params_struct = arena.allocate(24, 8);
|
||||
params_struct.set(ValueLayout.JAVA_INT, 0, H5Z_PARAMS_CDVALUES);
|
||||
/* union { struct { size_t cd_nelmts; const unsigned *cd_values; } raw; ... } */
|
||||
params_struct.set(ValueLayout.JAVA_LONG, 8, (long)values.length);
|
||||
params_struct.set(ValueLayout.ADDRESS, 16, vals_seg);
|
||||
retVal = org.hdfgroup.javahdf5.hdf5_h.H5Pmodify_filter_by_idx(plist_id, filter_idx, flags,
|
||||
params_struct);
|
||||
params_struct);
|
||||
}
|
||||
catch (HDF5LibraryException e) {
|
||||
throw e;
|
||||
|
||||
@@ -8521,7 +8521,7 @@ public class H5 implements java.io.Serializable {
|
||||
* Error from the HDF5 Library.
|
||||
**/
|
||||
public synchronized static int H5Pmodify_filter_by_idx(long plist_id, int filter_idx, int flags,
|
||||
String params) throws HDF5LibraryException
|
||||
String params) throws HDF5LibraryException
|
||||
{
|
||||
return H5Pmodify_filter_by_idx_str(plist_id, filter_idx, flags, params);
|
||||
}
|
||||
@@ -8552,7 +8552,7 @@ public class H5 implements java.io.Serializable {
|
||||
* Error from the HDF5 Library.
|
||||
**/
|
||||
public synchronized static int H5Pmodify_filter_by_idx(long plist_id, int filter_idx, int flags,
|
||||
int[] cd_values) throws HDF5LibraryException
|
||||
int[] cd_values) throws HDF5LibraryException
|
||||
{
|
||||
return H5Pmodify_filter_by_idx_raw(plist_id, filter_idx, flags, cd_values);
|
||||
}
|
||||
|
||||
@@ -1464,8 +1464,8 @@ done:
|
||||
* Signature: (JIILjava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pmodify_1filter_1by_1idx_1str(JNIEnv *env, jclass clss, jlong plist_id,
|
||||
jint filter_idx, jint flags, jstring params)
|
||||
Java_hdf_hdf5lib_H5_H5Pmodify_1filter_1by_1idx_1str(JNIEnv *env, jclass clss, jlong plist_id, jint filter_idx,
|
||||
jint flags, jstring params)
|
||||
{
|
||||
H5Z_params_t p;
|
||||
const char *c_params = NULL;
|
||||
@@ -1497,8 +1497,8 @@ done:
|
||||
* Signature: (JII[I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pmodify_1filter_1by_1idx_1raw(JNIEnv *env, jclass clss, jlong plist_id,
|
||||
jint filter_idx, jint flags, jintArray cd_values)
|
||||
Java_hdf_hdf5lib_H5_H5Pmodify_1filter_1by_1idx_1raw(JNIEnv *env, jclass clss, jlong plist_id, jint filter_idx,
|
||||
jint flags, jintArray cd_values)
|
||||
{
|
||||
H5Z_params_t p;
|
||||
jint *c_cd_values = NULL;
|
||||
|
||||
@@ -161,7 +161,7 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pappend_1filter_1raw(JNIEnv *, jcla
|
||||
* Signature: (JIILjava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pmodify_1filter_1by_1idx_1str(JNIEnv *, jclass, jlong, jint,
|
||||
jint, jstring);
|
||||
jint, jstring);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
@@ -169,7 +169,7 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pmodify_1filter_1by_1idx_1str(JNIEn
|
||||
* Signature: (JII[I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pmodify_1filter_1by_1idx_1raw(JNIEnv *, jclass, jlong, jint,
|
||||
jint, jintArray);
|
||||
jint, jintArray);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
|
||||
@@ -267,8 +267,7 @@ public class TestH5Z {
|
||||
ret = H5.H5Pget_filter_params_by_idx(dcpl_id, 0, params);
|
||||
assertTrue("H5Pget_filter_params_by_idx", ret >= 0);
|
||||
assertNotNull("params[0] is non-null", params[0]);
|
||||
assertTrue("stored string reflects the modify: " + params[0],
|
||||
params[0].contains("level=9"));
|
||||
assertTrue("stored string reflects the modify: " + params[0], params[0].contains("level=9"));
|
||||
}
|
||||
}
|
||||
catch (Throwable err) {
|
||||
@@ -305,10 +304,10 @@ public class TestH5Z {
|
||||
assertEquals("nfilters after H5Pmodify_filter_by_idx", 1, nfilters);
|
||||
|
||||
// cd_values were replaced.
|
||||
int[] cd_out = new int[1];
|
||||
int[] flags_out = new int[1];
|
||||
long[] cd_nelmts = new long[] {1};
|
||||
String[] name_out = new String[] {""};
|
||||
int[] cd_out = new int[1];
|
||||
int[] flags_out = new int[1];
|
||||
long[] cd_nelmts = new long[] {1};
|
||||
String[] name_out = new String[] {""};
|
||||
int filter_id =
|
||||
H5.H5Pget_filter(dcpl_id, 0, flags_out, cd_nelmts, cd_out, 256, name_out, new int[1]);
|
||||
assertEquals("filter id unchanged by modify", HDF5Constants.H5Z_FILTER_DEFLATE, filter_id);
|
||||
|
||||
+2
-4
@@ -263,8 +263,7 @@ H5O__pline_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS
|
||||
uint32_t ext_length;
|
||||
|
||||
if (H5_IS_BUFFER_OVERFLOW(p, H5O_PLINE_EXT_HDR_SIZE, p_end))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL,
|
||||
"ran off end of input buffer while decoding");
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
|
||||
UINT16DECODE(p, ext_type);
|
||||
ext_flags = *p++;
|
||||
ext_reserved = *p++;
|
||||
@@ -285,8 +284,7 @@ H5O__pline_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS
|
||||
prev_type = ext_type;
|
||||
|
||||
if (H5_IS_BUFFER_OVERFLOW(p, ext_length, p_end))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL,
|
||||
"ran off end of input buffer while decoding");
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
|
||||
|
||||
switch (ext_type) {
|
||||
case H5O_PLINE_EXT_CONFIG:
|
||||
|
||||
+2
-4
@@ -2009,8 +2009,7 @@ H5Pappend_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, const
|
||||
* An empty input stores nothing. */
|
||||
if (!empty_input) {
|
||||
if (NULL == (canon_config = H5Z_canonicalize_params(param_str)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
|
||||
"can't canonicalize filter parameter string");
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't canonicalize filter parameter string");
|
||||
retain_config = canon_config;
|
||||
}
|
||||
|
||||
@@ -2275,8 +2274,7 @@ H5Pmodify_filter_by_idx(hid_t plist_id, unsigned filter_idx, unsigned flags, con
|
||||
}
|
||||
if (retain_config) {
|
||||
if (NULL == (staged_config = (char *)H5MM_strdup(retain_config)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
|
||||
"memory allocation failed for filter config string");
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter config string");
|
||||
}
|
||||
|
||||
/* ---- Commit: nothing below can fail. ---- */
|
||||
|
||||
+1
-2
@@ -198,8 +198,7 @@ H5_DLL int H5P_fill_value_cmp(const void *value1, const void *value2, size_t
|
||||
/* keep_config: see H5Z_modify() in H5Zprivate.h. set_local callbacks pass
|
||||
* true; a caller replacing cd_values directly passes false. */
|
||||
H5_DLL herr_t H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts,
|
||||
bool keep_config,
|
||||
const unsigned cd_values[]);
|
||||
bool keep_config, const unsigned cd_values[]);
|
||||
H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags,
|
||||
size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[],
|
||||
unsigned *filter_config);
|
||||
|
||||
@@ -1304,8 +1304,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts,
|
||||
bool keep_config,
|
||||
H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts, bool keep_config,
|
||||
const unsigned int cd_values[/*cd_nelmts*/])
|
||||
{
|
||||
size_t idx; /* Index of filter in pipeline */
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ H5_DLL herr_t H5Z_get_filter_info(H5Z_filter_t filter, unsigned int
|
||||
/* Normalise a parameter string into the form persisted in pipeline v3:
|
||||
* outer braces stripped and hex-float literals rewritten to %.17e decimal,
|
||||
* so the stored bytes are valid TOML v1.0.0. Caller frees with H5MM_xfree(). */
|
||||
H5_DLL char *H5Z_canonicalize_params(const char *params);
|
||||
H5_DLL char *H5Z_canonicalize_params(const char *params);
|
||||
|
||||
/* Filter blob storage (in-file large binary configuration) */
|
||||
struct H5F_t; /*forward decl*/
|
||||
|
||||
@@ -1217,8 +1217,7 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
|
||||
/* set_local specialises cd_values for this dataset; keep the stored
|
||||
* configuration string (keep_config = true). */
|
||||
if (H5P_modify_filter(dcpl_plist, H5Z_FILTER_SCALEOFFSET, flags, (size_t)H5Z_SCALEOFFSET_TOTAL_NPARMS,
|
||||
true,
|
||||
cd_values) < 0)
|
||||
true, cd_values) < 0)
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local scaleoffset parameters");
|
||||
|
||||
done:
|
||||
|
||||
+9
-9
@@ -4196,8 +4196,8 @@ error:
|
||||
#define CANON_FILTER_ID 532
|
||||
|
||||
static herr_t
|
||||
canon_set_config(const char *params, unsigned H5_ATTR_UNUSED *flags, size_t *cd_nelmts,
|
||||
unsigned cd_values[], size_t cd_values_size)
|
||||
canon_set_config(const char *params, unsigned H5_ATTR_UNUSED *flags, size_t *cd_nelmts, unsigned cd_values[],
|
||||
size_t cd_values_size)
|
||||
{
|
||||
double rate = 0.0;
|
||||
|
||||
@@ -4492,8 +4492,8 @@ test_set_local_keeps_config(hid_t fapl)
|
||||
hsize_t dims[2] = {8, 8}, chunk[2] = {4, 4};
|
||||
char filename[1024];
|
||||
char pbuf[H5Z_CONFIG_STRING_MAX + 1];
|
||||
size_t plen = 0;
|
||||
const char *compact = "scale_type=\"int\",scale_factor=8";
|
||||
size_t plen = 0;
|
||||
const char *compact = "scale_type=\"int\",scale_factor=8";
|
||||
H5Z_params_t p;
|
||||
|
||||
TESTING("set_local preserves the stored configuration string");
|
||||
@@ -4572,8 +4572,8 @@ test_modify_filter_by_idx(hid_t fapl)
|
||||
hsize_t dims[2] = {8, 8};
|
||||
char filename[1024];
|
||||
char pbuf[H5Z_CONFIG_STRING_MAX + 1];
|
||||
size_t plen = 0;
|
||||
double got = 0.0;
|
||||
size_t plen = 0;
|
||||
double got = 0.0;
|
||||
unsigned flags_out = 0;
|
||||
unsigned cd[8];
|
||||
size_t cd_nelmts = 8;
|
||||
@@ -4637,9 +4637,9 @@ test_modify_filter_by_idx(hid_t fapl)
|
||||
unsigned raw[2] = {0, 0};
|
||||
|
||||
memcpy(raw, &v, sizeof(v));
|
||||
p.type = H5Z_PARAMS_CDVALUES;
|
||||
p.u.raw.cd_nelmts = 2;
|
||||
p.u.raw.cd_values = raw;
|
||||
p.type = H5Z_PARAMS_CDVALUES;
|
||||
p.u.raw.cd_nelmts = 2;
|
||||
p.u.raw.cd_values = raw;
|
||||
if (H5Pmodify_filter_by_idx(dcpl, 0, H5Z_FLAG_MANDATORY, &p) < 0)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user