summaryrefslogtreecommitdiffstats
path: root/java/src/jni/h5aImp.c
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/jni/h5aImp.c')
-rw-r--r--java/src/jni/h5aImp.c80
1 files changed, 40 insertions, 40 deletions
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);