mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Declare the H5Zf.c Fortran helpers; apply clang-format
Two CI failures, both from the preceding commits.
Missing prototypes (hdf5 dev cmake CI). H5Pmodify_filter_by_idx_str_c
and _raw_c were defined in fortran/src/H5Zf.c but never declared in
H5f90proto.h alongside the H5Pappend_filter_*_c helpers. That broke two
different jobs for one reason:
- "Special Workflows / gcc REL -Werror (build only)" builds with
-Werror=missing-prototypes and rejected both definitions outright.
- The Intel and windows-oneapi jobs failed at link with LNK2019 on
both symbols, because H5FC_DLL on the declaration is what carries
the dllexport attribute; with no declaration the symbols were never
exported from hdf5_fortran.dll.
Adding the two H5FC_DLL declarations fixes both. Verified locally by
compiling H5Zf.c with -Werror=missing-prototypes, which the ordinary
build does not enable.
Formatting (clang-format Commit Changes). This job was green on the
commit before this series and has failed on every commit since; the
fault was entirely mine. Ran clang-format 17 -- the version CI pins --
over every file this series touched, C and Java alike, since the check
covers .java here too. The whole tree now passes a local run using CI's
source path and exclusion list.
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
@@ -1912,8 +1912,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;
|
||||
}
|
||||
|
||||
@@ -2204,8 +2203,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);
|
||||
|
||||
@@ -1300,8 +1300,8 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
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*/])
|
||||
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 */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
+1
-1
@@ -123,7 +123,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);
|
||||
|
||||
/* Data Transform Functions */
|
||||
typedef struct H5Z_data_xform_t H5Z_data_xform_t; /* Defined in H5Ztrans.c */
|
||||
|
||||
+9
-9
@@ -2472,8 +2472,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;
|
||||
|
||||
@@ -2768,8 +2768,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");
|
||||
@@ -2848,8 +2848,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;
|
||||
@@ -2913,9 +2913,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