From 00f5d01c8345d9718ca43aa8ca98bf6cfc05b70d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:21:00 -0700 Subject: Normalize java w/ develop (#3283) --- java/src/jni/exceptionImp.c | 14 +- java/src/jni/h5Constants.c | 2 +- java/src/jni/h5Imp.c | 2 +- java/src/jni/h5aImp.c | 80 +++--- java/src/jni/h5dImp.c | 84 +++---- java/src/jni/h5eImp.c | 8 +- java/src/jni/h5fImp.c | 26 +- java/src/jni/h5iImp.c | 10 +- java/src/jni/h5jni.h | 4 +- java/src/jni/h5lImp.c | 26 +- java/src/jni/h5oImp.c | 26 +- java/src/jni/h5pDAPLImp.c | 4 +- java/src/jni/h5pDCPLImp.c | 54 ++-- java/src/jni/h5pDXPLImp.c | 12 +- java/src/jni/h5pFAPLImp.c | 110 ++++----- java/src/jni/h5pFCPLImp.c | 8 +- java/src/jni/h5pLAPLImp.c | 4 +- java/src/jni/h5pOCPLImp.c | 8 +- java/src/jni/h5plImp.c | 4 +- java/src/jni/h5rImp.c | 70 +++--- java/src/jni/h5sImp.c | 116 ++++----- java/src/jni/h5tImp.c | 20 +- java/src/jni/h5util.c | 581 ++++++++++++++++++++++---------------------- java/src/jni/h5vlImp.c | 4 +- 24 files changed, 638 insertions(+), 639 deletions(-) diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c index 464f457..acc7a5c 100644 --- a/java/src/jni/exceptionImp.c +++ b/java/src/jni/exceptionImp.c @@ -73,17 +73,17 @@ typedef struct H5E_num_t { CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \ \ if (NULL == (jm = ENVPTR->GetMethodID(ENVONLY, jc, "", "(Ljava/lang/String;)V"))) { \ - HDprintf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \ + printf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \ } \ \ if (NULL == (ex = ENVPTR->NewObjectA(ENVONLY, jc, jm, (jvalue *)(args)))) { \ - HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Creation failed\n", (className)); \ + printf("THROWEXCEPTION FATAL ERROR: Class %s: Creation failed\n", (className)); \ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \ } \ \ if (ENVPTR->Throw(ENVONLY, (jthrowable)ex) < 0) { \ - HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Throw failed\n", (className)); \ + printf("THROWEXCEPTION FATAL ERROR: Class %s: Throw failed\n", (className)); \ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \ } \ } @@ -168,9 +168,9 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0(JNIEnv *env, j else { PIN_JAVA_STRING(ENVONLY, file_name, file, NULL, "printStackTrace0: file name not pinned"); - if ((stream = HDfopen(file, "a+"))) { + if ((stream = fopen(file, "a+"))) { H5Eprint2(H5E_DEFAULT, stream); - HDfclose(stream); + fclose(stream); } } @@ -403,7 +403,7 @@ h5libraryError(JNIEnv *env) goto done; if (msg_size > 0) { - if (NULL == (msg_str = (char *)HDcalloc((size_t)msg_size + 1, sizeof(char)))) + if (NULL == (msg_str = (char *)calloc((size_t)msg_size + 1, sizeof(char)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5libraryerror: failed to allocate buffer for error message"); if ((msg_size = H5Eget_msg(min_num, &error_msg_type, msg_str, (size_t)msg_size + 1)) < 0) @@ -428,7 +428,7 @@ h5libraryError(JNIEnv *env) done: if (msg_str) - HDfree(msg_str); + free(msg_str); return retVal; } /* end h5libraryError() */ diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 63b82ea..e031db6 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -2030,7 +2030,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 diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c index 433c50d..8fdf051 100644 --- a/java/src/jni/h5Imp.c +++ b/java/src/jni/h5Imp.c @@ -191,7 +191,7 @@ done: 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); diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index a8041a6..2e985e7 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -181,7 +181,7 @@ Java_hdf_hdf5lib_H5_H5Aread(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_t if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (readBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread: failed to allocate raw VL read buffer"); } else { @@ -218,7 +218,7 @@ done: } if (vl_data_class) { - HDfree(readBuf); + free(readBuf); } else { if (isCriticalPinning) { @@ -270,7 +270,7 @@ Java_hdf_hdf5lib_H5_H5Awrite(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_ if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (writeBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite: failed to allocate raw VL write buffer"); } else { @@ -304,7 +304,7 @@ done: } if (vl_data_class) { - HDfree(writeBuf); + free(writeBuf); } else { if (isCriticalPinning) { @@ -993,17 +993,17 @@ Java_hdf_hdf5lib_H5_H5Aread_1string(JNIEnv *env, jclass clss, jlong attr_id, jlo if (!(str_len = H5Tget_size((hid_t)mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (cstr = (char *)HDmalloc(str_len + 1))) + if (NULL == (cstr = (char *)malloc(str_len + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed"); - if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len))) + if (NULL == (c_buf = (char *)malloc((size_t)n * str_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed"); if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, c_buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); for (i = 0, pos = 0; i < n; i++) { - HDmemcpy(cstr, c_buf + pos, str_len); + memcpy(cstr, c_buf + pos, str_len); cstr[str_len] = '\0'; if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) { @@ -1022,9 +1022,9 @@ Java_hdf_hdf5lib_H5_H5Aread_1string(JNIEnv *env, jclass clss, jlong attr_id, jlo done: if (c_buf) - HDfree(c_buf); + free(c_buf); if (cstr) - HDfree(cstr); + free(cstr); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Aread_1string */ @@ -1058,7 +1058,7 @@ Java_hdf_hdf5lib_H5_H5Awrite_1string(JNIEnv *env, jclass clss, jlong attr_id, jl if (!(str_len = H5Tget_size((hid_t)mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len))) + if (NULL == (c_buf = (char *)malloc((size_t)n * str_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite_string: memory allocation failed"); for (i = 0; i < (size_t)n; i++) { @@ -1068,7 +1068,7 @@ Java_hdf_hdf5lib_H5_H5Awrite_1string(JNIEnv *env, jclass clss, jlong attr_id, jl /* * If the string object was NULL, skip it. */ - HDmemset(&c_buf[i * str_len], 0, str_len); + memset(&c_buf[i * str_len], 0, str_len); continue; } @@ -1079,7 +1079,7 @@ Java_hdf_hdf5lib_H5_H5Awrite_1string(JNIEnv *env, jclass clss, jlong attr_id, jl PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Awrite_string: string not pinned"); - HDstrncpy(&c_buf[i * str_len], utf8, str_len); + strncpy(&c_buf[i * str_len], utf8, str_len); UNPIN_JAVA_STRING(ENVONLY, obj, utf8); utf8 = NULL; @@ -1094,7 +1094,7 @@ done: if (utf8) UNPIN_JAVA_STRING(ENVONLY, obj, utf8); if (c_buf) - HDfree(c_buf); + free(c_buf); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Awrite_1string */ @@ -1133,7 +1133,7 @@ Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (readBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread: failed to allocate raw VL read buffer"); if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, (void *)readBuf)) < 0) @@ -1157,9 +1157,9 @@ done: } if (is_variable) { for (size_t i = 0; i < (size_t)vl_array_len; i++) - HDfree(((char **)readBuf)[i]); + free(((char **)readBuf)[i]); } - HDfree(readBuf); + free(readBuf); } return (jint)status; @@ -1202,7 +1202,7 @@ Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *env, jclass clss, jlong attr_id, jlong me if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (writeBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite: failed to allocate raw VL write buffer"); if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) @@ -1224,10 +1224,10 @@ done: } if (is_variable) { for (size_t i = 0; i < (size_t)vl_array_len; i++) - HDfree(((char **)writeBuf)[i]); + free(((char **)writeBuf)[i]); } - HDfree(writeBuf); + free(writeBuf); } return (jint)status; @@ -1323,7 +1323,7 @@ H5AreadVL_str(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL_str: buf length < 0"); } - if (NULL == (strs = (char **)HDcalloc((size_t)n, sizeof(char *)))) + if (NULL == (strs = (char **)calloc((size_t)n, sizeof(char *)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_str: failed to allocate variable length string read buffer"); @@ -1356,7 +1356,7 @@ done: H5free_memory(strs[i]); } - HDfree(strs); + free(strs); } return status; @@ -1381,7 +1381,7 @@ H5AreadVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) void *readBuf = NULL; herr_t status = FAIL; - HDmemset(&h5str, 0, sizeof(h5str_t)); + memset(&h5str, 0, sizeof(h5str_t)); /* Get size of string array */ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { @@ -1396,7 +1396,7 @@ H5AreadVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (readBuf = HDcalloc((size_t)n, typeSize))) + if (NULL == (readBuf = calloc((size_t)n, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate read buffer"); if ((status = H5Aread(aid, tid, readBuf)) < 0) @@ -1429,7 +1429,7 @@ done: h5str_free(&h5str); if (readBuf) { H5Treclaim(tid, sid, H5P_DEFAULT, readBuf); - HDfree(readBuf); + free(readBuf); } if (sid >= 0) H5Sclose(sid); @@ -1528,7 +1528,7 @@ H5AwriteVL_str(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL_str: buf length < 0"); } - if (NULL == (writeBuf = (char **)HDcalloc((size_t)size + 1, sizeof(char *)))) + if (NULL == (writeBuf = (char **)calloc((size_t)size + 1, sizeof(char *)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate variable length string write buffer"); @@ -1550,10 +1550,10 @@ H5AwriteVL_str(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5AwriteVL_str: string not pinned"); - if (NULL == (writeBuf[i] = (char *)HDmalloc((size_t)length + 1))) + if (NULL == (writeBuf[i] = (char *)malloc((size_t)length + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate string buffer"); - HDstrncpy(writeBuf[i], utf8, (size_t)length + 1); + strncpy(writeBuf[i], utf8, (size_t)length + 1); writeBuf[i][length] = '\0'; UNPIN_JAVA_STRING(ENVONLY, obj, utf8); @@ -1571,10 +1571,10 @@ done: if (writeBuf) { for (i = 0; i < size; i++) { if (writeBuf[i]) - HDfree(writeBuf[i]); + free(writeBuf[i]); } - HDfree(writeBuf); + free(writeBuf); } return status; @@ -1610,7 +1610,7 @@ H5AwriteVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize))) + if (NULL == (writeBuf = calloc((size_t)n, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer"); /* @@ -1626,7 +1626,7 @@ H5AwriteVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) /* * If the string object was NULL, skip it. */ - HDmemset(&(((char *)writeBuf)[i * typeSize]), 0, typeSize); + memset(&(((char *)writeBuf)[i * typeSize]), 0, typeSize); continue; } @@ -1646,7 +1646,7 @@ H5AwriteVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) if (!h5str_convert(ENVONLY, &utf8_copy, aid, tid, &(((char *)writeBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - HDfree(utf8_copy); + free(utf8_copy); UNPIN_JAVA_STRING(ENVONLY, jstr, utf8); utf8 = NULL; @@ -1662,7 +1662,7 @@ done: UNPIN_JAVA_STRING(ENVONLY, jstr, utf8); if (writeBuf) { H5Treclaim(tid, sid, H5P_DEFAULT, writeBuf); - HDfree(writeBuf); + free(writeBuf); } if (sid >= 0) H5Sclose(sid); @@ -1687,14 +1687,14 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref(JNIEnv *env, jclass clss, jlong attr_id, j UNUSED(clss); - HDmemset(&h5str, 0, sizeof(h5str_t)); + memset(&h5str, 0, sizeof(h5str_t)); if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0"); } - if (NULL == (ref_data = (H5R_ref_t *)HDcalloc(1, (size_t)n * sizeof(H5R_ref_t)))) + if (NULL == (ref_data = (H5R_ref_t *)calloc(1, (size_t)n * sizeof(H5R_ref_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer"); if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0) @@ -1724,7 +1724,7 @@ done: if (h5str.s) h5str_free(&h5str); if (ref_data) - HDfree(ref_data); + free(ref_data); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref */ @@ -1784,7 +1784,7 @@ Java_hdf_hdf5lib_H5_H5Aget_1name(JNIEnv *env, jclass clss, jlong attr_id) if ((buf_size = H5Aget_name((hid_t)attr_id, 0, NULL)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (attrName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (attrName = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name: failed to allocate attribute name buffer"); if (H5Aget_name((hid_t)attr_id, (size_t)buf_size + 1, attrName) < 0) @@ -1796,7 +1796,7 @@ Java_hdf_hdf5lib_H5_H5Aget_1name(JNIEnv *env, jclass clss, jlong attr_id) done: if (attrName) - HDfree(attrName); + free(attrName); return str; } /* end Java_hdf_hdf5lib_H5_H5Aget_1name */ @@ -2140,7 +2140,7 @@ Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id (hsize_t)n, (char *)NULL, (size_t)0, (hid_t)lapl_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (attrName = (char *)HDmalloc(sizeof(char) * (size_t)status_size + 1))) + if (NULL == (attrName = (char *)malloc(sizeof(char) * (size_t)status_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name_by_idx: failed to allocate buffer for attribute name"); if ((H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, @@ -2153,7 +2153,7 @@ Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id done: if (attrName) - HDfree(attrName); + free(attrName); if (objName) UNPIN_JAVA_STRING(ENVONLY, obj_name, objName); diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index de7fb21..3453bde 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -207,7 +207,7 @@ Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *env, jclass clss, jlong dataset_id, jlong me if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (readBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread: failed to allocate raw VL read buffer"); } else { @@ -237,7 +237,7 @@ done: H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, readBuf); if (vl_data_class) { - HDfree(readBuf); + free(readBuf); } else { if (isCriticalPinning) { @@ -288,7 +288,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *env, jclass clss, jlong dataset_id, jlong m if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (writeBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dwrite: failed to allocate raw VL write buffer"); } else { @@ -318,7 +318,7 @@ done: H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, writeBuf); if (vl_data_class) { - HDfree(writeBuf); + free(writeBuf); } else { if (isCriticalPinning) { @@ -1016,10 +1016,10 @@ Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *env, jclass clss, jlong dataset_id, if (!(str_len = H5Tget_size((hid_t)mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (cstr = (char *)HDmalloc(str_len + 1))) + if (NULL == (cstr = (char *)malloc(str_len + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); - if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len))) + if (NULL == (c_buf = (char *)malloc((size_t)n * str_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, @@ -1027,7 +1027,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *env, jclass clss, jlong dataset_id, H5_LIBRARY_ERROR(ENVONLY); for (i = 0, pos = 0; i < n; i++) { - HDmemcpy(cstr, c_buf + pos, str_len); + memcpy(cstr, c_buf + pos, str_len); cstr[str_len] = '\0'; if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) { @@ -1046,9 +1046,9 @@ Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *env, jclass clss, jlong dataset_id, done: if (c_buf) - HDfree(c_buf); + free(c_buf); if (cstr) - HDfree(cstr); + free(cstr); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Dread_1string */ @@ -1083,7 +1083,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *env, jclass clss, jlong dataset_id, if (!(str_len = H5Tget_size((hid_t)mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len))) + if (NULL == (c_buf = (char *)malloc((size_t)n * str_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dwrite_string: memory allocation failed"); for (i = 0; i < (size_t)n; i++) { @@ -1093,7 +1093,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *env, jclass clss, jlong dataset_id, /* * If the string object was NULL, skip it. */ - HDmemset(&c_buf[i * str_len], 0, str_len); + memset(&c_buf[i * str_len], 0, str_len); continue; } @@ -1104,7 +1104,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *env, jclass clss, jlong dataset_id, PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Dwrite_string: string not pinned"); - HDstrncpy(&c_buf[i * str_len], utf8, str_len); + strncpy(&c_buf[i * str_len], utf8, str_len); UNPIN_JAVA_STRING(ENVONLY, obj, utf8); utf8 = NULL; @@ -1120,7 +1120,7 @@ done: if (utf8) UNPIN_JAVA_STRING(ENVONLY, obj, utf8); if (c_buf) - HDfree(c_buf); + free(c_buf); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Dwrite_1string */ @@ -1160,7 +1160,7 @@ Java_hdf_hdf5lib_H5_H5DreadVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (readBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL: failed to allocate raw VL read buffer"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, @@ -1177,9 +1177,9 @@ done: H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, readBuf); if (is_variable) { for (size_t i = 0; i < (size_t)vl_array_len; i++) - HDfree(((char **)readBuf)[i]); + free(((char **)readBuf)[i]); } - HDfree(readBuf); + free(readBuf); } return (jint)status; @@ -1221,7 +1221,7 @@ Java_hdf_hdf5lib_H5_H5DwriteVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + if (NULL == (writeBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL: failed to allocate raw VL write buffer"); if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) @@ -1239,10 +1239,10 @@ done: H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, writeBuf); if (is_variable) { for (size_t i = 0; i < (size_t)vl_array_len; i++) - HDfree(((char **)writeBuf)[i]); + free(((char **)writeBuf)[i]); } - HDfree(writeBuf); + free(writeBuf); } return (jint)status; @@ -1342,7 +1342,7 @@ H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL_str: buf length < 0"); } - if (NULL == (strs = (char **)HDcalloc((size_t)n, sizeof(char *)))) + if (NULL == (strs = (char **)calloc((size_t)n, sizeof(char *)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_str: failed to allocate variable length string read buffer"); @@ -1375,7 +1375,7 @@ done: H5free_memory(strs[i]); } - HDfree(strs); + free(strs); } return status; @@ -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; @@ -1402,7 +1402,7 @@ H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid void *readBuf = NULL; herr_t status = FAIL; - HDmemset(&h5str, 0, sizeof(h5str_t)); + memset(&h5str, 0, sizeof(h5str_t)); if (mem_space == H5S_ALL) { mem_space = file_sid; @@ -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); @@ -1429,7 +1429,7 @@ H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (readBuf = HDcalloc((size_t)n, typeSize))) + if (NULL == (readBuf = calloc((size_t)n, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate read buffer"); if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, readBuf)) < 0) @@ -1465,7 +1465,7 @@ done: h5str_free(&h5str); if (readBuf) { H5Treclaim(tid, mem_space, xfer_plist_id, readBuf); - HDfree(readBuf); + free(readBuf); } if (close_mem_space) H5Sclose(mem_space); @@ -1568,7 +1568,7 @@ H5DwriteVL_str(JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_str: buf length < 0"); } - if (NULL == (writeBuf = (char **)HDcalloc((size_t)size + 1, sizeof(char *)))) + if (NULL == (writeBuf = (char **)calloc((size_t)size + 1, sizeof(char *)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate variable length string write buffer"); @@ -1590,10 +1590,10 @@ H5DwriteVL_str(JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_str: string not pinned"); - if (NULL == (writeBuf[i] = (char *)HDmalloc((size_t)length + 1))) + if (NULL == (writeBuf[i] = (char *)malloc((size_t)length + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate string buffer"); - HDstrncpy(writeBuf[i], utf8, (size_t)length + 1); + strncpy(writeBuf[i], utf8, (size_t)length + 1); writeBuf[i][length] = '\0'; UNPIN_JAVA_STRING(ENVONLY, obj, utf8); @@ -1612,10 +1612,10 @@ done: if (writeBuf) { for (i = 0; i < size; i++) { if (writeBuf[i]) - HDfree(writeBuf[i]); + free(writeBuf[i]); } - HDfree(writeBuf); + free(writeBuf); } return status; @@ -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; @@ -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); @@ -1664,7 +1664,7 @@ H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_si if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize))) + if (NULL == (writeBuf = calloc((size_t)n, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer"); for (i = 0; i < (size_t)n; ++i) { @@ -1674,7 +1674,7 @@ H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_si /* * If the string object was NULL, skip it. */ - HDmemset(&(((char *)writeBuf)[i * typeSize]), 0, typeSize); + memset(&(((char *)writeBuf)[i * typeSize]), 0, typeSize); continue; } @@ -1694,7 +1694,7 @@ H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_si if (!h5str_convert(ENVONLY, &utf8_copy, did, tid, &(((char *)writeBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - HDfree(utf8_copy); + free(utf8_copy); UNPIN_JAVA_STRING(ENVONLY, jstr, utf8); utf8 = NULL; @@ -1710,7 +1710,7 @@ done: UNPIN_JAVA_STRING(ENVONLY, jstr, utf8); if (writeBuf) { H5Treclaim(tid, mem_space, xfer_plist_id, writeBuf); - HDfree(writeBuf); + free(writeBuf); } if (close_mem_space) H5Sclose(mem_space); @@ -1736,14 +1736,14 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *env, jclass clss, jlong dataset_id UNUSED(clss); - HDmemset(&h5str, 0, sizeof(h5str_t)); + memset(&h5str, 0, sizeof(h5str_t)); if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0"); } - if (NULL == (ref_data = (H5R_ref_t *)HDcalloc(1, (size_t)n * sizeof(H5R_ref_t)))) + if (NULL == (ref_data = (H5R_ref_t *)calloc(1, (size_t)n * sizeof(H5R_ref_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, @@ -1774,7 +1774,7 @@ done: if (h5str.s) h5str_free(&h5str); if (ref_data) - HDfree(ref_data); + free(ref_data); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */ @@ -2005,7 +2005,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent(JNIEnv *env, jclass clss, jlong loc_id, jlong PIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, &isCopy, "H5Dset_extent: buffer not pinned"); - if (NULL == (dims = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (dims = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dset_extent: failed to allocate dataset dimension buffer"); for (i = 0; i < rank; i++) @@ -2016,7 +2016,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent(JNIEnv *env, jclass clss, jlong loc_id, jlong done: if (dims) - HDfree(dims); + free(dims); if (dimsBuf) UNPIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, JNI_ABORT); } /* end Java_hdf_hdf5lib_H5_H5Dset_1extent */ diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 0eec54f..a44363e 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -298,7 +298,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1class_1name(JNIEnv *env, jclass clss, jlong cls_id) if (!buf_size) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: no class name"); - if (NULL == (namePtr = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (namePtr = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_class_name: malloc failed"); if ((H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size + 1)) < 0) @@ -310,7 +310,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1class_1name(JNIEnv *env, jclass clss, jlong cls_id) done: if (namePtr) - HDfree(namePtr); + free(namePtr); return str; } /* end Java_hdf_hdf5lib_H5_H5Eget_1class_1name */ @@ -452,7 +452,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg(JNIEnv *env, jclass clss, jlong msg_id, jintArra if (!buf_size) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid message"); - if (NULL == (namePtr = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (namePtr = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_msg: malloc failed"); PIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, NULL, "H5Eget_msg: error_msg_type_list not pinned"); @@ -470,7 +470,7 @@ done: if (theArray) UNPIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, 0); if (namePtr) - HDfree(namePtr); + free(namePtr); return str; } /* end Java_hdf_hdf5lib_H5_H5Eget_1msg */ diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index af06bdc..4a65a7f 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -126,7 +126,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1name(JNIEnv *env, jclass clss, jlong file_id) if ((buf_size = H5Fget_name((hid_t)file_id, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (namePtr = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (namePtr = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_name: malloc failed"); if ((H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size + 1)) < 0) @@ -138,7 +138,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1name(JNIEnv *env, jclass clss, jlong file_id) done: if (namePtr) - HDfree(namePtr); + free(namePtr); return str; } /* end Java_hdf_hdf5lib_H5_H5Fget_1name */ @@ -430,7 +430,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids(JNIEnv *env, jclass clss, jlong file_id, ji H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list length < 0"); } - if (NULL == (id_list = (hid_t *)HDmalloc((size_t)rank * sizeof(hid_t)))) + if (NULL == (id_list = (hid_t *)malloc((size_t)rank * sizeof(hid_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_obj_ids: malloc failed"); if ((ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list)) < 0) @@ -442,7 +442,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids(JNIEnv *env, jclass clss, jlong file_id, ji done: if (id_list) - HDfree(id_list); + free(id_list); if (obj_id_listP) UNPIN_LONG_ARRAY(ENVONLY, obj_id_list, obj_id_listP, (ret_val < 0) ? JNI_ABORT : 0); @@ -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); @@ -729,14 +729,14 @@ done: 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: @@ -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: diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c index e483c4e..46e8904 100644 --- a/java/src/jni/h5iImp.c +++ b/java/src/jni/h5iImp.c @@ -68,7 +68,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1name_1long(JNIEnv *env, jclass clss, jlong obj_id, j if (buf_size < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Iget_name_long: buf_size < 0"); - if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (aName = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name_long: malloc failed"); if ((size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1)) < 0) @@ -83,7 +83,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1name_1long(JNIEnv *env, jclass clss, jlong obj_id, j done: if (aName) - HDfree(aName); + free(aName); return (jlong)size; } /* end Java_hdf_hdf5lib_H5_H5Iget_1name */ @@ -106,7 +106,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1name(JNIEnv *env, jclass clss, jlong obj_id) if ((buf_size = H5Iget_name((hid_t)obj_id, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (aName = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name: malloc failed"); if (H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1) < 0) @@ -118,7 +118,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1name(JNIEnv *env, jclass clss, jlong obj_id) done: if (aName) - HDfree(aName); + free(aName); return str; } /* end Java_hdf_hdf5lib_H5_H5Iget_1name */ @@ -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: diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h index 5af5a91..7b1bf9d 100644 --- a/java/src/jni/h5jni.h +++ b/java/src/jni/h5jni.h @@ -82,7 +82,7 @@ H5_JNI_FATAL_ERROR(envptr, "JNI error: GetMethodID failed"); \ } \ if (NULL == (ret_obj = (*envptr)->NewObjectA(envptr, cls, constructor, (args)))) { \ - HDprintf("FATAL ERROR: %s: Creation failed\n", classname); \ + printf("FATAL ERROR: %s: Creation failed\n", classname); \ CHECK_JNI_EXCEPTION(envptr, JNI_FALSE); \ } \ } while (0) @@ -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" */ diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 67f4850..13dbc08 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -277,7 +277,7 @@ done: 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; @@ -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; @@ -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; @@ -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; @@ -424,7 +424,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id H5_LIBRARY_ERROR(ENVONLY); /* add extra space for the null terminator */ - if (NULL == (linkName = (char *)HDmalloc(sizeof(char) * (size_t)status_size + 1))) + if (NULL == (linkName = (char *)malloc(sizeof(char) * (size_t)status_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_name_by_idx: failed to allocate buffer for link name"); if ((H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, @@ -438,7 +438,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id done: if (linkName) - HDfree(linkName); + free(linkName); if (groupName) UNPIN_JAVA_STRING(ENVONLY, name, groupName); @@ -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; @@ -478,7 +478,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1value(JNIEnv *env, jclass clss, jlong loc_id, jstrin if (H5L_TYPE_HARD == infobuf.type) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val: hard links are unsupported"); - if (NULL == (linkValue = (char *)HDmalloc(sizeof(char) * infobuf.u.val_size + 1))) + if (NULL == (linkValue = (char *)malloc(sizeof(char) * infobuf.u.val_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val: failed to allocate buffer for link value"); if ((status = H5Lget_val((hid_t)loc_id, linkName, (void *)linkValue, infobuf.u.val_size + 1, @@ -527,7 +527,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1value(JNIEnv *env, jclass clss, jlong loc_id, jstrin done: if (linkValue) - HDfree(linkValue); + free(linkValue); if (linkName) UNPIN_JAVA_STRING(ENVONLY, name, linkName); @@ -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; @@ -572,7 +572,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx(JNIEnv *env, jclass clss, jlong loc_i if (!infobuf.u.val_size) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (linkValue = (void *)HDmalloc(infobuf.u.val_size + 1))) + if (NULL == (linkValue = (void *)malloc(infobuf.u.val_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val_by_idx: failed to allocate buffer for link value"); if ((status = H5Lget_val_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, @@ -622,7 +622,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx(JNIEnv *env, jclass clss, jlong loc_i done: if (linkValue) - HDfree(linkValue); + free(linkValue); if (grpName) UNPIN_JAVA_STRING(ENVONLY, name, grpName); @@ -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; diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index 998a607..c97d7da 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -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; @@ -63,7 +63,7 @@ create_H5O_token_t(JNIEnv *envptr, const H5O_token_t *token, hbool_t is_critical PIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, &token_buf_is_copy, "create_H5O_token_t: object token buffer not pinned"); - HDmemcpy(token_buf, token, sizeof(H5O_token_t)); + memcpy(token_buf, token, sizeof(H5O_token_t)); if (is_critical_pinning) UNPIN_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, 0); @@ -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; @@ -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; @@ -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; @@ -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; @@ -756,7 +756,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment(JNIEnv *env, jclass clss, jlong loc_id) H5_LIBRARY_ERROR(ENVONLY); if (buf_size) { - if (NULL == (oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (oComment = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment: failed to allocate object comment buffer"); if ((status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size + 1)) < 0) @@ -769,7 +769,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment(JNIEnv *env, jclass clss, jlong loc_id) done: if (oComment) - HDfree(oComment); + free(oComment); return (jstring)str; } /* end Java_hdf_hdf5lib_H5_H5Oget_1comment */ @@ -801,7 +801,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name(JNIEnv *env, jclass clss, jlong lo H5_LIBRARY_ERROR(ENVONLY); if (buf_size) { - if (NULL == (objComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (objComment = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment"); @@ -816,7 +816,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name(JNIEnv *env, jclass clss, jlong lo done: if (objComment) - HDfree(objComment); + free(objComment); if (objName) UNPIN_JAVA_STRING(ENVONLY, name, objName); @@ -916,7 +916,7 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token(JNIEnv *env, jclass clss, jlong loc_id, PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, &token_buf_is_copy, "H5Oopen_by_token: token buffer not pinned"); - HDmemcpy(&obj_token, token_buf, sizeof(H5O_token_t)); + memcpy(&obj_token, token_buf, sizeof(H5O_token_t)); UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, JNI_ABORT); token_buf = NULL; @@ -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: diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c index 666f47d..fdafd4c 100644 --- a/java/src/jni/h5pDAPLImp.c +++ b/java/src/jni/h5pDAPLImp.c @@ -150,7 +150,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix(JNIEnv *env, jclass clss, jlong dapl_i if ((prefix_size = H5Pget_efile_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (pre = (char *)HDmalloc(sizeof(char) * (size_t)prefix_size + 1))) + if (NULL == (pre = (char *)malloc(sizeof(char) * (size_t)prefix_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_efile_prefix: memory allocation failed"); if (H5Pget_efile_prefix((hid_t)dapl_id, (char *)pre, (size_t)prefix_size + 1) < 0) @@ -165,7 +165,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix(JNIEnv *env, jclass clss, jlong dapl_i done: if (pre) - HDfree(pre); + free(pre); return (jstring)str; } /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */ diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c index f549800..d600177 100644 --- a/java/src/jni/h5pDCPLImp.c +++ b/java/src/jni/h5pDCPLImp.c @@ -104,7 +104,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *env, jclass clss, jlong plist, jint nd PIN_BYTE_ARRAY(ENVONLY, dim, theArray, &isCopy, "H5Pset_chunk: dim array not pinned"); - if (NULL == (da = lp = (hsize_t *)HDmalloc(rank * sizeof(hsize_t)))) + if (NULL == (da = lp = (hsize_t *)malloc(rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_chunk: memory allocation failed"); jlp = (jlong *)theArray; @@ -119,7 +119,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *env, jclass clss, jlong plist, jint nd done: if (da) - HDfree(da); + free(da); if (theArray) UNPIN_BYTE_ARRAY(ENVONLY, dim, theArray, JNI_ABORT); @@ -155,7 +155,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk(JNIEnv *env, jclass clss, jlong plist, jint ma PIN_LONG_ARRAY(ENVONLY, dims, theArray, &isCopy, "H5Pget_chunk: input dims not pinned"); - if (NULL == (da = (hsize_t *)HDmalloc((size_t)max_ndims * sizeof(hsize_t)))) + if (NULL == (da = (hsize_t *)malloc((size_t)max_ndims * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_chunk: memory allocation failed"); if ((status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da)) < 0) @@ -166,7 +166,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk(JNIEnv *env, jclass clss, jlong plist, jint ma done: if (da) - HDfree(da); + free(da); if (theArray) UNPIN_LONG_ARRAY(ENVONLY, dims, theArray, (status < 0) ? JNI_ABORT : 0); @@ -219,14 +219,14 @@ done: 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: @@ -241,15 +241,15 @@ done: 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: @@ -576,7 +576,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter(JNIEnv *env, jclass clss, jlong plist, jint f if (NULL == cd_values) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: cd_values is NULL"); - if (NULL == (filter = (char *)HDmalloc(sizeof(char) * (size_t)namelen))) + if (NULL == (filter = (char *)malloc(sizeof(char) * (size_t)namelen))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter: flags array not pinned"); @@ -616,7 +616,7 @@ done: if (flagsArray) UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0); if (filter) - HDfree(filter); + free(filter); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Pget_1filter */ @@ -651,7 +651,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter2(JNIEnv *env, jclass clss, jlong plist, jint if (NULL == filter_config) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: filter_config is NULL"); - if (NULL == (filter = (char *)HDmalloc(sizeof(char) * (size_t)namelen))) + if (NULL == (filter = (char *)malloc(sizeof(char) * (size_t)namelen))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter2: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter2: flags array not pinned"); @@ -714,7 +714,7 @@ done: if (flagsArray) UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0); if (filter) - HDfree(filter); + free(filter); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */ @@ -754,7 +754,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id(JNIEnv *env, jclass clss, jlong plist if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: name is NULL"); - if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)bs))) + if (NULL == (aName = (char *)malloc(sizeof(char) * (size_t)bs))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id: flags not pinned"); @@ -800,7 +800,7 @@ done: if (flagsArray) UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0); if (aName) - HDfree(aName); + free(aName); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id */ @@ -842,7 +842,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2(JNIEnv *env, jclass clss, jlong plis if (NULL == filter_config) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: filter_config is NULL"); - if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)bs))) + if (NULL == (aName = (char *)malloc(sizeof(char) * (size_t)bs))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id2: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id2: flags not pinned"); @@ -886,7 +886,7 @@ done: if (flagsArray) UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0); if (aName) - HDfree(aName); + free(aName); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 */ @@ -1103,7 +1103,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: size input array < 2"); if (name_size > 0) - if (NULL == (file = (char *)HDmalloc(sizeof(char) * (size_t)name_size))) + if (NULL == (file = (char *)malloc(sizeof(char) * (size_t)name_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: memory allocation failed"); if ((status = H5Pget_external((hid_t)plist, (unsigned)idx, (size_t)name_size, file, (off_t *)&o, @@ -1134,7 +1134,7 @@ done: if (theArray) UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0); if (file) - HDfree(file); + free(file); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Pget_1external */ @@ -1228,7 +1228,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname(JNIEnv *env, jclass clss, jlong dc if ((buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)idx, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (dname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (dname = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: memory allocation failed"); if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)idx, dname, (size_t)buf_size + 1) < 0) @@ -1244,7 +1244,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname(JNIEnv *env, jclass clss, jlong dc done: if (dname) - HDfree(dname); + free(dname); return (jstring)str; } /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname */ @@ -1267,7 +1267,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename(JNIEnv *env, jclass clss, jlong dc if ((buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)idx, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (fname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (fname = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: memory allocation failed"); if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)idx, fname, (size_t)buf_size + 1) < 0) @@ -1283,7 +1283,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename(JNIEnv *env, jclass clss, jlong dc done: if (fname) - HDfree(fname); + free(fname); return (jstring)str; } /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename */ @@ -1369,7 +1369,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix(JNIEnv *env, jclass clss, jlong dapl if ((prefix_size = H5Pget_virtual_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (pre = (char *)HDmalloc(sizeof(char) * (size_t)prefix_size + 1))) + if (NULL == (pre = (char *)malloc(sizeof(char) * (size_t)prefix_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_prefix: memory allocation failed"); if (H5Pget_virtual_prefix((hid_t)dapl_id, (char *)pre, (size_t)prefix_size + 1) < 0) @@ -1384,7 +1384,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix(JNIEnv *env, jclass clss, jlong dapl done: if (pre) - HDfree(pre); + free(pre); return (jstring)str; } /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */ diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c index 6a11c0e..7926db1 100644 --- a/java/src/jni/h5pDXPLImp.c +++ b/java/src/jni/h5pDXPLImp.c @@ -171,17 +171,17 @@ done: 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); @@ -301,7 +301,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1data_1transform(JNIEnv *env, jclass clss, jlong plis if ((express_size = H5Pget_data_transform((hid_t)plist_id, (char *)NULL, (size_t)size)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (express = (char *)HDmalloc(sizeof(char) * (size_t)express_size + 1))) + if (NULL == (express = (char *)malloc(sizeof(char) * (size_t)express_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_data_transform: memory allocation failed"); if (H5Pget_data_transform((hid_t)plist_id, express, (size_t)express_size + 1) < 0) @@ -319,7 +319,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1data_1transform(JNIEnv *env, jclass clss, jlong plis done: if (express) - HDfree(express); + free(express); return (jlong)express_size; } /* end Java_hdf_hdf5lib_H5_H5Pget_1data_1transform */ diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 80ed6c6..7708756 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -109,7 +109,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, UNUSED(clss); - if ((retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store)) < 0) + if ((retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (bool)backing_store)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -145,7 +145,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, long long inc_temp = *incArray; size_t inc_t = (size_t)inc_temp; - if ((status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray)) < 0) + if ((status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (bool *)backArray)) < 0) H5_LIBRARY_ERROR(ENVONLY); *incArray = (jlong)inc_t; @@ -302,7 +302,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family(JNIEnv *env, jclass clss, jlong tid, jl H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size array length < 0"); } - if (NULL == (sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (sa = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_family: memory allocation failed"); PIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, &isCopy, "H5Pget_family: plistArray not pinned"); @@ -317,7 +317,7 @@ done: if (plistArray) UNPIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, (status < 0) ? JNI_ABORT : 0); if (sa) - HDfree(sa); + free(sa); if (sizeArray) UNPIN_LONG_ARRAY(ENVONLY, memb_size, sizeArray, (status < 0) ? JNI_ABORT : 0); @@ -442,7 +442,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs(JNIEnv *env, jclass clss, jlong fapl_id, UNUSED(clss); #ifdef H5_HAVE_LIBHDFS - HDmemset(&instance, 0, sizeof(H5FD_hdfs_fapl_t)); + memset(&instance, 0, sizeof(H5FD_hdfs_fapl_t)); if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -462,14 +462,14 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs(JNIEnv *env, jclass clss, jlong fapl_id, if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config namenode_name not pinned"); - HDstrncpy(instance.namenode_name, str, H5FD__HDFS_NODE_NAME_SPACE + 1); + strncpy(instance.namenode_name, str, H5FD__HDFS_NODE_NAME_SPACE + 1); instance.namenode_name[H5FD__HDFS_NODE_NAME_SPACE] = '\0'; UNPIN_JAVA_STRING(ENVONLY, j_str, str); str = NULL; } else - HDmemset(instance.namenode_name, 0, H5FD__HDFS_NODE_NAME_SPACE + 1); + memset(instance.namenode_name, 0, H5FD__HDFS_NODE_NAME_SPACE + 1); if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "namenode_port", "I"))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -486,14 +486,14 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs(JNIEnv *env, jclass clss, jlong fapl_id, if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config user_name not pinned"); - HDstrncpy(instance.user_name, str, H5FD__HDFS_USER_NAME_SPACE + 1); + strncpy(instance.user_name, str, H5FD__HDFS_USER_NAME_SPACE + 1); instance.user_name[H5FD__HDFS_USER_NAME_SPACE] = '\0'; UNPIN_JAVA_STRING(ENVONLY, j_str, str); str = NULL; } else - HDmemset(instance.user_name, 0, H5FD__HDFS_USER_NAME_SPACE + 1); + memset(instance.user_name, 0, H5FD__HDFS_USER_NAME_SPACE + 1); if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "kerberos_ticket_cache", "Ljava/lang/String;"))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -505,14 +505,14 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs(JNIEnv *env, jclass clss, jlong fapl_id, PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned"); - HDstrncpy(instance.kerberos_ticket_cache, str, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); + strncpy(instance.kerberos_ticket_cache, str, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); instance.kerberos_ticket_cache[H5FD__HDFS_KERB_CACHE_PATH_SPACE] = '\0'; UNPIN_JAVA_STRING(ENVONLY, j_str, str); str = NULL; } else - HDmemset(instance.kerberos_ticket_cache, 0, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); + memset(instance.kerberos_ticket_cache, 0, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "stream_buffer_size", "I"))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -607,7 +607,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jin UNUSED(clss); - HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char *)); + memset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char *)); if (memb_map) PIN_INT_ARRAY(ENVONLY, memb_map, themapArray, &isCopy, "H5Pset_fapl_multi: memb_map not pinned"); @@ -638,12 +638,12 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jin PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Pset_fapl_multi: string not pinned"); - str_len = HDstrlen(utf8); + str_len = strlen(utf8); - if (NULL == (member_name[i] = (char *)HDmalloc(str_len + 1))) + if (NULL == (member_name[i] = (char *)malloc(str_len + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed"); - HDstrncpy(member_name[i], utf8, str_len + 1); + strncpy(member_name[i], utf8, str_len + 1); (member_name[i])[str_len] = '\0'; UNPIN_JAVA_STRING(ENVONLY, obj, utf8); @@ -656,7 +656,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jin } if ((status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray, - mName, (const haddr_t *)theaddrArray, (hbool_t)relax)) < 0) + mName, (const haddr_t *)theaddrArray, (bool)relax)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (memb_name && mName) { @@ -692,7 +692,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jin ENVPTR->DeleteLocalRef(ENVONLY, o); ENVPTR->DeleteLocalRef(ENVONLY, rstring); - HDfree(member_name[i]); + free(member_name[i]); member_name[i] = NULL; } } @@ -700,7 +700,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jin done: for (i = 0; i < H5FD_MEM_NTYPES; i++) { if (member_name[i]) - HDfree(member_name[i]); + free(member_name[i]); } if (utf8) UNPIN_JAVA_STRING(ENVONLY, obj, utf8); @@ -741,11 +741,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jin if (memb_addr) PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pget_fapl_multi: memb_addr not pinned"); if (memb_name) - if (NULL == (mName = (char **)HDcalloc(H5FD_MEM_NTYPES, sizeof(*mName)))) + if (NULL == (mName = (char **)calloc(H5FD_MEM_NTYPES, sizeof(*mName)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_multi: memory allocation failed"); if ((status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t *)themapArray, (hid_t *)thefaplArray, mName, - (haddr_t *)theaddrArray, (hbool_t *)&relax)) < 0) + (haddr_t *)theaddrArray, (bool *)&relax)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (memb_name && mName) { @@ -862,7 +862,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3(JNIEnv *env, jclass clss, jlong fapl_id, UNUSED(clss); #ifdef H5_HAVE_ROS3_VFD - HDmemset(&instance, 0, sizeof(H5FD_ros3_fapl_t)); + memset(&instance, 0, sizeof(H5FD_ros3_fapl_t)); if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -882,14 +882,14 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3(JNIEnv *env, jclass clss, jlong fapl_id, if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config aws_region not pinned"); - HDstrncpy(instance.aws_region, str, H5FD_ROS3_MAX_REGION_LEN + 1); + strncpy(instance.aws_region, str, H5FD_ROS3_MAX_REGION_LEN + 1); instance.aws_region[H5FD_ROS3_MAX_REGION_LEN] = '\0'; UNPIN_JAVA_STRING(ENVONLY, j_str, str); str = NULL; } else - HDmemset(instance.aws_region, 0, H5FD_ROS3_MAX_REGION_LEN + 1); + memset(instance.aws_region, 0, H5FD_ROS3_MAX_REGION_LEN + 1); if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_id", "Ljava/lang/String;"))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -900,14 +900,14 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3(JNIEnv *env, jclass clss, jlong fapl_id, if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_id not pinned"); - HDstrncpy(instance.secret_id, str, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); + strncpy(instance.secret_id, str, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); instance.secret_id[H5FD_ROS3_MAX_SECRET_ID_LEN] = '\0'; UNPIN_JAVA_STRING(ENVONLY, j_str, str); str = NULL; } else - HDmemset(instance.secret_id, 0, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); + memset(instance.secret_id, 0, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_key", "Ljava/lang/String;"))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -918,17 +918,17 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3(JNIEnv *env, jclass clss, jlong fapl_id, if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_key not pinned"); - HDstrncpy(instance.secret_key, str, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); + strncpy(instance.secret_key, str, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); instance.secret_key[H5FD_ROS3_MAX_SECRET_KEY_LEN] = '\0'; UNPIN_JAVA_STRING(ENVONLY, j_str, str); str = NULL; } else - HDmemset(instance.secret_key, 0, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); + memset(instance.secret_key, 0, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); if (instance.aws_region[0] != '\0' && instance.secret_id[0] != '\0' && instance.secret_key[0] != '\0') - instance.authenticate = TRUE; + instance.authenticate = true; if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1327,14 +1327,14 @@ done: JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close(JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close) { - hbool_t evict_on_close_val = FALSE; - herr_t retVal = FAIL; + bool evict_on_close_val = false; + herr_t retVal = FAIL; UNUSED(clss); - evict_on_close_val = (evict_on_close == JNI_TRUE) ? TRUE : FALSE; + evict_on_close_val = (evict_on_close == JNI_TRUE) ? true : false; - if ((retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val)) < 0) + if ((retVal = H5Pset_evict_on_close((hid_t)fapl_id, (bool)evict_on_close_val)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -1349,15 +1349,15 @@ done: JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close(JNIEnv *env, jclass clss, jlong fapl_id) { - hbool_t evict_on_close_val = FALSE; + bool evict_on_close_val = false; jboolean bval = JNI_FALSE; UNUSED(clss); - if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0) + if (H5Pget_evict_on_close((hid_t)fapl_id, (bool *)&evict_on_close_val) < 0) H5_LIBRARY_ERROR(ENVONLY); - bval = (evict_on_close_val == TRUE) ? JNI_TRUE : JNI_FALSE; + bval = (evict_on_close_val == true) ? JNI_TRUE : JNI_FALSE; done: return bval; @@ -1372,13 +1372,13 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1file_1locking(JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking, jboolean ignore_when_disabled) { - hbool_t use_file_locking_val = TRUE; - hbool_t ignore_when_disabled_val = TRUE; + bool use_file_locking_val = true; + bool ignore_when_disabled_val = true; UNUSED(clss); - use_file_locking_val = (use_file_locking == JNI_TRUE) ? TRUE : FALSE; - ignore_when_disabled_val = (ignore_when_disabled == JNI_TRUE) ? TRUE : FALSE; + use_file_locking_val = (use_file_locking == JNI_TRUE) ? true : false; + ignore_when_disabled_val = (ignore_when_disabled == JNI_TRUE) ? true : false; if (H5Pset_file_locking((hid_t)fapl_id, use_file_locking_val, ignore_when_disabled_val) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1395,8 +1395,8 @@ done: JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking(JNIEnv *env, jclass clss, jlong fapl_id) { - hbool_t use_file_locking_val = TRUE; - hbool_t unused = TRUE; + bool use_file_locking_val = true; + bool unused = true; jboolean bval = JNI_FALSE; UNUSED(clss); @@ -1404,7 +1404,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking(JNIEnv *env, jclass clss, jlong f if (H5Pget_file_locking((hid_t)fapl_id, &use_file_locking_val, &unused) < 0) H5_LIBRARY_ERROR(ENVONLY); - bval = (use_file_locking_val == TRUE) ? JNI_TRUE : JNI_FALSE; + bval = (use_file_locking_val == true) ? JNI_TRUE : JNI_FALSE; done: return bval; @@ -1418,8 +1418,8 @@ done: JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking(JNIEnv *env, jclass clss, jlong fapl_id) { - hbool_t ignore_when_disabled_val = TRUE; - hbool_t unused = TRUE; + bool ignore_when_disabled_val = true; + bool unused = true; jboolean bval = JNI_FALSE; UNUSED(clss); @@ -1427,7 +1427,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking(JNIEnv *env, jclass if (H5Pget_file_locking((hid_t)fapl_id, &unused, &ignore_when_disabled_val) < 0) H5_LIBRARY_ERROR(ENVONLY); - bval = (ignore_when_disabled_val == TRUE) ? JNI_TRUE : JNI_FALSE; + bval = (ignore_when_disabled_val == true) ? JNI_TRUE : JNI_FALSE; done: return bval; @@ -1492,7 +1492,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config(JNIEnv *env, jclass clss, jlong plist, j UNUSED(clss); - HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t)); + memset(&cacheinfo, 0, sizeof(H5AC_cache_config_t)); if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, cache_config))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -1530,14 +1530,14 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config(JNIEnv *env, jclass clss, jlong plist, j if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_mdc_config: cache_config not pinned"); - HDstrncpy(cacheinfo.trace_file_name, str, H5AC__MAX_TRACE_FILE_NAME_LEN + 1); + strncpy(cacheinfo.trace_file_name, str, H5AC__MAX_TRACE_FILE_NAME_LEN + 1); cacheinfo.trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN] = '\0'; UNPIN_JAVA_STRING(ENVONLY, j_str, str); str = NULL; } else - HDmemset(cacheinfo.trace_file_name, 0, H5AC__MAX_TRACE_FILE_NAME_LEN + 1); + memset(cacheinfo.trace_file_name, 0, H5AC__MAX_TRACE_FILE_NAME_LEN + 1); if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "evictions_enabled", "Z"))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -1716,7 +1716,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config(JNIEnv *env, jclass clss, jlong plist) UNUSED(clss); - HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t)); + memset(&cacheinfo, 0, sizeof(H5AC_cache_config_t)); cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION; if ((status = H5Pget_mdc_config((hid_t)plist, &cacheinfo)) < 0) @@ -1794,8 +1794,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options(JNIEnv *env, jclass clss, jlong fa PIN_JAVA_STRING(ENVONLY, location, locStr, NULL, "H5Pset_mdc_log_options: location string not pinned"); - if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, locStr, - (hbool_t)start_on_access)) < 0) + if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (bool)is_enabled, locStr, (bool)start_on_access)) < + 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -1814,8 +1814,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options(JNIEnv *env, jclass clss, jlong fa { jboolean isCopy; jboolean *mdc_log_options_ptr = NULL; - hbool_t is_enabled; - hbool_t start_on_access; + bool is_enabled; + bool start_on_access; ssize_t status = -1; size_t location_size; jsize arrLen; @@ -1845,7 +1845,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options(JNIEnv *env, jclass clss, jlong fa H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: location_size is 0"); location_size++; /* add extra space for the null terminator */ - if (NULL == (lname = (char *)HDmalloc(sizeof(char) * location_size))) + if (NULL == (lname = (char *)malloc(sizeof(char) * location_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_log_options: memory allocation failed"); if ((status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, @@ -1865,7 +1865,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options(JNIEnv *env, jclass clss, jlong fa done: if (lname) - HDfree(lname); + free(lname); if (mdc_log_options_ptr) UNPIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, (status < 0) ? JNI_ABORT : 0); diff --git a/java/src/jni/h5pFCPLImp.c b/java/src/jni/h5pFCPLImp.c index 72c8869..9e6845d 100644 --- a/java/src/jni/h5pFCPLImp.c +++ b/java/src/jni/h5pFCPLImp.c @@ -294,7 +294,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy(JNIEnv *env, jclass clss, jlon { UNUSED(clss); - if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist, + if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (bool)persist, (hsize_t)threshold) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -325,7 +325,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy(JNIEnv *env, jclass clss, jlon PIN_LONG_ARRAY(ENVONLY, threshold, thresholdArray, &isCopy, "H5Pget_file_space: threshold not pinned"); - if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t *)persistArray, + if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (bool *)persistArray, (hsize_t *)thresholdArray)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -346,8 +346,8 @@ done: JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist(JNIEnv *env, jclass clss, jlong fcpl_id) { - hbool_t persist = FALSE; - herr_t status = FAIL; + bool persist = false; + herr_t status = FAIL; UNUSED(clss); diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c index 81d99fa..2bf2812 100644 --- a/java/src/jni/h5pLAPLImp.c +++ b/java/src/jni/h5pLAPLImp.c @@ -128,7 +128,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_i if ((prefix_size = H5Pget_elink_prefix((hid_t)lapl_id, (char *)NULL, size)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (pre = (char *)HDmalloc(sizeof(char) * (size_t)prefix_size + 1))) + if (NULL == (pre = (char *)malloc(sizeof(char) * (size_t)prefix_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_elink_prefix: memory allocation failed"); if (H5Pget_elink_prefix((hid_t)lapl_id, (char *)pre, (size_t)prefix_size + 1) < 0) @@ -146,7 +146,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_i done: if (pre) - HDfree(pre); + free(pre); return (jlong)prefix_size; } /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix */ diff --git a/java/src/jni/h5pOCPLImp.c b/java/src/jni/h5pOCPLImp.c index e287962..432fbbb 100644 --- a/java/src/jni/h5pOCPLImp.c +++ b/java/src/jni/h5pOCPLImp.c @@ -77,11 +77,11 @@ done: JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid, jboolean track_times) { - hbool_t track = FALSE; + bool track = false; UNUSED(clss); - track = (JNI_TRUE == track_times) ? 1 : 0; + track = (JNI_TRUE == track_times) ? true : false; if (H5Pset_obj_track_times((hid_t)objplid, track) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -98,7 +98,7 @@ done: JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid) { - hbool_t track_times = FALSE; + bool track_times = false; jboolean retVal = JNI_FALSE; UNUSED(clss); @@ -106,7 +106,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times(JNIEnv *env, jclass clss, jlong ob if (H5Pget_obj_track_times((hid_t)objplid, &track_times) < 0) H5_LIBRARY_ERROR(ENVONLY); - retVal = (track_times == TRUE) ? JNI_TRUE : JNI_FALSE; + retVal = (track_times == true) ? JNI_TRUE : JNI_FALSE; done: return retVal; diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index 2324402..9283777 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -216,7 +216,7 @@ Java_hdf_hdf5lib_H5_H5PLget(JNIEnv *env, jclass clss, jint idx) if ((buf_size = H5PLget((unsigned)idx, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (aName = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer"); if ((H5PLget((unsigned)idx, aName, (size_t)buf_size + 1)) < 0) @@ -228,7 +228,7 @@ Java_hdf_hdf5lib_H5_H5PLget(JNIEnv *env, jclass clss, jint idx) done: if (aName) - HDfree(aName); + free(aName); return str; } /* end Java_hdf_hdf5lib_H5_H5PLget */ diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index 7b81e80..0e26f2a 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -47,7 +47,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1object(JNIEnv *env, jclass clss, jlong loc_id, js PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_object: reference name not pinned"); - if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) + if (NULL == (refBuf = calloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_object: failed to allocate reference buffer"); H5R_ref_t loc_ref; @@ -55,7 +55,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1object(JNIEnv *env, jclass clss, jlong loc_id, js H5_LIBRARY_ERROR(ENVONLY); HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(refBuf, &loc_ref, H5R_REF_BUF_SIZE); + memcpy(refBuf, &loc_ref, H5R_REF_BUF_SIZE); if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -67,7 +67,7 @@ done: if (refName) UNPIN_JAVA_STRING(ENVONLY, name, refName); if (refBuf) - HDfree(refBuf); + free(refBuf); return ref; } /* end Java_hdf_hdf5lib_H5_H5Rcreate_1object */ @@ -93,7 +93,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1region(JNIEnv *env, jclass clss, jlong loc_id, js PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_region: reference name not pinned"); - if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) + if (NULL == (refBuf = calloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_region: failed to allocate reference buffer"); H5R_ref_t loc_ref; @@ -101,7 +101,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1region(JNIEnv *env, jclass clss, jlong loc_id, js H5_LIBRARY_ERROR(ENVONLY); HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(refBuf, &loc_ref, H5R_REF_BUF_SIZE); + memcpy(refBuf, &loc_ref, H5R_REF_BUF_SIZE); if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -113,7 +113,7 @@ done: if (refName) UNPIN_JAVA_STRING(ENVONLY, name, refName); if (refBuf) - HDfree(refBuf); + free(refBuf); return ref; } /* end Java_hdf_hdf5lib_H5_H5Rcreate_1region */ @@ -144,7 +144,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1attr(JNIEnv *env, jclass clss, jlong loc_id, jstr PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_attr: reference name not pinned"); - if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) + if (NULL == (refBuf = calloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate reference buffer"); H5R_ref_t loc_ref; @@ -152,7 +152,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1attr(JNIEnv *env, jclass clss, jlong loc_id, jstr H5_LIBRARY_ERROR(ENVONLY); HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(refBuf, &loc_ref, H5R_REF_BUF_SIZE); + memcpy(refBuf, &loc_ref, H5R_REF_BUF_SIZE); if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -166,7 +166,7 @@ done: if (refName) UNPIN_JAVA_STRING(ENVONLY, name, refName); if (refBuf) - HDfree(refBuf); + free(refBuf); return ref; } /* end Java_hdf_hdf5lib_H5_H5Rcreate_1attr */ @@ -199,7 +199,7 @@ Java_hdf_hdf5lib_H5_H5Rdestroy(JNIEnv *env, jclass clss, jbyteArray ref) H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); if ((status = H5Rdestroy(&loc_ref)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -237,7 +237,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1type(JNIEnv *env, jclass clss, jbyteArray ref) H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); if ((ref_type = H5Rget_type(&loc_ref)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -289,8 +289,8 @@ Java_hdf_hdf5lib_H5_H5Requal(JNIEnv *env, jclass clss, jbyteArray ref1, jbyteArr H5R_ref_t loc_ref1, loc_ref2; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref1, refBuf1, H5R_REF_BUF_SIZE); - HDmemcpy(&loc_ref2, refBuf2, H5R_REF_BUF_SIZE); + memcpy(&loc_ref1, refBuf1, H5R_REF_BUF_SIZE); + memcpy(&loc_ref2, refBuf2, H5R_REF_BUF_SIZE); if ((bval = H5Requal(&loc_ref1, &loc_ref2)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -334,19 +334,19 @@ Java_hdf_hdf5lib_H5_H5Rcopy(JNIEnv *env, jclass clss, jbyteArray src_ref) PIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, &isCopy, "H5Rcopy: src reference buffer not pinned"); - if (NULL == (dst_refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) + if (NULL == (dst_refBuf = calloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate dst reference buffer"); H5R_ref_t loc_src_ref, loc_dst_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_src_ref, src_refBuf, H5R_REF_BUF_SIZE); - HDmemcpy(&loc_dst_ref, dst_refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_src_ref, src_refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_dst_ref, dst_refBuf, H5R_REF_BUF_SIZE); if ((status = H5Rcopy(&loc_src_ref, &loc_dst_ref)) < 0) H5_LIBRARY_ERROR(ENVONLY); - HDmemcpy(dst_refBuf, &loc_dst_ref, H5R_REF_BUF_SIZE); + memcpy(dst_refBuf, &loc_dst_ref, H5R_REF_BUF_SIZE); if (NULL == (dst_ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -358,7 +358,7 @@ done: if (src_refBuf) UNPIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, (status < 0) ? JNI_ABORT : 0); if (dst_refBuf) - HDfree(dst_refBuf); + free(dst_refBuf); return dst_ref; } /* end Java_hdf_hdf5lib_H5_H5Rcopy */ @@ -391,7 +391,7 @@ Java_hdf_hdf5lib_H5__1H5Ropen_1object(JNIEnv *env, jclass clss, jbyteArray ref, H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); if ((retVal = H5Ropen_object(&loc_ref, (hid_t)rapl_id, (hid_t)oapl_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -431,7 +431,7 @@ Java_hdf_hdf5lib_H5__1H5Ropen_1region(JNIEnv *env, jclass clss, jbyteArray ref, H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); if ((retVal = H5Ropen_region(&loc_ref, (hid_t)rapl_id, (hid_t)oapl_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -471,7 +471,7 @@ Java_hdf_hdf5lib_H5__1H5Ropen_1attr(JNIEnv *env, jclass clss, jbyteArray ref, jl H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); if ((retVal = H5Ropen_attr(&loc_ref, (hid_t)rapl_id, (hid_t)aapl_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -506,7 +506,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3(JNIEnv *env, jclass clss, jbyteArray ref, H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); if ((retVal = H5Rget_obj_type3(&loc_ref, (hid_t)rapl_id, &object_info)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -546,13 +546,13 @@ Java_hdf_hdf5lib_H5_H5Rget_1file_1name(JNIEnv *env, jclass clss, jbyteArray ref) H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); /* Get the length of the name */ if ((buf_size = H5Rget_file_name(&loc_ref, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (namePtr = HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (namePtr = malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_file_name: malloc failed"); if ((check_size = H5Rget_file_name(&loc_ref, namePtr, (size_t)buf_size + 1)) < 0) @@ -564,7 +564,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1file_1name(JNIEnv *env, jclass clss, jbyteArray ref) done: if (namePtr) - HDfree(namePtr); + free(namePtr); if (refBuf) UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0); @@ -596,13 +596,13 @@ Java_hdf_hdf5lib_H5_H5Rget_1obj_1name(JNIEnv *env, jclass clss, jbyteArray ref, H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); /* Get the length of the name */ if ((buf_size = H5Rget_obj_name(&loc_ref, (hid_t)rapl_id, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (namePtr = HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (namePtr = malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_obj_name: malloc failed"); if ((check_size = H5Rget_obj_name(&loc_ref, (hid_t)rapl_id, namePtr, (size_t)buf_size + 1)) < 0) @@ -614,7 +614,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1obj_1name(JNIEnv *env, jclass clss, jbyteArray ref, done: if (namePtr) - HDfree(namePtr); + free(namePtr); if (refBuf) UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0); @@ -646,13 +646,13 @@ Java_hdf_hdf5lib_H5_H5Rget_1attr_1name(JNIEnv *env, jclass clss, jbyteArray ref) H5R_ref_t loc_ref; HDcompile_assert(H5R_REF_BUF_SIZE <= sizeof(H5R_ref_t)); - HDmemcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); + memcpy(&loc_ref, refBuf, H5R_REF_BUF_SIZE); /* Get the length of the name */ if ((buf_size = H5Rget_attr_name(&loc_ref, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (namePtr = HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (namePtr = malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_attr_name: malloc failed"); if ((check_size = H5Rget_attr_name(&loc_ref, namePtr, (size_t)buf_size + 1)) < 0) @@ -664,7 +664,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1attr_1name(JNIEnv *env, jclass clss, jbyteArray ref) done: if (namePtr) - HDfree(namePtr); + free(namePtr); if (refBuf) UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0); @@ -921,7 +921,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *env, jclass clss, jlong loc_id, jint re PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_name: reference buffer not pinned"); - if (NULL == (aName = HDmalloc(sizeof(char) * (size_t)size + 1))) + if (NULL == (aName = malloc(sizeof(char) * (size_t)size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer"); if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, (size_t)size + 1)) < @@ -937,7 +937,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *env, jclass clss, jlong loc_id, jint re done: if (aName) - HDfree(aName); + free(aName); if (refBuf) UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, JNI_ABORT); @@ -985,7 +985,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1name_1string(JNIEnv *env, jclass clss, jlong loc_id, if ((buf_size = H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (aName = HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (aName = malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer"); if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, @@ -998,7 +998,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1name_1string(JNIEnv *env, jclass clss, jlong loc_id, done: if (aName) - HDfree(aName); + free(aName); if (refBuf) UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, JNI_ABORT); diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index ca1f75c..f0103ed 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -95,7 +95,7 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *env, jclass clss, jint rank, jlo PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Screate_simple: dims not pinned"); - if (NULL == (sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (sa = lp = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer"); jlp = (jlong *)dimsP; @@ -112,7 +112,7 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *env, jclass clss, jint rank, jlo else { PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Screate_simple: maxdims not pinned"); - if (NULL == (msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (msa = lp = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer"); jlp = (jlong *)maxdimsP; @@ -128,11 +128,11 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *env, jclass clss, jint rank, jlo done: if (msa) - HDfree(msa); + free(msa); if (maxdimsP) UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, JNI_ABORT); if (sa) - HDfree(sa); + free(sa); if (dimsP) UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, JNI_ABORT); @@ -191,7 +191,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id PIN_LONG_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned"); - if (NULL == (sa = (hssize_t *)HDmalloc((size_t)num_elemn * 2 * sizeof(hssize_t)))) + if (NULL == (sa = (hssize_t *)malloc((size_t)num_elemn * 2 * sizeof(hssize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); for (i = 0; i < (num_elemn * 2); i++) { @@ -203,7 +203,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id done: if (sa) - HDfree(sa); + free(sa); if (P) UNPIN_LONG_ARRAY(ENVONLY, coords, P, JNI_ABORT); @@ -244,7 +244,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id nlongs = (int)((size_t)size / sizeof(jlong)); - if (NULL == (lp = (hsize_t *)HDmalloc((size_t)nlongs * sizeof(hsize_t)))) + if (NULL == (lp = (hsize_t *)malloc((size_t)nlongs * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); jlp = (jlong *)P; @@ -261,7 +261,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id done: if (llp) - HDfree(llp); + free(llp); if (P) UNPIN_BYTE_ARRAY(ENVONLY, coords, P, JNI_ABORT); @@ -435,7 +435,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *env, jclass clss, jlong H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: dims array length < 0"); } - if (NULL == (sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (sa = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer"); } @@ -456,7 +456,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *env, jclass clss, jlong else if (mrank != rank) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims"); - if (NULL == (msa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (msa = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer"); } @@ -478,11 +478,11 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *env, jclass clss, jlong done: if (msa) - HDfree(msa); + free(msa); if (maxdimsP) UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, (status < 0) ? JNI_ABORT : 0); if (sa) - HDfree(sa); + free(sa); if (dimsP) UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (status < 0) ? JNI_ABORT : 0); @@ -555,7 +555,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *env, jclass clss, jlong space PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sset_extent_simple: dims not pinned"); - if (NULL == (sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (sa = lp = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer"); jlp = (jlong *)dimsP; @@ -572,7 +572,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *env, jclass clss, jlong space else { PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sset_extent_simple: maxdims not pinned"); - if (NULL == (msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (msa = lp = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate maximum dimension buffer"); @@ -589,11 +589,11 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *env, jclass clss, jlong space done: if (msa) - HDfree(msa); + free(msa); if (maxdimsP) UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, JNI_ABORT); if (sa) - HDfree(sa); + free(sa); if (dimsP) UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, JNI_ABORT); @@ -650,7 +650,7 @@ Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *env, jclass clss, jlong space_id, rank = (size_t)i / sizeof(jlong); - if (NULL == (sa = lp = (hssize_t *)HDmalloc((size_t)rank * sizeof(hssize_t)))) + if (NULL == (sa = lp = (hssize_t *)malloc((size_t)rank * sizeof(hssize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer"); jlp = (jlong *)P; @@ -670,7 +670,7 @@ Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *env, jclass clss, jlong space_id, done: if (sa) - HDfree(sa); + free(sa); if (P) UNPIN_BYTE_ARRAY(ENVONLY, offset, P, JNI_ABORT); @@ -775,7 +775,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_i PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_hyperslab: start not pinned"); - if (NULL == (strt = lp = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t)))) + if (NULL == (strt = lp = (hsize_t *)malloc((size_t)start_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer"); jlp = (jlong *)startP; @@ -787,7 +787,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_i PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sselect_hyperslab: count not pinned"); - if (NULL == (cnt = lp = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t)))) + if (NULL == (cnt = lp = (hsize_t *)malloc((size_t)count_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer"); jlp = (jlong *)countP; @@ -812,7 +812,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_i PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sselect_hyperslab: stride not pinned"); - if (NULL == (strd = lp = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) + if (NULL == (strd = lp = (hsize_t *)malloc((size_t)stride_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer"); jlp = (jlong *)strideP; @@ -838,7 +838,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_i PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sselect_hyperslab: block not pinned"); - if (NULL == (blk = lp = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t)))) + if (NULL == (blk = lp = (hsize_t *)malloc((size_t)block_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer"); jlp = (jlong *)blockP; @@ -855,19 +855,19 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_i done: if (blk) - HDfree(blk); + free(blk); if (blockP) UNPIN_LONG_ARRAY(ENVONLY, block, blockP, JNI_ABORT); if (strd) - HDfree(strd); + free(strd); if (strideP) UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, JNI_ABORT); if (cnt) - HDfree(cnt); + free(cnt); if (countP) UNPIN_LONG_ARRAY(ENVONLY, count, countP, JNI_ABORT); if (strt) - HDfree(strt); + free(strt); if (startP) UNPIN_LONG_ARRAY(ENVONLY, start, startP, JNI_ABORT); @@ -972,7 +972,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist(JNIEnv *env, jclass clss, j PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_hyper_blocklist: buffer not pinned"); buf_size = (size_t)numblocks * (size_t)2 * (size_t)rank * sizeof(hsize_t); - if (NULL == (ba = (hsize_t *)HDmalloc(buf_size))) + if (NULL == (ba = (hsize_t *)malloc(buf_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: failed to allocate block list buffer"); @@ -986,7 +986,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist(JNIEnv *env, jclass clss, j done: if (ba) - HDfree(ba); + free(ba); if (bufP) UNPIN_LONG_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0); @@ -1030,7 +1030,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist(JNIEnv *env, jclass clss, jl PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_elem_pointlist: buffer not pinned"); - if (NULL == (ba = (hsize_t *)HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t)))) + if (NULL == (ba = (hsize_t *)malloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer"); if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints, @@ -1043,7 +1043,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist(JNIEnv *env, jclass clss, jl done: if (ba) - HDfree(ba); + free(ba); if (bufP) UNPIN_LONG_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0); @@ -1081,12 +1081,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds(JNIEnv *env, jclass clss, jlong space H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: start array length < 0"); } - if (NULL == (strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer"); PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sget_select_bounds: end not pinned"); - if (NULL == (en = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (en = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer"); if ((status = H5Sget_select_bounds((hid_t)spaceid, (hsize_t *)strt, (hsize_t *)en)) < 0) @@ -1099,11 +1099,11 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds(JNIEnv *env, jclass clss, jlong space done: if (en) - HDfree(en); + free(en); if (endP) UNPIN_LONG_ARRAY(ENVONLY, end, endP, (status < 0) ? JNI_ABORT : 0); if (strt) - HDfree(strt); + free(strt); if (startP) UNPIN_LONG_ARRAY(ENVONLY, start, startP, (status < 0) ? JNI_ABORT : 0); @@ -1134,7 +1134,7 @@ Java_hdf_hdf5lib_H5_H5Sencode(JNIEnv *env, jclass clss, jlong obj_id) if (buf_size == 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: buf_size = 0"); - if (NULL == (bufPtr = (unsigned char *)HDcalloc((size_t)1, buf_size))) + if (NULL == (bufPtr = (unsigned char *)calloc((size_t)1, buf_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer"); if ((status = H5Sencode2((hid_t)obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0) @@ -1148,7 +1148,7 @@ Java_hdf_hdf5lib_H5_H5Sencode(JNIEnv *env, jclass clss, jlong obj_id) done: if (bufPtr) - HDfree(bufPtr); + free(bufPtr); return returnedArray; } /* end Java_hdf_hdf5lib_H5_H5Sencode */ @@ -1243,7 +1243,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong s PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_regular_hyperslab: start not pinned"); - if (NULL == (strt = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t)))) + if (NULL == (strt = (hsize_t *)malloc((size_t)start_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer"); } @@ -1263,7 +1263,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong s PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sget_regular_hyperslab: stride not pinned"); - if (NULL == (strd = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) + if (NULL == (strd = (hsize_t *)malloc((size_t)stride_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer"); } @@ -1283,7 +1283,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong s PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sget_regular_hyperslab: count not pinned"); - if (NULL == (cnt = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t)))) + if (NULL == (cnt = (hsize_t *)malloc((size_t)count_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer"); } @@ -1303,7 +1303,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong s PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sget_regular_hyperslab: block not pinned"); - if (NULL == (blk = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t)))) + if (NULL == (blk = (hsize_t *)malloc((size_t)block_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer"); } @@ -1320,19 +1320,19 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong s done: if (blk) - HDfree(blk); + free(blk); if (blockP) UNPIN_LONG_ARRAY(ENVONLY, block, blockP, (status < 0) ? JNI_ABORT : 0); if (cnt) - HDfree(cnt); + free(cnt); if (countP) UNPIN_LONG_ARRAY(ENVONLY, count, countP, (status < 0) ? JNI_ABORT : 0); if (strd) - HDfree(strd); + free(strd); if (strideP) UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, (status < 0) ? JNI_ABORT : 0); if (strt) - HDfree(strt); + free(strt); if (startP) UNPIN_LONG_ARRAY(ENVONLY, start, startP, (status < 0) ? JNI_ABORT : 0); @@ -1417,7 +1417,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1adjust(JNIEnv *env, jclass clss, jlong space_id, PIN_LONG_ARRAY(ENVONLY, offset, offsetP, &isCopy, "H5Sselect_adjust: offset not pinned"); - if (NULL == (offst = (hssize_t *)HDmalloc((size_t)offset_rank * sizeof(hsize_t)))) + if (NULL == (offst = (hssize_t *)malloc((size_t)offset_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_adjust: failed to allocate offset buffer"); } @@ -1430,7 +1430,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1adjust(JNIEnv *env, jclass clss, jlong space_id, done: if (offst) - HDfree(offst); + free(offst); if (offsetP) UNPIN_LONG_ARRAY(ENVONLY, offset, offsetP, (status < 0) ? JNI_ABORT : 0); @@ -1477,7 +1477,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1intersect_1block(JNIEnv *env, jclass clss, jlong PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_intersect_block: start not pinned"); - if (NULL == (strt = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t)))) + if (NULL == (strt = (hsize_t *)malloc((size_t)start_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_intersect_block: failed to allocate start buffer"); } @@ -1497,7 +1497,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1intersect_1block(JNIEnv *env, jclass clss, jlong PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sselect_intersect_block: end not pinned"); - if (NULL == (nd = (hsize_t *)HDmalloc((size_t)end_rank * sizeof(hsize_t)))) + if (NULL == (nd = (hsize_t *)malloc((size_t)end_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_intersect_block: failed to allocate end buffer"); } @@ -1513,11 +1513,11 @@ Java_hdf_hdf5lib_H5_H5Sselect_1intersect_1block(JNIEnv *env, jclass clss, jlong done: if (strt) - HDfree(strt); + free(strt); if (startP) UNPIN_LONG_ARRAY(ENVONLY, start, startP, (bval < 0) ? JNI_ABORT : 0); if (nd) - HDfree(nd); + free(nd); if (endP) UNPIN_LONG_ARRAY(ENVONLY, end, endP, (bval < 0) ? JNI_ABORT : 0); @@ -1584,7 +1584,7 @@ Java_hdf_hdf5lib_H5_H5Scombine_1hyperslab(JNIEnv *env, jclass clss, jlong space_ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Scombine_hyperslab: start not pinned"); - if (NULL == (strt = lp = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t)))) + if (NULL == (strt = lp = (hsize_t *)malloc((size_t)start_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate start buffer"); jlp = (jlong *)startP; @@ -1596,7 +1596,7 @@ Java_hdf_hdf5lib_H5_H5Scombine_1hyperslab(JNIEnv *env, jclass clss, jlong space_ PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Scombine_hyperslab: count not pinned"); - if (NULL == (cnt = lp = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t)))) + if (NULL == (cnt = lp = (hsize_t *)malloc((size_t)count_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate count buffer"); jlp = (jlong *)countP; @@ -1621,7 +1621,7 @@ Java_hdf_hdf5lib_H5_H5Scombine_1hyperslab(JNIEnv *env, jclass clss, jlong space_ PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Scombine_hyperslab: stride not pinned"); - if (NULL == (strd = lp = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) + if (NULL == (strd = lp = (hsize_t *)malloc((size_t)stride_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate stride buffer"); jlp = (jlong *)strideP; @@ -1647,7 +1647,7 @@ Java_hdf_hdf5lib_H5_H5Scombine_1hyperslab(JNIEnv *env, jclass clss, jlong space_ PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Scombine_hyperslab: block not pinned"); - if (NULL == (blk = lp = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t)))) + if (NULL == (blk = lp = (hsize_t *)malloc((size_t)block_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate block buffer"); jlp = (jlong *)blockP; @@ -1664,19 +1664,19 @@ Java_hdf_hdf5lib_H5_H5Scombine_1hyperslab(JNIEnv *env, jclass clss, jlong space_ done: if (blk) - HDfree(blk); + free(blk); if (blockP) UNPIN_LONG_ARRAY(ENVONLY, block, blockP, JNI_ABORT); if (strd) - HDfree(strd); + free(strd); if (strideP) UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, JNI_ABORT); if (cnt) - HDfree(cnt); + free(cnt); if (countP) UNPIN_LONG_ARRAY(ENVONLY, count, countP, JNI_ABORT); if (strt) - HDfree(strt); + free(strt); if (startP) UNPIN_LONG_ARRAY(ENVONLY, start, startP, JNI_ABORT); diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index b4fc817..60de0c3 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -1189,7 +1189,7 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int(JNIEnv *env, jclass clss, jlong type_id if (size <= 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof_int: name size < 0"); - if (NULL == (nameP = (char *)HDmalloc(sizeof(char) * (size_t)size))) + if (NULL == (nameP = (char *)malloc(sizeof(char) * (size_t)size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof_int: failed to allocate name buffer"); PIN_INT_ARRAY(ENVONLY, value, intP, &isCopy, "H5Tenum_nameof_int: value not pinned"); @@ -1208,7 +1208,7 @@ done: if (intP) UNPIN_INT_ARRAY(ENVONLY, value, intP, JNI_ABORT); if (nameP) - HDfree(nameP); + free(nameP); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int */ @@ -1234,7 +1234,7 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof(JNIEnv *env, jclass clss, jlong type_id, jby if (NULL == value) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: value is NULL"); - if (NULL == (nameP = (char *)HDmalloc(sizeof(char) * (size_t)size))) + if (NULL == (nameP = (char *)malloc(sizeof(char) * (size_t)size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof: failed to allocate name buffer"); PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Tenum_nameof: value not pinned"); @@ -1250,7 +1250,7 @@ done: if (byteP) UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, JNI_ABORT); if (nameP) - HDfree(nameP); + free(nameP); return str; } /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof */ @@ -1432,7 +1432,7 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims(JNIEnv *env, jclass clss, jlong type_id, H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_array_dims: dims array length < 0"); } - if (NULL == (cdims = (hsize_t *)HDmalloc((size_t)dlen * sizeof(hsize_t)))) + if (NULL == (cdims = (hsize_t *)malloc((size_t)dlen * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tget_array_dims: failed to allocate dimension buffer"); if ((ndims = H5Tget_array_dims2((hid_t)type_id, cdims)) < 0) @@ -1444,7 +1444,7 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims(JNIEnv *env, jclass clss, jlong type_id, done: if (cdims) - HDfree(cdims); + free(cdims); if (dimsP) UNPIN_INT_ARRAY(ENVONLY, dims, dimsP, (ndims < 0) ? JNI_ABORT : 0); @@ -1572,7 +1572,7 @@ Java_hdf_hdf5lib_H5__1H5Tarray_1create2(JNIEnv *env, jclass clss, jlong base_id, if (dlen != rank) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dimension array length != array rank"); - if (NULL == (cdims = (hsize_t *)HDmalloc((size_t)dlen * sizeof(hsize_t)))) + if (NULL == (cdims = (hsize_t *)malloc((size_t)dlen * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_create: failed to allocate dimension buffer"); for (i = 0; i < (size_t)dlen; i++) { @@ -1584,7 +1584,7 @@ Java_hdf_hdf5lib_H5__1H5Tarray_1create2(JNIEnv *env, jclass clss, jlong base_id, done: if (cdims) - HDfree(cdims); + free(cdims); if (dimsP) UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (retVal < 0) ? JNI_ABORT : 0); @@ -1618,7 +1618,7 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2(JNIEnv *env, jclass clss, jlong type_id H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_get_dims2: dims array length < 0"); } - if (NULL == (cdims = (hsize_t *)HDmalloc((size_t)dlen * sizeof(hsize_t)))) + if (NULL == (cdims = (hsize_t *)malloc((size_t)dlen * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_get_dims2: failed to allocate dimension buffer"); if ((ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t *)cdims)) < 0) @@ -1630,7 +1630,7 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2(JNIEnv *env, jclass clss, jlong type_id done: if (cdims) - HDfree(cdims); + free(cdims); if (dimsP) UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (ndims < 0) ? JNI_ABORT : 0); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 56708a8..9f0117a 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -98,10 +98,10 @@ h5str_array_free(char **strs, size_t len) for (i = 0; i < len; i++) { if (strs[i]) - HDfree(strs[i]); + free(strs[i]); } /* for (i=0; i 0) { - str->s = (char *)HDmalloc(len); + str->s = (char *)malloc(len); str->max = len; str->s[0] = '\0'; } /* end if */ @@ -120,8 +120,8 @@ void h5str_free(h5str_t *str) { if (str && str->max > 0) { - HDfree(str->s); - HDmemset(str, 0, sizeof(h5str_t)); + free(str->s); + memset(str, 0, sizeof(h5str_t)); } /* end if */ } /* end h5str_free */ @@ -137,15 +137,15 @@ h5str_resize(h5str_t *str, size_t new_len) if (!str || new_len <= 0 || str->max == new_len) return; - if (NULL == (new_str = (char *)HDmalloc(new_len))) + if (NULL == (new_str = (char *)malloc(new_len))) return; if (new_len > str->max) /* increase memory */ - HDstrcpy(new_str, str->s); + strcpy(new_str, str->s); else - HDstrncpy(new_str, str->s, new_len - 1); + strncpy(new_str, str->s, new_len - 1); - HDfree(str->s); + free(str->s); str->s = new_str; str->max = new_len; } /* end h5str_resize */ @@ -164,13 +164,13 @@ h5str_append(h5str_t *str, const char *cstr) else if (!cstr) return str->s; - len = HDstrlen(str->s) + HDstrlen(cstr); + len = strlen(str->s) + strlen(cstr); while (len >= str->max) /* not enough to hold the new string, double the space */ { h5str_resize(str, str->max * 2); } - return HDstrcat(str->s, cstr); + return strcat(str->s, cstr); } /* end h5str_append */ /* @@ -213,38 +213,38 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ /* Build default formats for long long types */ if (!fmt_llong[0]) { - if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%lld") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsnprintf failure"); - if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsnprintf failure"); + if (snprintf(fmt_llong, sizeof(fmt_llong), "%%lld") < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: snprintf failure"); + if (snprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu") < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: snprintf failure"); } /* end if */ switch (tclass) { case H5T_FLOAT: { - token = HDstrtok(this_str, delimiter); + token = strtok(this_str, delimiter); switch (typeSize) { case sizeof(float): { float tmp_float = 0.0f; - HDsscanf(token, "%f", &tmp_float); - HDmemcpy(cptr, &tmp_float, sizeof(float)); + sscanf(token, "%f", &tmp_float); + memcpy(cptr, &tmp_float, sizeof(float)); break; } case sizeof(double): { double tmp_double = 0.0; - HDsscanf(token, "%lf", &tmp_double); - HDmemcpy(cptr, &tmp_double, sizeof(double)); + sscanf(token, "%lf", &tmp_double); + memcpy(cptr, &tmp_double, sizeof(double)); break; } #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE case sizeof(long double): { long double tmp_ldouble = 0.0; - HDsscanf(token, "%Lg", &tmp_ldouble); - HDmemcpy(cptr, &tmp_ldouble, sizeof(long double)); + sscanf(token, "%Lg", &tmp_ldouble); + memcpy(cptr, &tmp_ldouble, sizeof(long double)); break; } #endif @@ -262,10 +262,10 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ } case H5T_STRING: { - size_t len = HDstrlen(this_str); + size_t len = strlen(this_str); if (len > 0) { - HDstrncpy(cptr, this_str, typeSize); + strncpy(cptr, this_str, typeSize); cptr[typeSize - 1] = '\0'; retVal = typeSize; @@ -283,7 +283,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid))) H5_LIBRARY_ERROR(ENVONLY); - token = HDstrtok(this_str, delimiter); + token = strtok(this_str, delimiter); switch (typeSize) { case sizeof(char): { @@ -291,12 +291,12 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ signed char tmp_char = 0; if (H5T_SGN_NONE == nsign) { - HDsscanf(token, "%hhu", &tmp_uchar); - HDmemcpy(cptr, &tmp_uchar, sizeof(unsigned char)); + sscanf(token, "%hhu", &tmp_uchar); + memcpy(cptr, &tmp_uchar, sizeof(unsigned char)); } else { - HDsscanf(token, "%hhd", &tmp_char); - HDmemcpy(cptr, &tmp_char, sizeof(char)); + sscanf(token, "%hhd", &tmp_char); + memcpy(cptr, &tmp_char, sizeof(char)); } break; @@ -307,12 +307,12 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ short tmp_short = 0; if (H5T_SGN_NONE == nsign) { - HDsscanf(token, "%hu", &tmp_ushort); - HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short)); + sscanf(token, "%hu", &tmp_ushort); + memcpy(&tmp_ushort, cptr, sizeof(unsigned short)); } else { - HDsscanf(token, "%hd", &tmp_short); - HDmemcpy(&tmp_short, cptr, sizeof(short)); + sscanf(token, "%hd", &tmp_short); + memcpy(&tmp_short, cptr, sizeof(short)); } break; @@ -323,12 +323,12 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ int tmp_int = 0; if (H5T_SGN_NONE == nsign) { - HDsscanf(token, "%u", &tmp_uint); - HDmemcpy(cptr, &tmp_uint, sizeof(unsigned int)); + sscanf(token, "%u", &tmp_uint); + memcpy(cptr, &tmp_uint, sizeof(unsigned int)); } else { - HDsscanf(token, "%d", &tmp_int); - HDmemcpy(cptr, &tmp_int, sizeof(int)); + sscanf(token, "%d", &tmp_int); + memcpy(cptr, &tmp_int, sizeof(int)); } break; @@ -340,12 +340,12 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ long tmp_long = 0; if (H5T_SGN_NONE == nsign) { - HDsscanf(token, "%lu", &tmp_ulong); - HDmemcpy(cptr, &tmp_ulong, sizeof(unsigned long)); + sscanf(token, "%lu", &tmp_ulong); + memcpy(cptr, &tmp_ulong, sizeof(unsigned long)); } else { - HDsscanf(token, "%ld", &tmp_long); - HDmemcpy(cptr, &tmp_long, sizeof(long)); + sscanf(token, "%ld", &tmp_long); + memcpy(cptr, &tmp_long, sizeof(long)); } break; @@ -357,12 +357,12 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ long long tmp_llong = 0; if (H5T_SGN_NONE == nsign) { - HDsscanf(token, fmt_ullong, &tmp_ullong); - HDmemcpy(cptr, &tmp_ullong, sizeof(unsigned long long)); + sscanf(token, fmt_ullong, &tmp_ullong); + memcpy(cptr, &tmp_ullong, sizeof(unsigned long long)); } else { - HDsscanf(token, fmt_llong, &tmp_llong); - HDmemcpy(cptr, &tmp_llong, sizeof(long long)); + sscanf(token, fmt_llong, &tmp_llong); + memcpy(cptr, &tmp_llong, sizeof(long long)); } break; @@ -449,7 +449,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ unsigned long long tmp_ullong = 0; #endif - token = HDstrtok(this_str, delimiter); + token = strtok(this_str, delimiter); switch (typeSize) { case sizeof(char): { @@ -482,7 +482,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ if (H5Tenum_valueof(tid, token, value) < 0) H5_LIBRARY_ERROR(ENVONLY); - HDmemcpy(ucptr, value, typeSize); + memcpy(ucptr, value, typeSize); retVal = typeSize; @@ -517,7 +517,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ for (i = 0, total_elmts = 1; i < (hsize_t)rank; i++) total_elmts *= dims[i]; - if (NULL == (cptr = (char *)HDcalloc((size_t)total_elmts, baseTypeSize))) + if (NULL == (cptr = (char *)calloc((size_t)total_elmts, baseTypeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate array buffer"); for (i = 0; i < total_elmts; i++) { @@ -563,7 +563,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ if (!(baseTypeSize = H5Tget_size(mtid))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (vl_buf->p = HDmalloc(baseTypeSize))) + if (NULL == (vl_buf->p = malloc(baseTypeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate vlen buffer"); vl_buf->len = 1; @@ -580,7 +580,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ if (i >= vl_buf->len) { char *tmp_realloc; - if (NULL == (tmp_realloc = (char *)HDrealloc(vl_buf->p, vl_buf->len * 2 * baseTypeSize))) + if (NULL == (tmp_realloc = (char *)realloc(vl_buf->p, vl_buf->len * 2 * baseTypeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to reallocate vlen buffer"); vl_buf->len *= 2; vl_buf->p = tmp_realloc; @@ -631,7 +631,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case H5T_OPAQUE: default: { /* All other types get copied raw */ - HDmemcpy(ucptr, this_str, typeSize); + memcpy(ucptr, this_str, typeSize); retVal = typeSize; @@ -690,38 +690,38 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p) buf_size = H5Rget_file_name(ref_vp, NULL, 0); if (buf_size > 0) { - ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); + ref_name = (char *)malloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_file_name(ref_vp, ref_name, (size_t)buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } - HDfree(ref_name); + free(ref_name); ref_name = NULL; } buf_size = H5Rget_obj_name(ref_vp, H5P_DEFAULT, NULL, 0); if (buf_size > 0) { - ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); + ref_name = (char *)malloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, ref_name, (size_t)buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } - HDfree(ref_name); + free(ref_name); ref_name = NULL; } if (H5Rget_type(ref_vp) == H5R_ATTR) { buf_size = H5Rget_attr_name(ref_vp, NULL, 0); if (buf_size > 0) { - ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); + ref_name = (char *)malloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_attr_name(ref_vp, ref_name, (size_t)buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } - HDfree(ref_name); + free(ref_name); ref_name = NULL; } } @@ -729,7 +729,7 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p) ret_value = SUCCEED; done: if (ref_name) - HDfree(ref_name); + free(ref_name); return ret_value; } /* h5str_sprint_reference */ @@ -853,10 +853,10 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i /* Build default formats for long long types */ if (!fmt_llong[0]) { - if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%lld") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); - if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(fmt_llong, sizeof(fmt_llong), "%%lld") < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); + if (snprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu") < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } /* end if */ switch (tclass) { case H5T_FLOAT: { @@ -864,14 +864,14 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i case sizeof(float): { float tmp_float = 0.0f; - HDmemcpy(&tmp_float, cptr, sizeof(float)); + memcpy(&tmp_float, cptr, sizeof(float)); size_t this_len = 25; - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%g", (double)tmp_float) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%g", (double)tmp_float) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; } @@ -879,14 +879,14 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i case sizeof(double): { double tmp_double = 0.0; - HDmemcpy(&tmp_double, cptr, sizeof(double)); + memcpy(&tmp_double, cptr, sizeof(double)); size_t this_len = 25; - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%g", tmp_double) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%g", tmp_double) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; } @@ -894,14 +894,14 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i case sizeof(long double): { long double tmp_ldouble = 0.0; - HDmemcpy(&tmp_ldouble, cptr, sizeof(long double)); + memcpy(&tmp_ldouble, cptr, sizeof(long double)); size_t this_len = 27; - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%Lg", tmp_ldouble) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%Lg", tmp_ldouble) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; } @@ -928,10 +928,10 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (is_variable) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have - * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ + * to dereference the pointer to get the `char*' to pass to strlen(). */ tmp_str = *(char **)in_buf; if (NULL != tmp_str) - typeSize = HDstrlen(tmp_str); + typeSize = strlen(tmp_str); } else { tmp_str = cptr; @@ -939,9 +939,9 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i /* Check for NULL pointer for string */ if (!tmp_str) { - if (NULL == (this_str = (char *)HDmalloc(5))) + if (NULL == (this_str = (char *)malloc(5))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - HDstrncpy(this_str, "NULL", 5); + strncpy(this_str, "NULL", 5); } else { if (typeSize > 0) { @@ -965,24 +965,24 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t this_len = 7; if (H5T_SGN_NONE == nsign) { - HDmemcpy(&tmp_uchar, cptr, sizeof(unsigned char)); + memcpy(&tmp_uchar, cptr, sizeof(unsigned char)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%hhu", tmp_uchar) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%hhu", tmp_uchar) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } else { - HDmemcpy(&tmp_char, cptr, sizeof(char)); + memcpy(&tmp_char, cptr, sizeof(char)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%hhd", tmp_char) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%hhd", tmp_char) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } break; @@ -994,24 +994,24 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t this_len = 9; if (H5T_SGN_NONE == nsign) { - HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short)); + memcpy(&tmp_ushort, cptr, sizeof(unsigned short)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%hu", tmp_ushort) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%hu", tmp_ushort) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } else { - HDmemcpy(&tmp_short, cptr, sizeof(short)); + memcpy(&tmp_short, cptr, sizeof(short)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%hd", tmp_short) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%hd", tmp_short) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } break; @@ -1023,24 +1023,24 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t this_len = 14; if (H5T_SGN_NONE == nsign) { - HDmemcpy(&tmp_uint, cptr, sizeof(unsigned int)); + memcpy(&tmp_uint, cptr, sizeof(unsigned int)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%u", tmp_uint) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%u", tmp_uint) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } else { - HDmemcpy(&tmp_int, cptr, sizeof(int)); + memcpy(&tmp_int, cptr, sizeof(int)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%d", tmp_int) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%d", tmp_int) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } break; @@ -1052,24 +1052,24 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t this_len = 23; if (H5T_SGN_NONE == nsign) { - HDmemcpy(&tmp_ulong, cptr, sizeof(unsigned long)); + memcpy(&tmp_ulong, cptr, sizeof(unsigned long)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%lu", tmp_ulong) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%lu", tmp_ulong) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } else { - HDmemcpy(&tmp_long, cptr, sizeof(long)); + memcpy(&tmp_long, cptr, sizeof(long)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%ld", tmp_long) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%ld", tmp_long) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } break; @@ -1082,24 +1082,24 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t this_len = 25; if (H5T_SGN_NONE == nsign) { - HDmemcpy(&tmp_ullong, cptr, sizeof(unsigned long long)); + memcpy(&tmp_ullong, cptr, sizeof(unsigned long long)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, fmt_ullong, tmp_ullong) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, fmt_ullong, tmp_ullong) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } else { - HDmemcpy(&tmp_llong, cptr, sizeof(long long)); + memcpy(&tmp_llong, cptr, sizeof(long long)); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, fmt_llong, tmp_llong) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, fmt_llong, tmp_llong) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } break; @@ -1160,17 +1160,17 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t i; size_t this_len = 4 * (typeSize + 1); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (1 == typeSize) { - if (HDsnprintf(this_str, this_len, "%#02x", ucptr[0]) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%#02x", ucptr[0]) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } else { for (i = 0; i < typeSize; i++) - if (HDsnprintf(this_str, this_len, "%s%02x", i ? ":" : "", ucptr[i]) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%s%02x", i ? ":" : "", ucptr[i]) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } } @@ -1192,7 +1192,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i * object. */ - if (NULL == (this_str = (char *)HDmalloc(64))) + if (NULL == (this_str = (char *)malloc(64))) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if ((obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, cptr)) < 0) @@ -1206,25 +1206,25 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i switch (oi.type) { case H5O_TYPE_GROUP: - if (HDsprintf(this_str, "%s %s", H5_TOOLS_GROUP, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + if (sprintf(this_str, "%s %s", H5_TOOLS_GROUP, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); break; case H5O_TYPE_DATASET: - if (HDsprintf(this_str, "%s %s", H5_TOOLS_DATASET, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + if (sprintf(this_str, "%s %s", H5_TOOLS_DATASET, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); break; case H5O_TYPE_NAMED_DATATYPE: - if (HDsprintf(this_str, "%s %s", H5_TOOLS_DATATYPE, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + if (sprintf(this_str, "%s %s", H5_TOOLS_DATATYPE, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); break; case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: - if (HDsprintf(this_str, "%u-%s", (unsigned)oi.type, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + if (sprintf(this_str, "%u-%s", (unsigned)oi.type, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); break; } @@ -1245,7 +1245,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5R_ref_t loc_ref; - HDmemcpy(&loc_ref, cptr, sizeof(H5R_ref_t)); + memcpy(&loc_ref, cptr, sizeof(H5R_ref_t)); ref_type = H5Rget_type(&loc_ref); if (!h5str_is_zero(&loc_ref, H5Tget_size(H5T_STD_REF))) { @@ -1279,42 +1279,41 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); size_t this_len = 14; - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR( ENVONLY, "h5str_sprintf: failed to allocate string buffer"); switch (oi.type) { case H5O_TYPE_GROUP: - if (HDsnprintf(this_str, this_len, "%s ", H5_TOOLS_GROUP) < 0) + if (snprintf(this_str, this_len, "%s ", H5_TOOLS_GROUP) < 0) H5_JNI_FATAL_ERROR(ENVONLY, - "h5str_sprintf: HDsnprintf failure"); + "h5str_sprintf: snprintf failure"); break; case H5O_TYPE_DATASET: - if (HDsnprintf(this_str, this_len, "%s ", H5_TOOLS_DATASET) < - 0) + if (snprintf(this_str, this_len, "%s ", H5_TOOLS_DATASET) < 0) H5_JNI_FATAL_ERROR(ENVONLY, - "h5str_sprintf: HDsnprintf failure"); + "h5str_sprintf: snprintf failure"); break; case H5O_TYPE_NAMED_DATATYPE: - if (HDsnprintf(this_str, this_len, "%s ", H5_TOOLS_DATATYPE) < + if (snprintf(this_str, this_len, "%s ", H5_TOOLS_DATATYPE) < 0) H5_JNI_FATAL_ERROR(ENVONLY, - "h5str_sprintf: HDsnprintf failure"); + "h5str_sprintf: snprintf failure"); break; case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: - if (HDsnprintf(this_str, this_len, "%u-", (unsigned)oi.type) < + if (snprintf(this_str, this_len, "%u-", (unsigned)oi.type) < 0) H5_JNI_FATAL_ERROR(ENVONLY, - "h5str_sprintf: HDsnprintf failure"); + "h5str_sprintf: snprintf failure"); break; } /* end switch */ if (!h5str_append(out_str, this_str)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - HDfree(this_str); + free(this_str); this_str = NULL; /* Print OID */ @@ -1324,14 +1323,14 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5Otoken_to_str(tid, &oi.token, &token_str); size_t that_len = 64 + strlen(token_str) + 1; - if (NULL == (this_str = HDmalloc(that_len))) + if (NULL == (this_str = malloc(that_len))) H5_OUT_OF_MEMORY_ERROR( ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, that_len, "%lu:%s", oi.fileno, - token_str) < 0) + if (snprintf(this_str, that_len, "%lu:%s", oi.fileno, token_str) < + 0) H5_JNI_FATAL_ERROR(ENVONLY, - "h5str_sprintf: HDsnprintf failure"); + "h5str_sprintf: snprintf failure"); H5free_memory(token_str); } @@ -1486,17 +1485,17 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i /* All other types get printed as hexadecimal */ size_t this_len = 4 * (typeSize + 1); - if (NULL == (this_str = (char *)HDmalloc(this_len))) + if (NULL == (this_str = (char *)malloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (1 == typeSize) { - if (HDsnprintf(this_str, this_len, "%#02x", ucptr[0]) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%#02x", ucptr[0]) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } else { for (i = 0; i < typeSize; i++) - if (HDsnprintf(this_str, this_len, "%s%02x", i ? ":" : "", ucptr[i]) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); + if (snprintf(this_str, this_len, "%s%02x", i ? ":" : "", ucptr[i]) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); } break; @@ -1507,11 +1506,11 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (!h5str_append(out_str, this_str)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - HDfree(this_str); + free(this_str); this_str = NULL; } /* end if */ - retVal = HDstrlen(out_str->s); + retVal = strlen(out_str->s); done: if (mtid >= 0) @@ -1559,7 +1558,7 @@ h5str_print_region_data_blocks(JNIEnv *env, hid_t region_id, h5str_t *str, int n H5_LIBRARY_ERROR(ENVONLY); /* Allocate space for the dimension array */ - if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) + if (NULL == (dims1 = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate dimension array buffer"); @@ -1576,16 +1575,16 @@ h5str_print_region_data_blocks(JNIEnv *env, hid_t region_id, h5str_t *str, int n if (!(type_size = H5Tget_size(type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (region_buf = HDmalloc(type_size * (size_t)numelem))) + if (NULL == (region_buf = malloc(type_size * (size_t)numelem))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ /* 1 2 n 1 2 n */ - if (NULL == (start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) + if (NULL == (start = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab start buffer"); - if (NULL == (count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) + if (NULL == (count = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab count buffer"); @@ -1619,15 +1618,15 @@ h5str_print_region_data_blocks(JNIEnv *env, hid_t region_id, h5str_t *str, int n done: if (count) - HDfree(count); + free(count); if (start) - HDfree(start); + free(start); if (region_buf) - HDfree(region_buf); + free(region_buf); if (mem_space >= 0) H5Sclose(mem_space); if (dims1) - HDfree(dims1); + free(dims1); if (sid1 >= 0) H5Sclose(sid1); @@ -1654,7 +1653,7 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re { nblocks = H5Sget_select_hyper_nblocks(region_space); } - H5E_END_TRY; + H5E_END_TRY if (nblocks <= 0) { ret_value = SUCCEED; @@ -1665,7 +1664,7 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re /* Print block information */ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + if (NULL == (ptdata = (hsize_t *)malloc((size_t)alloc_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer"); if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) @@ -1698,9 +1697,9 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re for (j = 0; j < ndims; j++) { tmp_str[0] = '\0'; - if (HDsnprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : "(", - (unsigned long)ptdata[i * 2 * ndims + j]) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsnprintf failure"); + if (snprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : "(", + (unsigned long)ptdata[i * 2 * ndims + j]) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: snprintf failure"); if (!h5str_append(str, tmp_str)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); @@ -1709,9 +1708,9 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re for (j = 0; j < ndims; j++) { tmp_str[0] = '\0'; - if (HDsnprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : ")-(", - (unsigned long)ptdata[i * 2 * ndims + j + ndims]) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsnprintf failure"); + if (snprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : ")-(", + (unsigned long)ptdata[i * 2 * ndims + j + ndims]) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: snprintf failure"); if (!h5str_append(str, tmp_str)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); @@ -1734,7 +1733,7 @@ done: if (dtype >= 0) H5Tclose(dtype); if (ptdata) - HDfree(ptdata); + free(ptdata); return ret_value; } /* end h5str_dump_region_blocks */ @@ -1767,7 +1766,7 @@ h5str_print_region_data_points(JNIEnv *env, hid_t region_space, hid_t region_id, H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_points: npoints < 0"); /* Allocate space for the dimension array */ - if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) + if (NULL == (dims1 = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate dimension array buffer"); @@ -1780,7 +1779,7 @@ h5str_print_region_data_points(JNIEnv *env, hid_t region_space, hid_t region_id, if (!(type_size = H5Tget_size(type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (region_buf = HDmalloc(type_size * (size_t)npoints))) + if (NULL == (region_buf = malloc(type_size * (size_t)npoints))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate region buffer"); if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) @@ -1802,11 +1801,11 @@ h5str_print_region_data_points(JNIEnv *env, hid_t region_space, hid_t region_id, done: if (region_buf) - HDfree(region_buf); + free(region_buf); if (mem_space >= 0) H5Sclose(mem_space); if (dims1) - HDfree(dims1); + free(dims1); return ret_value; } /* end h5str_print_region_data_points */ @@ -1831,7 +1830,7 @@ h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re { npoints = H5Sget_select_elem_npoints(region_space); } - H5E_END_TRY; + H5E_END_TRY if (npoints <= 0) { ret_value = SUCCEED; @@ -1842,7 +1841,7 @@ h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re /* Print point information */ alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + if (NULL == (ptdata = (hsize_t *)malloc((size_t)alloc_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_points: failed to allocate region point data buffer"); @@ -1876,9 +1875,9 @@ h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re for (j = 0; j < ndims; j++) { tmp_str[0] = '\0'; - if (HDsnprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : "(", - (unsigned long)(ptdata[i * ndims + j])) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsnprintf failure"); + if (snprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : "(", + (unsigned long)(ptdata[i * ndims + j])) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: snprintf failure"); if (!h5str_append(str, tmp_str)) H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); @@ -1899,7 +1898,7 @@ done: if (dtype >= 0) H5Tclose(dtype); if (ptdata) - HDfree(ptdata); + free(ptdata); return ret_value; } /* end h5str_dump_region_points */ @@ -1952,8 +1951,8 @@ done: * Purpose: Recursive check for variable length string of a datatype. * * Return: - * TRUE : type contains any variable length string - * FALSE : type doesn't contain any variable length string + * true : type contains any variable length string + * false : type doesn't contain any variable length string * Negative value: error occur * *------------------------------------------------------------------------- @@ -2294,13 +2293,13 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs if (H5Tis_variable_str(tid)) { s = *(char **)((void *)mem); if (s != NULL) - size = HDstrlen(s); + size = strlen(s); } else { s = (char *)mem; } for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); + memcpy(&tempuchar, &s[i], sizeof(unsigned char)); if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) { ret_value = FAIL; break; @@ -2402,7 +2401,7 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs for (block_index = 0; block_index < block_nelmts; block_index++) { hvl_t vl_elem; - HDmemcpy(&vl_elem, ((unsigned char *)_mem) + block_index * size, sizeof(hvl_t)); + memcpy(&vl_elem, ((unsigned char *)_mem) + block_index * size, sizeof(hvl_t)); /* Get the number of sequence elements */ nelmts = vl_elem.len; @@ -2428,7 +2427,7 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs for (block_index = 0; block_index < block_nelmts; block_index++) { H5R_ref_t loc_ref; - HDmemcpy(&loc_ref, ((unsigned char *)_mem) + block_index * size, sizeof(H5R_ref_t)); + memcpy(&loc_ref, ((unsigned char *)_mem) + block_index * size, sizeof(H5R_ref_t)); if ((region_id = H5Ropen_object(&loc_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) continue; @@ -2513,7 +2512,7 @@ render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t contai } /* Allocate space for the dimension array */ - if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) { + if (NULL == (dims1 = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) { ret_value = FAIL; goto done; } @@ -2535,19 +2534,19 @@ render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t contai goto done; } - if (NULL == (region_buf = HDmalloc(type_size * (size_t)numelem))) { + if (NULL == (region_buf = malloc(type_size * (size_t)numelem))) { ret_value = FAIL; goto done; } /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ /* 1 2 n 1 2 n */ - if (NULL == (start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) { + if (NULL == (start = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) { ret_value = FAIL; goto done; } - if (NULL == (count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) { + if (NULL == (count = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) { ret_value = FAIL; goto done; } @@ -2583,15 +2582,15 @@ render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t contai done: if (count) - HDfree(count); + free(count); if (start) - HDfree(start); + free(start); if (region_buf) - HDfree(region_buf); + free(region_buf); if (mem_space >= 0) H5Sclose(mem_space); if (dims1) - HDfree(dims1); + free(dims1); if (sid1 >= 0) H5Sclose(sid1); @@ -2634,7 +2633,7 @@ render_bin_output_region_blocks(FILE *stream, hid_t region_space, hid_t region_i alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) { + if (NULL == (ptdata = (hsize_t *)malloc((size_t)alloc_size))) { ret_value = FAIL; goto done; } @@ -2667,7 +2666,7 @@ done: if (dtype >= 0) H5Tclose(dtype); if (ptdata) - HDfree(ptdata); + free(ptdata); return ret_value; } /* end render_bin_output_region_blocks */ @@ -2700,13 +2699,13 @@ render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t reg goto done; } - if (NULL == (region_buf = HDmalloc(type_size * (size_t)npoints))) { + if (NULL == (region_buf = malloc(type_size * (size_t)npoints))) { ret_value = FAIL; goto done; } /* Allocate space for the dimension array */ - if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) { + if (NULL == (dims1 = (hsize_t *)malloc(sizeof(hsize_t) * (size_t)ndims))) { ret_value = FAIL; goto done; } @@ -2735,11 +2734,11 @@ render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t reg done: if (dims1) - HDfree(dims1); + free(dims1); if (mem_space >= 0) H5Sclose(mem_space); if (region_buf) - HDfree(region_buf); + free(region_buf); return ret_value; } /* end render_bin_output_region_data_points */ @@ -2780,7 +2779,7 @@ render_bin_output_region_points(FILE *stream, hid_t region_space, hid_t region_i alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) { + if (NULL == (ptdata = (hsize_t *)malloc((size_t)alloc_size))) { ret_value = FAIL; goto done; } @@ -2813,7 +2812,7 @@ done: if (dtype >= 0) H5Tclose(dtype); if (ptdata) - HDfree(ptdata); + free(ptdata); return ret_value; } /* end render_bin_output_region_points */ @@ -2871,8 +2870,8 @@ h5str_dump_region_attribute(JNIEnv *env, h5str_t *str, hid_t region_id) } /* Check if we have VL data in the dataset's datatype */ - if (h5str_detect_vlen(type_id) == TRUE) - vl_data = TRUE; + if (h5str_detect_vlen(type_id) == true) + vl_data = true; if (!(size = H5Tget_size(type_id))) { ret_value = FAIL; @@ -2880,8 +2879,8 @@ h5str_dump_region_attribute(JNIEnv *env, h5str_t *str, hid_t region_id) } alloc_size = p_nelmts * size; - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) { + assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + if (NULL != (buf = (unsigned char *)malloc((size_t)alloc_size))) { /* Read the data */ if (H5Aread(region_id, type_id, buf) >= 0) { @@ -2910,7 +2909,7 @@ h5str_dump_region_attribute(JNIEnv *env, h5str_t *str, hid_t region_id) done: if (buf) - HDfree(buf); + free(buf); if (region_space >= 0) H5Sclose(region_space); if (type_id >= 0) @@ -2974,7 +2973,7 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) H5_LIBRARY_ERROR(ENVONLY); if (NULL == - (sm_buf = (unsigned char *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)p_nelmts))) + (sm_buf = (unsigned char *)calloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)p_nelmts))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_mem: failed to allocate sm_buf"); /* Read the data */ @@ -3056,7 +3055,7 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) } if (sm_nbytes > 0) { - if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes))) + if (NULL == (sm_buf = (unsigned char *)malloc((size_t)sm_nbytes))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf"); sm_nelmts = sm_nbytes / p_type_nbytes; @@ -3065,8 +3064,8 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) H5_LIBRARY_ERROR(ENVONLY); /* The stripmine loop */ - HDmemset(hs_offset, 0, sizeof hs_offset); - HDmemset(zero, 0, sizeof zero); + memset(hs_offset, 0, sizeof hs_offset); + memset(zero, 0, sizeof zero); for (elmtno = 0; elmtno < (hsize_t)p_nelmts; elmtno += hs_nelmts) { /* Calculate the hyperslab size */ @@ -3133,7 +3132,7 @@ done: if (sm_space >= 0) H5Sclose(sm_space); if (sm_buf) - HDfree(sm_buf); + free(sm_buf); if (f_space >= 0) H5Sclose(f_space); if (p_type >= 0) @@ -3183,7 +3182,7 @@ h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr_id, int binary_order H5_LIBRARY_ERROR(ENVONLY); if (NULL == - (sm_buf = (unsigned char *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)p_nelmts))) + (sm_buf = (unsigned char *)calloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)p_nelmts))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_mem: failed to allocate sm_buf"); /* Read the data */ @@ -3246,7 +3245,7 @@ h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr_id, int binary_order vl_data = 1; alloc_size = (size_t)p_nelmts * H5Tget_size(p_type); - if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)alloc_size))) + if (NULL == (sm_buf = (unsigned char *)malloc((size_t)alloc_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_mem: failed to allocate sm_buf"); /* Read the data */ @@ -3274,7 +3273,7 @@ h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr_id, int binary_order done: if (sm_buf) - HDfree(sm_buf); + free(sm_buf); if (f_space >= 0) H5Sclose(f_space); if (p_type >= 0) @@ -3290,8 +3289,8 @@ done: * * Purpose: Recursive check for variable length string of a datatype. * - * Return: TRUE : type contains any variable length string - * FALSE : type doesn't contain any variable length string + * Return: true : type contains any variable length string + * false : type doesn't contain any variable length string * Negative value: failed *------------------------------------------------------------------------- */ @@ -3299,10 +3298,10 @@ htri_t H5Tdetect_variable_str(hid_t tid) { H5T_class_t tclass = -1; - htri_t ret = FALSE; + htri_t ret = false; ret = H5Tis_variable_str(tid); - if ((ret == TRUE) || (ret < 0)) + if ((ret == true) || (ret < 0)) goto done; tclass = H5Tget_class(tid); @@ -3314,7 +3313,7 @@ H5Tdetect_variable_str(hid_t tid) goto done; } ret = H5Tdetect_variable_str(btid); - if ((ret == TRUE) || (ret < 0)) { + if ((ret == true) || (ret < 0)) { H5Tclose(btid); goto done; } @@ -3334,7 +3333,7 @@ H5Tdetect_variable_str(hid_t tid) hid_t mtid = H5Tget_member_type(tid, u); ret = H5Tdetect_variable_str(mtid); - if ((ret == TRUE) || (ret < 0)) { + if ((ret == true) || (ret < 0)) { H5Tclose(mtid); goto done; } @@ -3373,24 +3372,24 @@ h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, v CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i > 0) && (bytes_in > 0)) { - if (HDfprintf(stream, ", ") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); + if (fprintf(stream, ", ") < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: fprintf failure"); if (line_count >= H5TOOLS_TEXT_BLOCK) { line_count = 0; - if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); + if (fprintf(stream, "\n") < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: fprintf failure"); } } - if (HDfprintf(stream, "%s", buffer.s) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); + if (fprintf(stream, "%s", buffer.s) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: fprintf failure"); h5str_free(&buffer); } /* end for (i = 0; i < nelmts... */ - if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); + if (fprintf(stream, "\n") < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: fprintf failure"); done: if (buffer.s) @@ -3424,7 +3423,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *env, jclass clss, jlong attr_id, jlon UNUSED(clss); - HDmemset(&h5str, 0, sizeof(h5str_t)); + memset(&h5str, 0, sizeof(h5str_t)); if ((p_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -3435,7 +3434,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *env, jclass clss, jlong attr_id, jlon if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadComplex: read buffer length <= 0"); - if (NULL == (readBuf = (char *)HDmalloc((size_t)n * size))) + if (NULL == (readBuf = (char *)malloc((size_t)n * size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate read buffer"); if ((status = H5Aread(attr_id, mem_type_id, readBuf)) < 0) @@ -3465,7 +3464,7 @@ done: if (h5str.s) h5str_free(&h5str); if (readBuf) - HDfree(readBuf); + free(readBuf); if (p_type >= 0) H5Tclose(p_type); @@ -3503,7 +3502,7 @@ Java_hdf_hdf5lib_H5_H5Acopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id H5_LIBRARY_ERROR(ENVONLY); total_size = (hsize_t)npoints * (hsize_t)type_size; - if (NULL == (buf = (jbyte *)HDmalloc((size_t)total_size * sizeof(jbyte)))) + if (NULL == (buf = (jbyte *)malloc((size_t)total_size * sizeof(jbyte)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Acopy: failed to allocate buffer"); if ((retVal = H5Aread((hid_t)src_id, tid, buf)) < 0) @@ -3521,7 +3520,7 @@ Java_hdf_hdf5lib_H5_H5Acopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id done: if (buf) - HDfree(buf); + free(buf); if (tid >= 0) H5Tclose(tid); if (sid >= 0) @@ -3564,7 +3563,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id H5_LIBRARY_ERROR(ENVONLY); total_size = (hsize_t)npoints * (hsize_t)type_size; - if (NULL == (buf = (jbyte *)HDmalloc((size_t)total_size * sizeof(jbyte)))) + if (NULL == (buf = (jbyte *)malloc((size_t)total_size * sizeof(jbyte)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dcopy: failed to allocate buffer"); if ((retVal = H5Dread((hid_t)src_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)) < 0) @@ -3582,7 +3581,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id done: if (buf) - HDfree(buf); + free(buf); if (tid >= 0) H5Tclose(tid); if (sid >= 0) @@ -3673,13 +3672,13 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full(JNIEnv *env, jclass clss, jlong loc_ PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_full: lType not pinned"); PIN_LONG_ARRAY(ENVONLY, fNo, fnoP, &isCopy, "H5Gget_obj_info_full: fNo not pinned"); - if (NULL == (oName = (char **)HDcalloc((size_t)n, sizeof(*oName)))) + if (NULL == (oName = (char **)calloc((size_t)n, sizeof(*oName)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object name"); - if (NULL == (tokens = (H5O_token_t *)HDcalloc((size_t)n, sizeof(H5O_token_t)))) + if (NULL == (tokens = (H5O_token_t *)calloc((size_t)n, sizeof(H5O_token_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object tokens"); - if (NULL == (fnos = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long)))) + if (NULL == (fnos = (unsigned long *)calloc((size_t)n, sizeof(unsigned long)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for file number info"); @@ -3708,7 +3707,7 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full(JNIEnv *env, jclass clss, jlong loc_ } /* end if */ /* Create an H5O_token_t object */ - if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], TRUE))) + if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], true))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); ENVPTR->SetObjectArrayElement(ENVONLY, oToken, i, token); @@ -3723,9 +3722,9 @@ done: UNPIN_JAVA_STRING(ENVONLY, group_name, gName); } if (fnos) - HDfree(fnos); + free(fnos); if (tokens) - HDfree(tokens); + free(tokens); if (oName) h5str_array_free(oName, (size_t)n); if (fnoP) @@ -3775,10 +3774,10 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max(JNIEnv *env, jclass clss, jlong loc_i PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_max: oType not pinned"); PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_max: lType not pinned"); - if (NULL == (oName = (char **)HDcalloc((size_t)n, sizeof(*oName)))) + if (NULL == (oName = (char **)calloc((size_t)n, sizeof(*oName)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object name"); - if (NULL == (tokens = (H5O_token_t *)HDcalloc((size_t)n, sizeof(H5O_token_t)))) + if (NULL == (tokens = (H5O_token_t *)calloc((size_t)n, sizeof(H5O_token_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object tokens"); if ((ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int *)otarr, (int *)ltarr, tokens, maxnum)) < 0) @@ -3796,7 +3795,7 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max(JNIEnv *env, jclass clss, jlong loc_i } /* Create an H5O_token_t object */ - if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], TRUE))) + if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], true))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); ENVPTR->SetObjectArrayElement(ENVONLY, oToken, i, token); @@ -3807,7 +3806,7 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max(JNIEnv *env, jclass clss, jlong loc_i done: if (tokens) - HDfree(tokens); + free(tokens); if (oName) h5str_array_free(oName, (size_t)n); if (ltarr) @@ -3896,7 +3895,7 @@ obj_info_all(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d datainfo->ltype[datainfo->count] = info->type; datainfo->fno[datainfo->count] = object_info.fileno; - HDmemcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token)); + memcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token)); } done: @@ -3926,7 +3925,7 @@ obj_info_max(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d datainfo->otype[datainfo->count] = object_info.type; datainfo->ltype[datainfo->count] = info->type; - HDmemcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token)); + memcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token)); done: datainfo->count++; @@ -3969,20 +3968,20 @@ Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_exp PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL, "H5export_dataset: file_export name not pinned"); - if (NULL == (stream = HDfopen(file_export, "w+"))) - H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed"); + if (NULL == (stream = fopen(file_export, "w+"))) + H5_JNI_FATAL_ERROR(ENVONLY, "fopen failed"); if ((ret_val = h5str_dump_simple_dset(ENVONLY, stream, dataset_id, binary_order)) < 0) H5_ASSERTION_ERROR(ENVONLY, "h5str_dump_simple_dset failed"); if (stream) { - HDfclose(stream); + fclose(stream); stream = NULL; } done: if (stream) - HDfclose(stream); + fclose(stream); if (file_export) UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export); if (object_name) @@ -4024,20 +4023,20 @@ Java_hdf_hdf5lib_H5_H5export_1attribute(JNIEnv *env, jclass clss, jstring file_e PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL, "H5export_dataset: file_export name not pinned"); - if (NULL == (stream = HDfopen(file_export, "w+"))) - H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed"); + if (NULL == (stream = fopen(file_export, "w+"))) + H5_JNI_FATAL_ERROR(ENVONLY, "fopen failed"); if ((ret_val = h5str_dump_simple_mem(ENVONLY, stream, attr_id, binary_order)) < 0) H5_ASSERTION_ERROR(ENVONLY, "h5str_dump_simple_dset failed"); if (stream) { - HDfclose(stream); + fclose(stream); stream = NULL; } done: if (stream) - HDfclose(stream); + fclose(stream); if (file_export) UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export); if (object_name) @@ -4099,7 +4098,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo hvl_t vl_elem; /* Get the number of sequence elements */ - HDmemcpy(&vl_elem, char_buf, sizeof(hvl_t)); + memcpy(&vl_elem, char_buf, sizeof(hvl_t)); jsize nelmts = (jsize)vl_elem.len; if (vl_elem.len != (size_t)nelmts) H5_JNI_FATAL_ERROR(ENVONLY, "translate_atomic_rbuf: overflow of number of VL elements"); @@ -4157,12 +4156,12 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo typeCount = typeSize / vlSize; - if (NULL == (objBuf = HDmalloc(typeSize))) + if (NULL == (objBuf = malloc(typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate buffer"); /* Convert each element */ /* Get the object element */ - HDmemcpy((char *)objBuf, char_buf, typeSize); + memcpy((char *)objBuf, char_buf, typeSize); /* The list we're going to return: */ if (NULL == (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0))) @@ -4172,7 +4171,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo jobj = jList; if (objBuf) - HDfree(objBuf); + free(objBuf); break; } /* H5T_ARRAY */ @@ -4184,7 +4183,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo switch (typeSize) { case sizeof(jbyte): { jbyte byteValue; - HDmemcpy(((char *)&byteValue), char_buf, typeSize); + memcpy(((char *)&byteValue), char_buf, typeSize); if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cByte, byteValueMid, byteValue))) @@ -4193,7 +4192,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo } case sizeof(jshort): { jshort shortValue; - HDmemcpy(((char *)&shortValue), char_buf, typeSize); + memcpy(((char *)&shortValue), char_buf, typeSize); if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cShort, shortValueMid, shortValue))) @@ -4203,7 +4202,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo case sizeof(jint): { jint intValue; - HDmemcpy(((char *)&intValue), char_buf, typeSize); + memcpy(((char *)&intValue), char_buf, typeSize); if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cInt, intValueMid, intValue))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -4211,7 +4210,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo } case sizeof(jlong): { jlong longValue; - HDmemcpy(((char *)&longValue), char_buf, typeSize); + memcpy(((char *)&longValue), char_buf, typeSize); if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cLong, longValueMid, longValue))) @@ -4226,7 +4225,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo switch (typeSize) { case sizeof(jfloat): { jfloat floatValue; - HDmemcpy(((char *)&floatValue), char_buf, typeSize); + memcpy(((char *)&floatValue), char_buf, typeSize); if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cFloat, floatValueMid, (double)floatValue))) @@ -4235,7 +4234,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo } case sizeof(jdouble): { jdouble doubleValue; - HDmemcpy(((char *)&doubleValue), char_buf, typeSize); + memcpy(((char *)&doubleValue), char_buf, typeSize); if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cDouble, doubleValueMid, doubleValue))) @@ -4260,7 +4259,7 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, &bb, "translate_atomic_rbuf reference: byte array not pinned"); - HDmemcpy(barray, ((jbyte *)raw_buf), typeSize); + memcpy(barray, ((jbyte *)raw_buf), typeSize); if (barray) UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, jobj ? 0 : JNI_ABORT); @@ -4354,12 +4353,12 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ vl_elem.len = (size_t)jnelmts; - if (NULL == (vl_elem.p = HDmalloc((size_t)jnelmts * vlSize))) + if (NULL == (vl_elem.p = malloc((size_t)jnelmts * vlSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_wbuf: failed to allocate vlen ptr buffer"); translate_wbuf(ENVONLY, (jobjectArray)in_obj, memb, vlClass, (jsize)jnelmts, vl_elem.p); - HDmemcpy(char_buf, &vl_elem, sizeof(hvl_t)); + memcpy(char_buf, &vl_elem, sizeof(hvl_t)); break; } /* H5T_VLEN */ case H5T_COMPOUND: { @@ -4418,12 +4417,12 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ if (jnelmts < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_atomic_wbuf: number of array elements < 0"); - if (NULL == (objBuf = HDmalloc((size_t)jnelmts * vlSize))) + if (NULL == (objBuf = malloc((size_t)jnelmts * vlSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_wbuf: failed to allocate buffer"); translate_wbuf(ENVONLY, array, memb, vlClass, (jsize)jnelmts, objBuf); - HDmemcpy(char_buf, (char *)objBuf, vlSize * (size_t)jnelmts); + memcpy(char_buf, (char *)objBuf, vlSize * (size_t)jnelmts); break; } /* H5T_ARRAY */ case H5T_ENUM: @@ -4434,22 +4433,22 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ switch (typeSize) { case sizeof(jbyte): { jbyte byteValue = ENVPTR->CallByteMethod(ENVONLY, in_obj, byteValueMid); - HDmemcpy(char_buf, ((char *)&byteValue), typeSize); + memcpy(char_buf, ((char *)&byteValue), typeSize); break; } case sizeof(jshort): { jshort shortValue = ENVPTR->CallShortMethod(ENVONLY, in_obj, shortValueMid); - HDmemcpy(char_buf, ((char *)&shortValue), typeSize); + memcpy(char_buf, ((char *)&shortValue), typeSize); break; } case sizeof(jint): { jint intValue = ENVPTR->CallIntMethod(ENVONLY, in_obj, intValueMid); - HDmemcpy(char_buf, ((char *)&intValue), typeSize); + memcpy(char_buf, ((char *)&intValue), typeSize); break; } case sizeof(jlong): { jlong longValue = ENVPTR->CallLongMethod(ENVONLY, in_obj, longValueMid); - HDmemcpy(char_buf, ((char *)&longValue), typeSize); + memcpy(char_buf, ((char *)&longValue), typeSize); break; } } @@ -4460,12 +4459,12 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ switch (typeSize) { case sizeof(jfloat): { jfloat floatValue = ENVPTR->CallFloatMethod(ENVONLY, in_obj, floatValueMid); - HDmemcpy(char_buf, ((char *)&floatValue), typeSize); + memcpy(char_buf, ((char *)&floatValue), typeSize); break; } case sizeof(jdouble): { jdouble doubleValue = ENVPTR->CallDoubleMethod(ENVONLY, in_obj, doubleValueMid); - HDmemcpy(char_buf, ((char *)&doubleValue), typeSize); + memcpy(char_buf, ((char *)&doubleValue), typeSize); break; } } @@ -4474,7 +4473,7 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ case H5T_REFERENCE: { /* Convert each array element */ jbyte *barray = (jbyte *)ENVPTR->GetByteArrayElements(ENVONLY, in_obj, 0); - HDmemcpy(char_buf, ((char *)barray), typeSize); + memcpy(char_buf, ((char *)barray), typeSize); ENVPTR->ReleaseByteArrayElements(ENVONLY, in_obj, barray, 0); break; } /* H5T_REFERENCE */ @@ -4488,18 +4487,18 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ jsize length; const char *utf8 = NULL; - HDmemset(char_buf, 0, typeSize); + memset(char_buf, 0, typeSize); if (NULL != in_obj) { PIN_JAVA_STRING(ENVONLY, in_obj, utf8, NULL, "translate_atomic_wbuf jobj not pinned"); length = ENVPTR->GetStringUTFLength(ENVONLY, in_obj); CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (is_variable) { - char *new_buf = (char *)HDcalloc(1, (size_t)(length + 1)); - HDmemcpy(((char *)new_buf), utf8, (size_t)length); - HDmemcpy(char_buf, &new_buf, typeSize); + char *new_buf = (char *)calloc(1, (size_t)(length + 1)); + memcpy(((char *)new_buf), utf8, (size_t)length); + memcpy(char_buf, &new_buf, typeSize); } else { - HDmemcpy(char_buf, utf8, (size_t)length); + memcpy(char_buf, utf8, (size_t)length); } UNPIN_JAVA_STRING(ENVONLY, in_obj, utf8); utf8 = NULL; @@ -4561,7 +4560,7 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t jList = NULL; /* Get the number of sequence elements */ - HDmemcpy(&vl_elem, char_buf + i * sizeof(hvl_t), sizeof(hvl_t)); + memcpy(&vl_elem, char_buf + i * sizeof(hvl_t), sizeof(hvl_t)); jsize nelmts = (jsize)vl_elem.len; if (vl_elem.len != (size_t)nelmts) H5_JNI_FATAL_ERROR(ENVONLY, "translate_rbuf: overflow of number of VL elements"); @@ -4666,7 +4665,7 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t typeCount = typeSize / vlSize; - if (NULL == (objBuf = HDmalloc(typeSize))) + if (NULL == (objBuf = malloc(typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_rbuf: failed to allocate buffer"); /* Convert each element to a list */ @@ -4675,7 +4674,7 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t jList = NULL; /* Get the object element */ - HDmemcpy((char *)objBuf, char_buf + i * typeSize, typeSize); + memcpy((char *)objBuf, char_buf + i * typeSize, typeSize); /* The list we're going to return: */ if (i < (size_t)ret_buflen) { @@ -4700,7 +4699,7 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t } if (objBuf) - HDfree(objBuf); + free(objBuf); break; } /* H5T_ARRAY */ @@ -4784,12 +4783,12 @@ translate_wbuf(JNIEnv *env, jobjectArray in_buf, jlong mem_type_id, H5T_class_t vl_elem.len = (size_t)jnelmts; - if (NULL == (vl_elem.p = HDmalloc((size_t)jnelmts * vlSize))) + if (NULL == (vl_elem.p = malloc((size_t)jnelmts * vlSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_wbuf: failed to allocate vlen ptr buffer"); translate_wbuf(ENVONLY, array, memb, vlClass, (jsize)jnelmts, vl_elem.p); - HDmemcpy(char_buf + i * sizeof(hvl_t), &vl_elem, sizeof(hvl_t)); + memcpy(char_buf + i * sizeof(hvl_t), &vl_elem, sizeof(hvl_t)); ENVPTR->DeleteLocalRef(ENVONLY, jList); } /* end for (i = 0; i < count; i++) */ diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index 770fc45..090e1ce 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -221,7 +221,7 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1name(JNIEnv *env, jclass clss, jlong obj H5_LIBRARY_ERROR(ENVONLY); if (buf_size > 0) { - if (NULL == (volName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + if (NULL == (volName = (char *)malloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5VLget_connector_name: failed to allocated VOL connector name buffer"); @@ -235,7 +235,7 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1name(JNIEnv *env, jclass clss, jlong obj done: if (volName) - HDfree(volName); + free(volName); return (jstring)str; } /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1name */ -- cgit v0.12