diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-01-09 18:55:31 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-01-09 18:55:31 (GMT) |
commit | 9b0281736ca488387afd8a301e36e6f5a5315c4a (patch) | |
tree | b490d3cf90f67945b8de5387d7543b7503f82db9 | |
parent | 7b39e544c05f761698be95e17e8d4dbb396cefe4 (diff) | |
download | hdf5-9b0281736ca488387afd8a301e36e6f5a5315c4a.zip hdf5-9b0281736ca488387afd8a301e36e6f5a5315c4a.tar.gz hdf5-9b0281736ca488387afd8a301e36e6f5a5315c4a.tar.bz2 |
Fix deprecated H5Pget_version
-rw-r--r-- | java/src/hdf/hdf5lib/H5.java | 28 | ||||
-rw-r--r-- | java/src/jni/h5pImp.c | 39 | ||||
-rw-r--r-- | java/src/jni/h5pImp.h | 9 | ||||
-rw-r--r-- | java/test/TestH5P.java | 65 | ||||
-rw-r--r-- | java/test/testfiles/JUnit-TestH5P.txt | 4 |
5 files changed, 18 insertions, 127 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 51b0d38..807c613 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -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) diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 19f9640..ac21d1d 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -134,45 +134,6 @@ 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 * Signature: (JJ)I */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index 0a603f7..056c569 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -59,15 +59,6 @@ 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 *, jclass, jlong, jintArray); - -/* - * Class: hdf_hdf5lib_H5 * Method: H5Pset_userblock * Signature: (JJ)I */ diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index e6105d9..981f34e 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -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; @@ -887,37 +888,12 @@ public class TestH5P { } @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); } @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); } diff --git a/java/test/testfiles/JUnit-TestH5P.txt b/java/test/testfiles/JUnit-TestH5P.txt index c937ae2..01acadd 100644 --- a/java/test/testfiles/JUnit-TestH5P.txt +++ b/java/test/testfiles/JUnit-TestH5P.txt @@ -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) |