Minor correction to H5Tget_super failure checks in JNI helpers (#6599)

The base type lookups in the object-tree helpers tested the
returned hid_t for truth rather than for a negative value. A failed
lookup returns H5I_INVALID_HID (-1), resolving true when checked, so any
failure wouldn't be caught until later.
This commit is contained in:
Matt L
2026-08-11 11:01:38 -05:00
committed by GitHub
parent 57128d33b2
commit eeba6ab8a5
+9 -9
View File
@@ -4291,7 +4291,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo
switch (type_class) {
case H5T_VLEN: {
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class(memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -4355,7 +4355,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo
void *objBuf = NULL;
size_t typeCount;
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class(memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -4603,7 +4603,7 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_
switch (type_class) {
case H5T_VLEN: {
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class((hid_t)memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -4686,7 +4686,7 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_
case H5T_ARRAY: {
void *objBuf = NULL;
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class(memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -4916,7 +4916,7 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t
switch (type_class) {
case H5T_VLEN: {
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class(memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -4997,7 +4997,7 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t
void *objBuf = NULL;
size_t typeCount;
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class(memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -5145,7 +5145,7 @@ translate_wbuf(JNIEnv *env, jobjectArray in_buf, jlong mem_type_id, H5T_class_t
switch (type_class) {
case H5T_VLEN: {
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class((hid_t)memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -5251,7 +5251,7 @@ translate_wbuf(JNIEnv *env, jobjectArray in_buf, jlong mem_type_id, H5T_class_t
break;
} /* H5T_COMPOUND */
case H5T_ARRAY: {
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class(memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -5446,7 +5446,7 @@ h5validate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class
if (!ENVPTR->IsInstanceOf(ENVONLY, in_obj, arrCList))
H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5validate_wbuf: expected a java.util.ArrayList element");
if (!(memb = H5Tget_super(mem_type_id)))
if ((memb = H5Tget_super(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((vlClass = H5Tget_class(memb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);