Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hbool_t/TRUE/FALSE from java #3145

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java/src/jni/h5Constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5O_1TOKEN_1UNDEF(JNIEnv *env, jclass cls)
H5O_token_t undef_token = H5O_TOKEN_UNDEF;

/* TODO: Can be optimized by keeping a global reference to the undefined token class */
return create_H5O_token_t(env, &undef_token, FALSE);
return create_H5O_token_t(env, &undef_token, false);
}

JNIEXPORT jlong JNICALL
Expand Down
2 changes: 1 addition & 1 deletion java/src/jni/h5Imp.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits(JNIEnv *env, jclass clss, jint reg
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe(JNIEnv *env, jclass clss)
{
hbool_t is_ts = false;
bool is_ts = false;

UNUSED(clss);

Expand Down
8 changes: 4 additions & 4 deletions java/src/jni/h5dImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid
H5T_class_t tclass;
jstring jstr;
h5str_t h5str;
hbool_t close_mem_space = FALSE;
bool close_mem_space = false;
size_t typeSize;
size_t i;
hid_t mem_space = mem_sid;
Expand All @@ -1413,7 +1413,7 @@ H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid
*/
if ((mem_space = H5Dget_space(did)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
close_mem_space = TRUE;
close_mem_space = true;

if (H5Sselect_all(mem_space) < 0)
H5_LIBRARY_ERROR(ENVONLY);
Expand Down Expand Up @@ -1632,7 +1632,7 @@ H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_si
{
const char *utf8 = NULL;
jstring jstr = NULL;
hbool_t close_mem_space = FALSE;
bool close_mem_space = false;
size_t typeSize;
size_t i;
hid_t mem_space = mem_sid;
Expand All @@ -1649,7 +1649,7 @@ H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_si
*/
if ((mem_space = H5Dget_space(did)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
close_mem_space = TRUE;
close_mem_space = true;

if (H5Sselect_all(mem_space) < 0)
H5_LIBRARY_ERROR(ENVONLY);
Expand Down
18 changes: 9 additions & 9 deletions java/src/jni/h5fImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,8 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status(JNIEnv *env, jclass clss, jlong
{
jboolean *mdc_logging_status_ptr = NULL;
jboolean isCopy;
hbool_t is_enabled;
hbool_t is_currently_logging;
bool is_enabled;
bool is_currently_logging;
jsize size;

UNUSED(clss);
Expand Down Expand Up @@ -729,14 +729,14 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status(JNIEnv *env, jclass clss, jlong
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize)
{
hbool_t minimize_val;
herr_t retVal = FAIL;
bool minimize_val;
herr_t retVal = FAIL;

UNUSED(clss);

minimize_val = (minimize == JNI_TRUE) ? TRUE : FALSE;
minimize_val = (minimize == JNI_TRUE) ? true : false;

if ((retVal = H5Fset_dset_no_attrs_hint((hid_t)file_id, (hbool_t)minimize_val)) < 0)
if ((retVal = H5Fset_dset_no_attrs_hint((hid_t)file_id, (bool)minimize_val)) < 0)
H5_LIBRARY_ERROR(ENVONLY);

done:
Expand All @@ -752,14 +752,14 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong file_id)
{
jboolean bval = JNI_FALSE;
hbool_t minimize = FALSE;
bool minimize = false;

UNUSED(clss);

if (H5Fget_dset_no_attrs_hint((hid_t)file_id, (hbool_t *)&minimize) < 0)
if (H5Fget_dset_no_attrs_hint((hid_t)file_id, (bool *)&minimize) < 0)
H5_LIBRARY_ERROR(ENVONLY);

if (minimize == TRUE)
if (minimize == true)
bval = JNI_TRUE;

done:
Expand Down
2 changes: 1 addition & 1 deletion java/src/jni/h5iImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ Java_hdf_hdf5lib_H5_H5Iclear_1type(JNIEnv *env, jclass clss, jint type, jboolean
{
UNUSED(clss);

if (H5Iclear_type((H5I_type_t)type, (hbool_t)force) < 0)
if (H5Iclear_type((H5I_type_t)type, (bool)force) < 0)
H5_LIBRARY_ERROR(ENVONLY);

done:
Expand Down
2 changes: 1 addition & 1 deletion java/src/jni/h5jni.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ extern jobject get_enum_object(JNIEnv *env, const char *enum_class_name, jint en
extern jobject create_H5G_info_t(JNIEnv *env, H5G_info_t group_info);

/* implemented at h5oimp.c */
extern jobject create_H5O_token_t(JNIEnv *env, const H5O_token_t *token, hbool_t is_critical_pinning);
extern jobject create_H5O_token_t(JNIEnv *env, const H5O_token_t *token, bool is_critical_pinning);

#ifdef __cplusplus
} /* end extern "C" */
Expand Down
14 changes: 7 additions & 7 deletions java/src/jni/h5lImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ Java_hdf_hdf5lib_H5_H5Lexists(JNIEnv *env, jclass clss, jlong loc_id, jstring na
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1info(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
H5L_info2_t infobuf = {H5L_TYPE_ERROR, FALSE, -1, H5T_CSET_ERROR, {{{0}}}};
H5L_info2_t infobuf = {H5L_TYPE_ERROR, false, -1, H5T_CSET_ERROR, {{{0}}}};
const char *linkName = NULL;
jvalue args[5];
herr_t status = FAIL;
Expand All @@ -302,7 +302,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1info(JNIEnv *env, jclass clss, jlong loc_id, jstring
jobject token;

/* Create an H5O_token_t object */
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, FALSE)))
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, false)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

args[0].i = infobuf.type;
Expand Down Expand Up @@ -340,7 +340,7 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong access_id)
{
H5L_info2_t infobuf = {H5L_TYPE_ERROR, FALSE, -1, H5T_CSET_ERROR, {{{0}}}};
H5L_info2_t infobuf = {H5L_TYPE_ERROR, false, -1, H5T_CSET_ERROR, {{{0}}}};
const char *groupName = NULL;
jvalue args[5];
herr_t status = FAIL;
Expand All @@ -367,7 +367,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id
jobject token;

/* Create an H5O_token_t object */
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, FALSE)))
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, false)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

args[0].i = infobuf.type;
Expand Down Expand Up @@ -454,7 +454,7 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1value(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jobjectArray link_value, jlong access_id)
{
H5L_info2_t infobuf = {H5L_TYPE_ERROR, FALSE, -1, H5T_CSET_ERROR, {{{0}}}};
H5L_info2_t infobuf = {H5L_TYPE_ERROR, false, -1, H5T_CSET_ERROR, {{{0}}}};
const char *file_name = NULL;
const char *obj_name = NULL;
const char *linkName = NULL;
Expand Down Expand Up @@ -544,7 +544,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx(JNIEnv *env, jclass clss, jlong loc_i
jint index_field, jint order, jlong link_n,
jobjectArray link_value, jlong access_id)
{
H5L_info2_t infobuf = {H5L_TYPE_ERROR, FALSE, -1, H5T_CSET_ERROR, {{{0}}}};
H5L_info2_t infobuf = {H5L_TYPE_ERROR, false, -1, H5T_CSET_ERROR, {{{0}}}};
const char *file_name = NULL;
const char *obj_name = NULL;
const char *grpName = NULL;
Expand Down Expand Up @@ -706,7 +706,7 @@ H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info2_t *info, void *cb_d
jobject token;

/* Create an H5O_token_t object */
if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->u.token, FALSE)))
if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->u.token, false)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);

args[0].i = info->type;
Expand Down
14 changes: 7 additions & 7 deletions java/src/jni/h5oImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info2_t *in
* Create a java object of hdf.hdf5lib.structs.H5O_token_t.
*/
jobject
create_H5O_token_t(JNIEnv *envptr, const H5O_token_t *token, hbool_t is_critical_pinning)
create_H5O_token_t(JNIEnv *envptr, const H5O_token_t *token, bool is_critical_pinning)
{
jbyteArray tokenByteBuf;
jboolean token_buf_is_copy;
Expand Down Expand Up @@ -193,7 +193,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info(JNIEnv *env, jclass clss, jlong loc_id, jint fi
if ((status = H5Oget_info3((hid_t)loc_id, &infobuf, (unsigned)fields)) < 0)
H5_LIBRARY_ERROR(ENVONLY);

if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE)))
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, false)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

args[0].j = (jlong)infobuf.fileno;
Expand Down Expand Up @@ -241,7 +241,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_i
H5_LIBRARY_ERROR(ENVONLY);

/* Create an H5O_token_t object */
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE)))
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, false)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

args[0].j = (jlong)infobuf.fileno;
Expand Down Expand Up @@ -293,7 +293,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id
H5_LIBRARY_ERROR(ENVONLY);

/* Create an H5O_token_t object */
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE)))
if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, false)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);

args[0].j = (jlong)infobuf.fileno;
Expand Down Expand Up @@ -580,7 +580,7 @@ H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info2_t *info, void *cb_d
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);

/* Create an H5O_token_t object */
if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->token, FALSE)))
if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->token, false)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);

args[0].j = (jlong)info->fileno;
Expand Down Expand Up @@ -1037,14 +1037,14 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled(JNIEnv *env, jclass clss, jlong loc_id)
{
jboolean bval = JNI_FALSE;
hbool_t is_disabled = FALSE;
bool is_disabled = false;

UNUSED(clss);

if (H5Oare_mdc_flushes_disabled((hid_t)loc_id, &is_disabled) < 0)
H5_LIBRARY_ERROR(ENVONLY);

if (is_disabled == TRUE)
if (is_disabled == true)
bval = JNI_TRUE;

done:
Expand Down
14 changes: 7 additions & 7 deletions java/src/jni/h5pDCPLImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,14 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts(JNIEnv *env, jclass clss, jlong dcpl_id)
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong dcpl_id, jboolean minimize)
{
hbool_t minimize_val;
herr_t retVal = FAIL;
bool minimize_val;
herr_t retVal = FAIL;

UNUSED(clss);

minimize_val = (JNI_TRUE == minimize) ? TRUE : FALSE;
minimize_val = (JNI_TRUE == minimize) ? true : false;

if ((retVal = H5Pset_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t)minimize_val)) < 0)
if ((retVal = H5Pset_dset_no_attrs_hint((hid_t)dcpl_id, (bool)minimize_val)) < 0)
H5_LIBRARY_ERROR(ENVONLY);

done:
Expand All @@ -241,15 +241,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlon
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong dcpl_id)
{
hbool_t minimize = FALSE;
bool minimize = false;
jboolean bval = JNI_FALSE;

UNUSED(clss);

if (H5Pget_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t *)&minimize) < 0)
if (H5Pget_dset_no_attrs_hint((hid_t)dcpl_id, (bool *)&minimize) < 0)
H5_LIBRARY_ERROR(ENVONLY);

if (minimize == TRUE)
if (minimize == true)
bval = JNI_TRUE;

done:
Expand Down
8 changes: 4 additions & 4 deletions java/src/jni/h5pDXPLImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,17 @@ Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size(JNIEnv *env, jclass clss, jlong plist)
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1preserve(JNIEnv *env, jclass clss, jlong plist, jboolean status)
{
hbool_t st = JNI_FALSE;
herr_t retVal = FAIL;
bool st = JNI_FALSE;
herr_t retVal = FAIL;

UNUSED(clss);

if (JNI_TRUE == status)
st = TRUE;
st = true;
else if (JNI_FALSE == status)
st = false;
else
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_preserve: status not TRUE or FALSE");
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_preserve: status not true or false");

if ((retVal = H5Pset_preserve((hid_t)plist, st)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
Expand Down
Loading