Fix deprecated H5Pget_version

This commit is contained in:
Allen Byrne 2019-01-09 12:55:31 -06:00
parent 7b39e544c0
commit 9b0281736c
5 changed files with 18 additions and 127 deletions

View File

@ -7729,34 +7729,6 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options)
throws HDF5LibraryException;
// /////// Other/Older property list routines ///////
/**
* H5Pget_version retrieves the version information of various objects for a file creation property list.
*
* @param plist
* IN: Identifier of the file creation property list.
* @param version_info
* OUT: version information.
*
* <pre>
* version_info[0] = boot // boot block version number
* version_info[1] = freelist // global freelist version
* version_info[2] = stab // symbol tabl version number
* version_info[3] = shhdr // shared object header version
* </pre>
* @return a non-negative value, with the values of version_info initialized, if successful
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - version_info is null.
* @exception IllegalArgumentException
* - version_info is illegal.
**/
public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException,
NullPointerException, IllegalArgumentException;
// /////// file drivers property list routines ///////
public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store)

View File

@ -132,45 +132,6 @@ Java_hdf_hdf5lib_H5__1H5Pcopy
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Pcopy */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_version
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1version
(JNIEnv *env, jclass clss, jlong plist, jintArray version_info)
{
herr_t status = -1;
jint *theArray;
jboolean isCopy;
if (version_info == NULL) {
h5nullArgument(env, "H5Pget_version: version_info input array is NULL");
} /* end if */
else if (ENVPTR->GetArrayLength(ENVPAR version_info) < 4) {
h5badArgument(env, "H5Pget_version: version_info input array < 4");
} /* end else if */
else {
theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR version_info, &isCopy);
if (theArray == NULL) {
h5JNIFatalError(env, "H5Pget_version: version_info not pinned");
} /* end if */
else {
status = H5Pget_version((hid_t)plist, (unsigned *)&(theArray[0]),
(unsigned *)&(theArray[1]), (unsigned *)&(theArray[2]), (unsigned *)&(theArray[3]));
if (status < 0) {
ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, JNI_ABORT);
h5libraryError(env);
} /* end if */
else
ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, 0);
} /* end else */
} /* end else */
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1version */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_userblock

View File

@ -57,15 +57,6 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Pcopy
(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_version
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1version
(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_userblock

View File

@ -25,6 +25,7 @@ import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5F_info2_t;
import org.junit.After;
import org.junit.Before;
@ -886,30 +887,6 @@ public class TestH5P {
H5.H5Pget_elink_prefix(plapl_id, null);
}
@Test(expected = NullPointerException.class)
public void testH5Pget_version_null() throws Throwable {
H5.H5Pget_version(fcpl_id, null);
}
@Test
public void testH5Pget_version() {
int[] version_info = {255,255,255,255};
try {
_createH5File(fcpl_id, fapl_id);
H5.H5Pget_version(fcpl_id, version_info);
deleteH5file();
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pget_version: " + err);
}
assertTrue("super block version: "+version_info[0], version_info[0] == 0);
assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
}
@Test(expected = NullPointerException.class)
public void testH5Pget_userblock_null() throws Throwable {
H5.H5Pget_userblock(fcpl_id, null);
@ -917,7 +894,6 @@ public class TestH5P {
@Test
public void testH5P_userblock() {
int[] version_info = {255,255,255,255};
long[] size = {0};
try {
@ -931,7 +907,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5.H5Pget_version(fcpl_id, version_info);
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_userblock(fcpl_id, size);
deleteH5file();
}
@ -939,10 +918,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_userblock: " + err);
}
assertTrue("super block version: "+version_info[0], version_info[0] == 0);
assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("user block size: "+size[0], size[0] == 1024);
}
@ -953,7 +928,6 @@ public class TestH5P {
@Test
public void testH5P_sizes() {
int[] version_info = {255,255,255,255};
long[] size = {0,0};
try {
@ -967,7 +941,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5.H5Pget_version(fcpl_id, version_info);
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sizes(fcpl_id, size);
deleteH5file();
}
@ -975,10 +952,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sizes: " + err);
}
assertTrue("super block version: "+version_info[0], version_info[0] == 0);
assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("sizeof_addr size: "+size[0], size[0] == 4);
assertTrue("sizeof_size size: "+size[1], size[1] == 8);
}
@ -990,7 +963,6 @@ public class TestH5P {
@Test
public void testH5P_sym_k() {
int[] version_info = {255,255,255,255};
int[] size = {0,0};
try {
@ -1004,7 +976,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5.H5Pget_version(fcpl_id, version_info);
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sym_k(fcpl_id, size);
deleteH5file();
}
@ -1012,10 +987,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
assertTrue("super block version: "+version_info[0], version_info[0] == 0);
assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("symbol table tree rank: "+size[0], size[0] == 32);
assertTrue("symbol table node size: "+size[1], size[1] == 8);
}
@ -1027,7 +998,6 @@ public class TestH5P {
@Test
public void testH5P_istore_k() {
int[] version_info = {255,255,255,255};
int[] size = {0};
try {
@ -1041,7 +1011,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5.H5Pget_version(fcpl_id, version_info);
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
assertTrue("super block version: "+finfo.super_version, finfo.super_version == 1);
assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_istore_k(fcpl_id, size);
deleteH5file();
}
@ -1049,10 +1022,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
assertTrue("super block version: "+version_info[0], version_info[0] == 1);
assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64);
}

View File

@ -48,7 +48,6 @@ JUnit version 4.11
.testH5Pset_link_creation_order_invalidvalue
.testH5P_sym_k
.testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist
.testH5Pget_version_null
.testH5Pset_scaleoffset_Invalidscale_factor
.testH5Pget_elink_prefix_null
.testH5Pget_data_transform_IllegalSize
@ -74,7 +73,6 @@ JUnit version 4.11
.testH5Pget_shared_mesg_index
.testH5Pset_link_phase_change
.testH5Pget_shared_mesg_nindexes
.testH5Pget_version
.testH5Pset_elink_acc_flags_InvalidFlag1
.testH5Pset_elink_acc_flags_InvalidFlag2
.testH5Pget_link_phase_change_EqualsSet
@ -87,5 +85,5 @@ JUnit version 4.11
Time: XXXX
OK (85 tests)
OK (83 tests)