diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
commit | cabc39c3e197e2591449d2604bfee26465fb60e1 (patch) | |
tree | d5f39f5f5965584bf9bf49646a2af617adfd3e4e /java/src/jni/h5pDAPLImp.c | |
parent | 7355f4c505092a7a85474b47f18d5206028e2c95 (diff) | |
parent | ab69f5df770ee3cc6cd6c81d905a5317b894a002 (diff) | |
download | hdf5-feature/coding_standards.zip hdf5-feature/coding_standards.tar.gz hdf5-feature/coding_standards.tar.bz2 |
Merge branch 'develop' into feature/coding_standardsfeature/coding_standards
Diffstat (limited to 'java/src/jni/h5pDAPLImp.c')
-rw-r--r-- | java/src/jni/h5pDAPLImp.c | 98 |
1 files changed, 47 insertions, 51 deletions
diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c index fb39b84..82802b9 100644 --- a/java/src/jni/h5pDAPLImp.c +++ b/java/src/jni/h5pDAPLImp.c @@ -1,12 +1,11 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -44,13 +43,12 @@ static herr_t H5D_append_cb(hid_t dataset_id, hsize_t *cur_dims, void *cb_data); * Signature: (JJJD)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache - (JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots, - jlong rdcc_nbytes, jdouble rdcc_w0) +Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots, + jlong rdcc_nbytes, jdouble rdcc_w0) { UNUSED(clss); - if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0) + if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double)rdcc_w0) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -63,37 +61,38 @@ done: * Signature: (J[J[J[D)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache - (JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots, - jlongArray rdcc_nbytes, jdoubleArray rdcc_w0) +Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots, + jlongArray rdcc_nbytes, jdoubleArray rdcc_w0) { - jboolean isCopy; - jdouble *w0Array = NULL; - jlong *rdcc_nslotsArray = NULL; - jlong *nbytesArray = NULL; - herr_t status = FAIL; + jboolean isCopy; + jdouble *w0Array = NULL; + jlong * rdcc_nslotsArray = NULL; + jlong * nbytesArray = NULL; + herr_t status = FAIL; UNUSED(clss); if (NULL != rdcc_w0) PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_chunk_cache: rdcc_w0 array not pinned"); if (NULL != rdcc_nslots) - PIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, &isCopy, "H5Pget_chunk_cache: rdcc_nslots array not pinned"); + PIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, &isCopy, + "H5Pget_chunk_cache: rdcc_nslots array not pinned"); if (NULL != rdcc_nbytes) - PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_chunk_cache: nbytesArray array not pinned"); + PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, + "H5Pget_chunk_cache: nbytesArray array not pinned"); { /* direct cast (size_t *)variable fails on 32-bit environment */ long long rdcc_nslots_temp = *rdcc_nslotsArray; - long long nbytes_temp = *nbytesArray; - size_t rdcc_nslots_t = (size_t) rdcc_nslots_temp; - size_t nbytes_t = (size_t) nbytes_temp; + long long nbytes_temp = *nbytesArray; + size_t rdcc_nslots_t = (size_t)rdcc_nslots_temp; + size_t nbytes_t = (size_t)nbytes_temp; if ((status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array)) < 0) H5_LIBRARY_ERROR(ENVONLY); *rdcc_nslotsArray = (jlong)rdcc_nslots_t; - *nbytesArray = (jlong)nbytes_t; + *nbytesArray = (jlong)nbytes_t; } /* end direct cast special handling */ done: @@ -111,18 +110,18 @@ done: * Signature: (JLjava/lang/String;)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix - (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) +Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix(JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) { const char *extFilePrefix = NULL; - herr_t retVal = FAIL; + herr_t retVal = FAIL; UNUSED(clss); if (NULL == prefix) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_efile_prefix: external file prefix is NULL"); - PIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix, NULL, "H5Pset_efile_prefix: external file prefix not pinned"); + PIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix, NULL, + "H5Pset_efile_prefix: external file prefix not pinned"); if ((retVal = H5Pset_efile_prefix((hid_t)dapl_id, extFilePrefix)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -138,20 +137,19 @@ done: * Signature: (J)Ljava/lang/String; */ JNIEXPORT jstring JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix - (JNIEnv *env, jclass clss, jlong dapl_id) +Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix(JNIEnv *env, jclass clss, jlong dapl_id) { - ssize_t prefix_size = -1; - char *pre = NULL; - jstring str = NULL; + ssize_t prefix_size = -1; + char * pre = NULL; + jstring str = NULL; UNUSED(clss); 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))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_efile_prefix: memory allocation failed"); + if (NULL == (pre = (char *)HDmalloc(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) H5_LIBRARY_ERROR(ENVONLY); @@ -159,7 +157,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR( + ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters"); } done: @@ -175,11 +174,11 @@ done: * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1append_1flush - (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data) +Java_hdf_hdf5lib_H5_H5Pset_1append_1flush(JNIEnv *env, jclass clss, jlong plist_id, jint ndims, + jlongArray boundary, jobject callback_op, jobject op_data) { - cb_wrapper wrapper = { callback_op, op_data }; - herr_t status = FAIL; + cb_wrapper wrapper = {callback_op, op_data}; + herr_t status = FAIL; UNUSED(clss); @@ -191,7 +190,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_append_flush: callback_op is NULL"); - if ((status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t *)boundary, (H5D_append_cb_t)H5D_append_cb, (void *)&wrapper)) < 0) + if ((status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t *)boundary, + (H5D_append_cb_t)H5D_append_cb, (void *)&wrapper)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -208,8 +208,7 @@ done: * Signature: (JI)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view - (JNIEnv *env, jclass clss, jlong dapl_id, jint view) +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id, jint view) { UNUSED(clss); @@ -226,8 +225,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view - (JNIEnv *env, jclass clss, jlong dapl_id) +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id) { H5D_vds_view_t virtual_view = H5D_VDS_ERROR; @@ -246,8 +244,7 @@ done: * Signature: (JJ)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap - (JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size) +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size) { UNUSED(clss); @@ -264,8 +261,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap - (JNIEnv *env, jclass clss, jlong dapl_id) +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id) { hsize_t gap_size = 0; @@ -279,17 +275,16 @@ done: } /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */ static herr_t -H5D_append_cb - (hid_t dataset_id, hsize_t *cur_dims, void *cb_data) +H5D_append_cb(hid_t dataset_id, hsize_t *cur_dims, void *cb_data) { cb_wrapper *wrapper = (cb_wrapper *)cb_data; jlongArray cur_dimsArray; jmethodID mid; jobject visit_callback = wrapper->visit_callback; jclass cls; - JNIEnv *cbenv = NULL; - void *op_data = (void *)wrapper->op_data; - jint status = -1; + JNIEnv * cbenv = NULL; + void * op_data = (void *)wrapper->op_data; + jint status = -1; if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) { CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE); @@ -299,7 +294,8 @@ H5D_append_cb if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", + "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); if (NULL != cur_dims) { |