summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/big.c4
-rw-r--r--test/cache.c10
-rw-r--r--test/cmpd_dset.c26
-rw-r--r--test/dsets.c463
-rw-r--r--test/dtypes.c63
-rw-r--r--test/extend.c2
-rw-r--r--test/external.c4
-rw-r--r--test/file_handle.c36
-rw-r--r--test/filename.c2
-rw-r--r--test/fillval.c68
-rw-r--r--test/getname.c2
-rw-r--r--test/h5test.c150
-rw-r--r--test/h5test.h4
-rw-r--r--test/hyperslab.c60
-rw-r--r--test/istore.c21
-rw-r--r--test/ntypes.c703
-rw-r--r--test/ohdr.c4
-rwxr-xr-xtest/reserved.c26
-rw-r--r--test/stab.c4
-rw-r--r--test/stream_test.c2
-rw-r--r--test/tarray.c86
-rw-r--r--test/tattr.c2
-rw-r--r--test/testhdf5.h37
-rw-r--r--test/tfile.c168
-rw-r--r--test/tgenprop.c79
-rw-r--r--test/th5s.c9
-rw-r--r--test/theap.c16
-rw-r--r--test/titerate.c36
-rw-r--r--test/tmeta.c17
-rw-r--r--test/tmisc.c50
-rw-r--r--test/trefer.c116
-rw-r--r--test/trefstr.c6
-rw-r--r--test/tselect.c453
-rw-r--r--test/tskiplist.c16
-rw-r--r--test/ttbbt.c2
-rw-r--r--test/ttime.c18
-rw-r--r--test/ttsafe_acreate.c197
-rw-r--r--test/ttsafe_cancel.c218
-rw-r--r--test/ttsafe_dcreate.c2
-rw-r--r--test/ttsafe_error.c183
-rw-r--r--test/ttst.c19
-rw-r--r--test/tvlstr.c48
-rw-r--r--test/tvltypes.c84
-rw-r--r--test/unlink.c4
44 files changed, 1982 insertions, 1538 deletions
diff --git a/test/big.c b/test/big.c
index 38e96c1..c28e047 100644
--- a/test/big.c
+++ b/test/big.c
@@ -187,7 +187,7 @@ writer (hid_t fapl, int wrt_n)
{
hsize_t size1[4] = {8, 1024, 1024, 1024};
hsize_t size2[1] = {GB8LL};
- hssize_t hs_start[1];
+ hsize_t hs_start[1];
hsize_t hs_size[1];
hid_t file=-1, space1=-1, space2=-1, mem_space=-1, d1=-1, d2=-1;
int *buf = malloc (sizeof(int) * WRT_SIZE);
@@ -299,7 +299,7 @@ reader (hid_t fapl)
FILE *script = NULL;
hid_t file=-1, mspace=-1, fspace=-1, d2=-1;
char ln[128], *s;
- hssize_t hs_offset[1];
+ hsize_t hs_offset[1];
hsize_t hs_size[1] = {WRT_SIZE};
int *buf = malloc (sizeof(int) * WRT_SIZE);
int i, j, zero, wrong, nerrors=0;
diff --git a/test/cache.c b/test/cache.c
index bdd27d1..e346699 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -408,7 +408,7 @@ const char * entry_type_names[NUMBER_OF_ENTRY_TYPES] =
/* call back function declarations: */
-static herr_t check_write_permitted(H5F_t UNUSED * f,
+static herr_t check_write_permitted(const H5F_t UNUSED * f,
hid_t UNUSED dxpl_id,
hbool_t * write_permitted_ptr);
@@ -842,7 +842,7 @@ type_and_index_to_addr(int32_t type,
*/
static herr_t
-check_write_permitted(H5F_t UNUSED * f,
+check_write_permitted(const H5F_t UNUSED * f,
hid_t UNUSED dxpl_id,
hbool_t * write_permitted_ptr)
{
@@ -1961,7 +1961,7 @@ rename_entry(H5C_t * cache_ptr,
if ( ! done ) {
- result = H5C_rename_entry(NULL, cache_ptr, &(types[type]),
+ result = H5C_rename_entry(cache_ptr, &(types[type]),
old_addr, new_addr);
}
@@ -3936,7 +3936,7 @@ check_rename_err(void)
if ( pass ) {
- result = H5C_rename_entry(NULL, cache_ptr, &(types[0]),
+ result = H5C_rename_entry(cache_ptr, &(types[0]),
entry_0_0_ptr->addr, entry_0_1_ptr->addr);
if ( result >= 0 ) {
@@ -3948,7 +3948,7 @@ check_rename_err(void)
if ( pass ) {
- result = H5C_rename_entry(NULL, cache_ptr, &(types[0]),
+ result = H5C_rename_entry(cache_ptr, &(types[0]),
entry_0_0_ptr->addr, entry_1_0_ptr->addr);
if ( result >= 0 ) {
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index ddc8a83..c258b96 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
hid_t file, dataset, space, PRESERVE, fapl;
hid_t array_dt;
static hsize_t dim[] = {NX, NY};
- hssize_t f_offset[2]; /*offset of hyperslab in file */
+ hsize_t f_offset[2]; /*offset of hyperslab in file */
hsize_t h_size[2]; /*size of hyperslab */
hsize_t memb_size[1] = {4};
char filename[256];
@@ -544,10 +544,10 @@ main (int argc, char *argv[])
for (j=0; j<NY; j++) {
s1_t *ps1 = s1 + i*NY + j;
s2_t *ps2 = s2 + i*NY + j;
- if ((hssize_t)i>=f_offset[0] &&
- (hsize_t)i<f_offset[0]+h_size[0] &&
- (hssize_t)j>=f_offset[1] &&
- (hsize_t)j<f_offset[1]+h_size[1]) {
+ if (i>=f_offset[0] &&
+ i<f_offset[0]+h_size[0] &&
+ j>=f_offset[1] &&
+ j<f_offset[1]+h_size[1]) {
if (ps2->a != ps1->a ||
ps2->b != ps1->b ||
ps2->c[0] != ps1->c[0] ||
@@ -602,10 +602,10 @@ main (int argc, char *argv[])
for (j=0; j<NY; j++) {
s1_t *ps1 = s1 + i*NY + j;
s5_t *ps5 = s5 + i*NY + j;
- if ((hssize_t)i>=f_offset[0] &&
- (hsize_t)i<f_offset[0]+h_size[0] &&
- (hssize_t)j>=f_offset[1] &&
- (hsize_t)j<f_offset[1]+h_size[1]) {
+ if (i>=f_offset[0] &&
+ i<f_offset[0]+h_size[0] &&
+ j>=f_offset[1] &&
+ j<f_offset[1]+h_size[1]) {
if (ps5->pre != (unsigned)(-1) ||
ps5->a != ps1->a ||
ps5->b != ps1->b ||
@@ -692,10 +692,10 @@ main (int argc, char *argv[])
goto error;
}
- if ((hssize_t)i>=f_offset[0] &&
- (hsize_t)i<f_offset[0]+h_size[0] &&
- (hssize_t)j>=f_offset[1] &&
- (hsize_t)j<f_offset[1]+h_size[1]) {
+ if (i>=f_offset[0] &&
+ i<f_offset[0]+h_size[0] &&
+ j>=f_offset[1] &&
+ j<f_offset[1]+h_size[1]) {
if (ps1->b != (unsigned)(-1) ||
ps1->d != (unsigned)(-1)) {
H5_FAILED();
diff --git a/test/dsets.c b/test/dsets.c
index d3e2e65..6731c5d 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -1300,7 +1300,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
hid_t write_dxpl; /* Dataset xfer property list ID for writing */
hid_t sid; /* Dataspace ID */
const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hssize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
+ const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
void *tconv_buf = NULL; /* Temporary conversion buffer */
hsize_t i, j, n; /* Local index variables */
@@ -1330,7 +1330,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
}
TESTING(" filters (setup)");
-
+
/* Check if all the filters are available */
if(H5Pall_filters_avail(dcpl)!=TRUE) {
H5_FAILED();
@@ -1626,131 +1626,134 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_filter_noencoder
+ * Function: test_filter_noencoder
*
- * Purpose: Tests filters with no encoder present. Ensures that data
- * can still be decoded correctly and that errors are thrown
- * when the application tries to write.
+ * Purpose: Tests filters with no encoder present. Ensures that data
+ * can still be decoded correctly and that errors are thrown
+ * when the application tries to write.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Nat Furrer and James Laird
+ * Programmer: Nat Furrer and James Laird
* Monday, June 7, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_HAVE_FILTER_SZIP
static herr_t
test_filter_noencoder(const char *dset_name)
{
- hid_t file_id = -1;
- hid_t dset_id = -1;
- hid_t test_dset_id = -1;
- hid_t dcpl_id = -1;
- hid_t space_id = -1;
- hsize_t dims = 1;
- hsize_t read_dims = 10;
- herr_t err;
- int test_ints[10] = { 12 };
- int read_buf[10];
- int i;
- char * srcdir = HDgetenv("srcdir"); /* The source directory */
- char testfile[512]=""; /* Buffer to hold name of test file */
-
- /* Create the name of the file to open (in case we are using the --srcdir
- * option. */
- if (srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile)) )
- {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, NOENCODER_FILENAME);
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t test_dset_id = -1;
+ hid_t dcpl_id = -1;
+ hid_t space_id = -1;
+ hsize_t dims = 10;
+ herr_t err;
+ int test_ints[10] = { 12 };
+ int read_buf[10];
+ int i;
+ char * srcdir = HDgetenv("srcdir"); /* The source directory */
+ char testfile[512]=""; /* Buffer to hold name of test file */
- file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
- if (file_id < 0) goto error;
+ /*
+ * Create the name of the file to open (in case we are using the --srcdir
+ * option and the file is in a different directory from this test).
+ */
+ if (srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile)) )
+ {
+ HDstrcpy(testfile, srcdir);
+ HDstrcat(testfile, "/");
+ }
+ HDstrcat(testfile, NOENCODER_FILENAME);
- dset_id = H5Dopen(file_id, dset_name);
- if (dset_id < 0) goto error;
+ file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
+ if (file_id < 0) goto error;
- TESTING(" decoding without encoder");
+ dset_id = H5Dopen(file_id, dset_name);
+ if (dset_id < 0) goto error;
- space_id = H5Screate_simple(1, &read_dims, NULL);
- if (space_id < 0) goto error;
+ space_id = H5Screate_simple(1, &dims, NULL);
+ if (space_id < 0) goto error;
- /* Read the dataset and make sure the decoder is working correctly */
- err = H5Dread(dset_id, H5T_NATIVE_INT, space_id, space_id, H5P_DEFAULT, read_buf);
- if (err < 0) goto error;
+ TESTING(" decoding without encoder");
- for(i = 0; i < 10; i++)
- if ( read_buf[i] != i ) goto error;
+ /* Read the dataset and make sure the decoder is working correctly */
+ err = H5Dread(dset_id, H5T_NATIVE_INT, space_id, space_id, H5P_DEFAULT, read_buf);
+ if (err < 0) goto error;
- H5Sclose(space_id);
+ for(i = 0; i < 10; i++)
+ if ( read_buf[i] != i ) goto error;
- PASSED();
+ H5Sclose(space_id);
- /* Attempt to copy the DCPL and use it to create a new dataset.
- * Since the filter does not have an encoder, the creation
- * should fail.
- */
- TESTING(" trying to write without encoder");
+ PASSED();
- dcpl_id = H5Dget_create_plist(dset_id);
- if (dcpl_id < 0) goto error;
+ /* Attempt to copy the DCPL and use it to create a new dataset.
+ * Since the filter does not have an encoder, the creation
+ * should fail.
+ */
+ TESTING(" trying to write without encoder");
- space_id = H5Screate_simple(1, &dims, NULL);
- if (space_id < 0) goto error;
+ dcpl_id = H5Dget_create_plist(dset_id);
+ if (dcpl_id < 0) goto error;
- H5E_BEGIN_TRY{
- test_dset_id = H5Dcreate(file_id, NOENCODER_TEST_DATASET, H5T_NATIVE_INT, space_id , dcpl_id);
- }H5E_END_TRY
+ space_id = H5Screate_simple(1, &dims, NULL);
+ if (space_id < 0) goto error;
- if (test_dset_id >= 0) goto error;
+ H5E_BEGIN_TRY{
+ test_dset_id = H5Dcreate(file_id, NOENCODER_TEST_DATASET, H5T_NATIVE_INT, space_id , dcpl_id);
+ }H5E_END_TRY
- /* Attempt to extend the dataset. This should fail because
- * the dataset has a fill value and is instructed to fill on
- * allocation.
- */
- dims = 20; /* Dataset is originally of size 10 */
- H5E_BEGIN_TRY{
- err = H5Dextend(dset_id, &dims);
- }H5E_END_TRY
+ if (test_dset_id >= 0) goto error;
- if (err >= 0) goto error;
+ /* Attempt to extend the dataset. This should fail because
+ * the dataset has a fill value and is instructed to fill on
+ * allocation.
+ */
+ dims = 20; /* Dataset is originally of size 10 */
+ H5E_BEGIN_TRY{
+ err = H5Dextend(dset_id, &dims);
+ }H5E_END_TRY
- /* Attempt to write to the dataset. This should fail because
- * the filter does not have an encoder.
- */
- H5E_BEGIN_TRY{
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints);
- }H5E_END_TRY
+ if (err >= 0) goto error;
- if (err >= 0) goto error;
+ /* Attempt to write to the dataset. This should fail because
+ * the filter does not have an encoder.
+ */
+ H5E_BEGIN_TRY{
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints);
+ }H5E_END_TRY
- H5Fclose(file_id);
- H5Dclose(dset_id);
- H5Sclose(space_id);
- H5Pclose(dcpl_id);
+ if (err >= 0) goto error;
- PASSED();
+ H5Fclose(file_id);
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Pclose(dcpl_id);
- return 0;
+ PASSED();
+
+ return 0;
error:
- H5_FAILED();
- if (dset_id != -1)
- H5Dclose(dset_id);
- if (test_dset_id != -1)
- H5Dclose(test_dset_id);
- if (space_id != -1)
- H5Sclose(space_id);
- if (dcpl_id != -1)
- H5Pclose(dcpl_id);
- if (file_id != -1)
- H5Fclose(file_id);
- return -1;
+ H5_FAILED();
+ if (dset_id != -1)
+ H5Dclose(dset_id);
+ if (test_dset_id != -1)
+ H5Dclose(test_dset_id);
+ if (space_id != -1)
+ H5Sclose(space_id);
+ if (dcpl_id != -1)
+ H5Pclose(dcpl_id);
+ if (file_id != -1)
+ H5Fclose(file_id);
+ return -1;
}
+#endif /* H5_HAVE_FILTER_SZIP */
/*-------------------------------------------------------------------------
* Function: test_get_filter_info
@@ -1768,10 +1771,9 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_get_filter_info()
+test_get_filter_info(void)
{
unsigned int flags; /* flags returned from H5Zget_filter_info */
- herr_t ret_value = -1;
herr_t err;
TESTING("H5Zget_filter_info");
@@ -1780,54 +1782,52 @@ test_get_filter_info()
* of encoder and decoder.
*/
#ifdef H5_HAVE_FILTER_FLETCHER32
- if(H5Zget_filter_info(H5Z_FILTER_FLETCHER32, &flags) < 0) goto error;
+ if(H5Zget_filter_info(H5Z_FILTER_FLETCHER32, &flags) < 0) TEST_ERROR
if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- goto error;
+ TEST_ERROR
#endif
#ifdef H5_HAVE_FILTER_SHUFFLE
- if(H5Zget_filter_info(H5Z_FILTER_SHUFFLE, &flags) < 0) goto error;
+ if(H5Zget_filter_info(H5Z_FILTER_SHUFFLE, &flags) < 0) TEST_ERROR
if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- goto error;
+ TEST_ERROR
#endif
#ifdef H5_HAVE_FILTER_DEFLATE
- if(H5Zget_filter_info(H5Z_FILTER_DEFLATE, &flags) < 0) goto error;
+ if(H5Zget_filter_info(H5Z_FILTER_DEFLATE, &flags) < 0) TEST_ERROR
if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- goto error;
+ TEST_ERROR
#endif
#ifdef H5_HAVE_FILTER_SZIP
- if(H5Zget_filter_info(H5Z_FILTER_SZIP, &flags) < 0) goto error;
+ if(H5Zget_filter_info(H5Z_FILTER_SZIP, &flags) < 0) TEST_ERROR
#ifdef H5_SZIP_CAN_ENCODE
if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- goto error;
+ TEST_ERROR
#else
if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) != 0) ||
((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- goto error;
+ TEST_ERROR
#endif /* H5_SZIP_CAN_ENCODE */
#endif /* H5_HAVE_FILTER_SZIP */
- /* Verify that get_filter_info throws an error when given a bad filter */
- err = H5Zget_filter_info(-1, &flags);
-
- if (err < 0) goto error;
- if (flags != 0) goto error;
+ /* Verify that get_filter_info doesn't throw an error when given a bad filter */
+ /* (Different default behavior in post-1.6 code) */
+ if (H5Zget_filter_info(-1, &flags) < 0) TEST_ERROR
+ if (flags != 0) TEST_ERROR
PASSED();
return 0;
error:
- H5_FAILED();
return -1;
}
@@ -1983,27 +1983,27 @@ test_filters(hid_t file)
*/
#ifdef H5_HAVE_FILTER_SZIP
TESTING("szip filter (with encoder)");
- if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
- if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error;
-
-#ifdef H5_SZIP_CAN_ENCODE
- puts("");
- if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block)<0) goto error;
-
- if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size)<0) goto error;
-#else
- SKIPPED();
-#endif /* H5_SZIP_CAN_ENCODE */
+ if ( h5_szip_can_encode() == 1) {
+ if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error;
+
+ puts("");
+ if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block)<0) goto error;
+ if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size)<0) goto error;
+ if (H5Pclose (dc)<0) goto error;
+ } else {
+ SKIPPED();
+ }
TESTING("szip filter (without encoder)");
-#ifndef H5_SZIP_CAN_ENCODE
- puts("");
- if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error;
-#else
- SKIPPED();
-#endif /* H5_SZIP_CAN_ENCODE */
- if (H5Pclose (dc)<0) goto error;
+ if ( h5_szip_can_encode() != 1) {
+ puts("");
+ if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error;
+ } else {
+ SKIPPED();
+ }
+
#else /* H5_HAVE_FILTER_SZIP */
TESTING("szip filter");
SKIPPED();
@@ -2081,44 +2081,46 @@ test_filters(hid_t file)
if (H5Pset_fletcher32 (dc)<0) goto error;
if (H5Pset_shuffle (dc)<0) goto error;
- /* Make sure encoding is enabled */
-#ifdef H5_SZIP_CAN_ENCODE
- puts("");
- if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block)<0) goto error;
-
- if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error;
-#else
- SKIPPED();
-#endif /* H5_SZIP_CAN_ENCODE */
+ /* Make sure encoding is enabled */
+ if ( h5_szip_can_encode() == 1) {
+ puts("");
+ if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block)<0) goto error;
+ if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error;
+ } else {
+ SKIPPED();
+ }
TESTING("shuffle+szip+checksum filters(checksum first, without encoder)");
-#ifndef H5_SZIP_CAN_ENCODE
- puts("");
- if (test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error;
-#else
- SKIPPED();
-#endif /* H5_SZIP_CAN_ENCODE */
+
+ if ( h5_szip_can_encode() != 1) {
+ puts("");
+ if (test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error;
+ } else {
+ SKIPPED();
+ }
/* Clean up objects used for this test */
if (H5Pclose (dc)<0) goto error;
-
+
TESTING("shuffle+szip+checksum filters(checksum last, with encoder)");
- /* Make sure encoding is enabled */
-#ifdef H5_SZIP_CAN_ENCODE
- puts("");
- if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
- if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error;
- if (H5Pset_shuffle (dc)<0) goto error;
- if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block)<0) goto error;
- if (H5Pset_fletcher32 (dc)<0) goto error;
- if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error;
+ /* Make sure encoding is enabled */
+ if ( h5_szip_can_encode() == 1) {
+ puts("");
+ if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error;
+ if (H5Pset_shuffle (dc)<0) goto error;
+ if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block)<0) goto error;
+ if (H5Pset_fletcher32 (dc)<0) goto error;
+
+ if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error;
+
+ /* Clean up objects used for this test */
+ if (H5Pclose (dc)<0) goto error;
- /* Clean up objects used for this test */
- if (H5Pclose (dc)<0) goto error;
-#else
- SKIPPED();
-#endif /* H5_SZIP_CAN_ENCODE */
+ } else {
+ SKIPPED();
+ }
#else /* H5_HAVE_FILTER_SZIP && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_FLETCHER32 */
TESTING("shuffle+szip+fletcher32 filters");
@@ -2852,7 +2854,7 @@ static herr_t
test_can_apply_szip(hid_t
#ifndef H5_HAVE_FILTER_SZIP
UNUSED
-#endif /* H5_HAVE_FILTER_SSZIP */
+#endif /* H5_HAVE_FILTER_SZIP */
file)
{
#ifdef H5_HAVE_FILTER_SZIP
@@ -2866,20 +2868,13 @@ file)
const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
const hsize_t chunk_dims2[2] = {2, 1}; /* Chunk dimensions */
herr_t ret; /* Status value */
-#else /* H5_HAVE_FILTER_SZIP */
- const char *not_supported= " Szip filter is not enabled.";
-#endif /* H5_HAVE_FILTER_SSZIP */
+#endif /* H5_HAVE_FILTER_SZIP */
TESTING("dataset szip filter 'can apply' callback");
#ifdef H5_HAVE_FILTER_SZIP
- /* skip this test if the SZIP encoder is not enabled */
-#ifndef H5_SZIP_CAN_ENCODE
- SKIPPED();
- return 0;
-#endif /* H5_SZIP_CAN_ENCODE */
-
+ if (h5_szip_can_encode() == 1) {
/* Create the data space */
if ((sid = H5Screate_simple(2, dims, NULL))<0) {
H5_FAILED();
@@ -3017,11 +3012,14 @@ file)
PASSED();
+} else {
+ SKIPPED();
+ puts(" Szip encoding is not enabled.");
+}
#else /* H5_HAVE_FILTER_SZIP */
SKIPPED();
- puts(not_supported);
+ puts(" Szip filter is not enabled.");
#endif /* H5_HAVE_FILTER_SZIP */
-
return 0;
#ifdef H5_HAVE_FILTER_SZIP
@@ -3391,6 +3389,124 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_filter_delete
+ *
+ * Purpose: Tests deletion of filters from a dataset creation property list
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ * Monday, January 26, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_filter_delete(hid_t file)
+{
+ H5Z_filter_t filtn; /* filter identification number */
+ hid_t dsid=-1; /* dataset ID */
+ hid_t sid=-1; /* dataspace ID */
+ hid_t dcpl=-1; /* dataset creation property list ID */
+ hid_t dcpl1=-1; /* dataset creation property list ID */
+ hsize_t dims[2]={20,20}; /* dataspace dimensions */
+ hsize_t chunk_dims[2]={10,10}; /* chunk dimensions */
+ int nfilters; /* number of filters in DCPL */
+ herr_t ret; /* generic return value */
+ int i;
+
+ TESTING("filter deletion");
+
+#if defined H5_HAVE_FILTER_DEFLATE && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32
+ /* create the data space */
+ if ((sid = H5Screate_simple(2, dims, NULL))<0) goto error;
+
+ /* create dcpl */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) goto error;
+
+ if (H5Pset_fletcher32 (dcpl)<0) goto error;
+ if (H5Pset_deflate (dcpl, 6)<0) goto error;
+ if (H5Pset_shuffle (dcpl)<0) goto error;
+
+ /* create a dataset */
+ if ((dsid = H5Dcreate(file,"dsetdel", H5T_NATIVE_INT, sid, dcpl)) <0) goto error;
+
+ /* get copy of dataset's dataset creation property list */
+ if ((dcpl1=H5Dget_create_plist(dsid))<0) goto error;
+
+ /*----------------------------------------------------------------------
+ * delete the deflate filter
+ *----------------------------------------------------------------------
+ */
+ /* delete the deflate filter */
+ if (H5Premove_filter(dcpl1,H5Z_FILTER_DEFLATE)<0) goto error;
+
+ /* get information about filters */
+ if ((nfilters = H5Pget_nfilters(dcpl1))<0) goto error;
+
+ /* check if filter was deleted */
+ for (i=0; i<nfilters; i++) {
+ filtn = H5Pget_filter(dcpl1,(unsigned)i,0,0,0,0,0);
+ if (H5Z_FILTER_DEFLATE==filtn)
+ goto error;
+ }
+
+ /* try to delete the deflate filter again */
+ H5E_BEGIN_TRY {
+ ret=H5Premove_filter(dcpl1,H5Z_FILTER_DEFLATE);
+ } H5E_END_TRY;
+ if (ret >=0) {
+ H5_FAILED();
+ printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*----------------------------------------------------------------------
+ * delete all filters
+ *----------------------------------------------------------------------
+ */
+ /* delete all filters */
+ if (H5Premove_filter(dcpl1,H5Z_FILTER_ALL)<0) goto error;
+
+ /* get information about filters */
+ if ((nfilters = H5Pget_nfilters(dcpl1))<0) goto error;
+
+ /* check if filters were deleted */
+ if (nfilters)goto error;
+
+ /*----------------------------------------------------------------------
+ * close
+ *----------------------------------------------------------------------
+ */
+
+ /* clean up objects used for this test */
+ if (H5Pclose (dcpl)<0) goto error;
+ if (H5Pclose (dcpl1)<0) goto error;
+ if (H5Dclose (dsid)<0) goto error;
+ if (H5Sclose (sid)<0) goto error;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Pclose(dcpl1);
+ H5Dclose(dsid);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+} /* end test_filter_delete() */
+
+
+
+/*-------------------------------------------------------------------------
* Function: auxread_fdata
*
* Purpose: reads a dataset "NAME" from FID
@@ -3513,6 +3629,7 @@ test_filters_endianess(void)
TESTING("filters with big-endian/little-endian data");
+#if defined H5_HAVE_FILTER_FLETCHER32
/*-------------------------------------------------------------------------
* step1: create a file
*-------------------------------------------------------------------------
@@ -3527,9 +3644,7 @@ test_filters_endianess(void)
if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if(H5Pset_chunk(dcpl,rank,chunk_dims)<0) goto error;
-#if defined H5_HAVE_FILTER_FLETCHER32
if (H5Pset_fletcher32 (dcpl)<0) goto error;
-#endif
/* create a dataset */
if ((dsid = H5Dcreate(fid,"dset",H5T_NATIVE_INT,sid,dcpl)) <0) goto error;
@@ -3592,6 +3707,9 @@ test_filters_endianess(void)
if (H5Fclose(fid)<0) goto error;
PASSED();
+#else
+ SKIPPED();
+#endif
return 0;
error:
@@ -3673,7 +3791,7 @@ static herr_t
test_missing_chunk(hid_t file)
{
hid_t s=-1, d=-1, dcpl=-1;
- hssize_t hs_start[1];
+ hsize_t hs_start[1];
hsize_t hs_stride[1],
hs_count[1],
hs_block[1];
@@ -3821,6 +3939,7 @@ main(void)
#endif /* H5_WANT_H5_V1_4_COMPAT */
nerrors += test_can_apply_szip(file)<0 ?1:0;
nerrors += test_compare_dcpl(file)<0 ?1:0;
+ nerrors += test_filter_delete(file)<0 ?1:0;
nerrors += test_filters_endianess()<0 ?1:0;
nerrors += test_zero_dims(file)<0 ?1:0;
nerrors += test_missing_chunk(file)<0 ?1:0;
diff --git a/test/dtypes.c b/test/dtypes.c
index f91fcb0..b4c5691 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -120,11 +120,10 @@ static int num_opaque_conversions_g = 0;
#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT)
void some_dummy_func(float x);
+static int my_isnan(flt_t type, void *val);
static int opaque_check(int tag_it);
-void *test_vltypes_alloc_custom(size_t size, void *info);
-void test_vltypes_free_custom(void *mem, void *info);
-static herr_t
-convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata,
+static herr_t convert_opaque(hid_t UNUSED st, hid_t UNUSED dt,
+ H5T_cdata_t *cdata,
size_t UNUSED nelmts, size_t UNUSED buf_stride,
size_t UNUSED bkg_stride, void UNUSED *_buf,
void UNUSED *bkg, hid_t UNUSED dset_xfer_plid);
@@ -1456,9 +1455,9 @@ static int
test_compound_9(void)
{
typedef struct cmpd_struct {
- int i1;
- char* str;
- int i2;
+ int i1;
+ char* str;
+ int i2;
} cmpd_struct;
cmpd_struct wdata = {11, "variable-length string", 22};
@@ -1561,7 +1560,7 @@ test_compound_9(void)
goto error;
} /* end if */
- if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(rdata.str, wdata.str)) {
+ if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
H5_FAILED(); AT();
printf("incorrect read data\n");
goto error;
@@ -2056,12 +2055,12 @@ test_compound_12(void)
{
hid_t complex_id;
size_t size = 0;
- size_t offset, new_size;
+ size_t offset, new_size, tmp_size;
herr_t ret;
TESTING("adjust size of compound data types");
- /* Create the empty compound type */
+ /* Create a compound type of minimal size */
if ((complex_id = H5Tcreate(H5T_COMPOUND, 1))<0) goto error;
/* Verify the size */
@@ -2070,22 +2069,26 @@ test_compound_12(void)
/* Add a couple fields and adjust the size */
offset = size;
- size+=H5Tget_size(H5T_NATIVE_DOUBLE);
+ if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
+ size+=tmp_size;
if (H5Tset_size(complex_id, size)<0) goto error;
if (H5Tinsert(complex_id, "real", offset,
H5T_NATIVE_DOUBLE)<0) goto error;
offset = size;
- size+=H5Tget_size(H5T_NATIVE_DOUBLE);
+ if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
+ size+=tmp_size;
if (H5Tset_size(complex_id, size)<0) goto error;
if (H5Tinsert(complex_id, "imaginary", offset,
H5T_NATIVE_DOUBLE)<0) goto error;
/* Increase and decrease the size. */
- size+=H5Tget_size(H5T_NATIVE_DOUBLE);
+ if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
+ size+=tmp_size;
if (H5Tset_size(complex_id, size)<0) goto error;
- size-=H5Tget_size(H5T_NATIVE_DOUBLE);
+ if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
+ size-=tmp_size;
if (H5Tset_size(complex_id, size)<0) goto error;
/* Verify the size */
@@ -2102,7 +2105,7 @@ test_compound_12(void)
puts(" Tries to cut off the last member. Should have failed.");
goto error;
}
-
+
if (H5Tclose (complex_id)<0) goto error;
PASSED();
return 0;
@@ -3542,6 +3545,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
unsigned char dst_bits[32]; /*dest value in LE order*/
size_t src_nbits; /*source length in bits */
size_t dst_nbits; /*dst length in bits */
+ H5T_sign_t src_sign; /*source sign type */
+ H5T_sign_t dst_sign; /*dst sign type */
void *aligned=NULL; /*aligned temp buffer */
signed char hw_char;
unsigned char hw_uchar;
@@ -3643,6 +3648,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
dst_size = H5Tget_size(dst);
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
+ src_sign = H5Tget_sign(src);
+ dst_sign = H5Tget_sign(dst);
buf = aligned_malloc(nelmts*MAX(src_size, dst_size));
saved = aligned_malloc(nelmts*MAX(src_size, dst_size));
aligned = HDmalloc(sizeof(long_long));
@@ -4142,7 +4149,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
/* Make certain that there isn't some weird number of destination bits */
assert(dst_nbits%8==0);
- /* Are the two results the same? */
+ /* Are the two results the same? */
for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++)
if (buf[j*dst_size+k]!=hw[k])
break;
@@ -4166,7 +4173,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* hardware conversion result during overflows is usually garbage
* so we must handle those cases differetly when checking results.
*/
- if (H5T_SGN_2==H5Tget_sign(src) && H5T_SGN_2==H5Tget_sign(dst)) {
+ if (H5T_SGN_2==src_sign && H5T_SGN_2==dst_sign) {
if (src_nbits>dst_nbits) {
if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
@@ -4211,7 +4218,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
continue; /*no error*/
}
}
- } else if (H5T_SGN_2==H5Tget_sign(src) && H5T_SGN_NONE==H5Tget_sign(dst)) {
+ } else if (H5T_SGN_2==src_sign && H5T_SGN_NONE==dst_sign) {
if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
/*
* The source is negative so the result should be zero.
@@ -4231,7 +4238,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
continue; /*no error*/
}
- } else if (H5T_SGN_NONE==H5Tget_sign(src) && H5T_SGN_2==H5Tget_sign(dst)) {
+ } else if (H5T_SGN_NONE==src_sign && H5T_SGN_2==dst_sign) {
if (src_nbits>=dst_nbits &&
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits)+1,
H5T_BIT_LSB, 1)>=0) {
@@ -4690,22 +4697,22 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
goto error;
}
- /* Allocate buffers */
- endian = H5Tget_order(H5T_NATIVE_FLOAT);
+ /* Get "interesting" values */
src_size = H5Tget_size(src);
dst_size = H5Tget_size(dst);
+ dst_ebias=H5Tget_ebias(dst);
+ H5Tget_fields(src,NULL,&src_epos,&src_esize,NULL,NULL);
+ H5Tget_fields(dst,NULL,&dst_epos,&dst_esize,NULL,&dst_msize);
+
+ /* Allocate buffers */
+ endian = H5Tget_order(H5T_NATIVE_FLOAT);
buf = aligned_malloc(nelmts*MAX(src_size, dst_size));
saved = aligned_malloc(nelmts*MAX(src_size, dst_size));
- aligned = malloc(16); /*should be big enough for any type*/
+ aligned = HDmalloc(32); /*should be big enough for any type*/
#ifdef SHOW_OVERFLOWS
noverflows_g = 0;
#endif
- /* Get "interesting" values */
- dst_ebias=H5Tget_ebias(dst);
- H5Tget_fields(src,NULL,&src_epos,&src_esize,NULL,NULL);
- H5Tget_fields(dst,NULL,&dst_epos,&dst_esize,NULL,&dst_msize);
-
for (i=0; i<ntests; i++) {
/*
@@ -4905,7 +4912,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
/* Special check for denormalized values */
if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) {
int expo_diff=check_expo[0]-check_expo[1];
- int valid_bits=((int)(dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1;
+ int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1;
double epsilon=1.0;
/* Re-scale the mantissas based on any exponent difference */
diff --git a/test/extend.c b/test/extend.c
index 07c8dba..aaac754 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -55,7 +55,7 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me
static const hsize_t dims[2] = {NX, NY};
static const hsize_t half_dims[2] = {NX/2, NY/2};
static hsize_t size[2];
- hssize_t offset[2];
+ hsize_t offset[2];
int i, j, k, m;
TESTING(msg);
diff --git a/test/external.c b/test/external.c
index 4dda40c..5921572 100644
--- a/test/external.c
+++ b/test/external.c
@@ -595,7 +595,7 @@ test_2 (hid_t fapl)
int part[25], whole[100]; /*raw data buffers */
hsize_t cur_size; /*current data space size */
hid_t hs_space; /*hyperslab data space */
- hssize_t hs_start = 30; /*hyperslab starting offset */
+ hsize_t hs_start = 30; /*hyperslab starting offset */
hsize_t hs_count = 25; /*hyperslab size */
int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f};
@@ -721,7 +721,7 @@ test_3 (hid_t fapl)
int part[25],whole[100]; /*raw data buffers */
hsize_t cur_size=100; /*current data space size */
hsize_t max_size=200; /*maximum data space size */
- hssize_t hs_start=100; /*hyperslab starting offset */
+ hsize_t hs_start=100; /*hyperslab starting offset */
hsize_t hs_count=100; /*hyperslab size */
char filename[1024]; /*file name */
int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f};
diff --git a/test/file_handle.c b/test/file_handle.c
index 787ce83..1db5e14 100644
--- a/test/file_handle.c
+++ b/test/file_handle.c
@@ -23,7 +23,7 @@
#define KB 1024
#define FAMILY_NUMBER 4
-#define FAMILY_SIZE 128
+#define FAMILY_SIZE 1024
#define MULTI_SIZE 128
#define CORE_INCREMENT 4096
@@ -174,10 +174,9 @@ test_core(void)
goto error;
/* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. Currently, this file size
- * is 976.
+ * Just try to check if it's reasonable. Why is this 4KB?
*/
- if(file_size<KB/2 || file_size>1*KB)
+ if(file_size<2*KB || file_size>6*KB)
goto error;
if(H5Fclose(file)<0)
@@ -239,12 +238,24 @@ test_family(void)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
+ if(H5Fclose(file)<0)
+ goto error;
+
+ /* Tries to reopen the file with member file size smaller than
+ * actual 1st member file size(976 bytes). The library is
+ * supposed to adjust the member size to 976 bytes. */
+ if(H5Pset_fapl_family(fapl, (hsize_t)512, H5P_DEFAULT)<0)
+ goto error;
+
+ if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
+ goto error;
+
/* Check file size API */
if(H5Fget_filesize(file, &file_size) < 0)
goto error;
- /* The file size is supposed to be 2KB right now. */
- if(file_size<1*KB || file_size>4*KB)
+ /* The file size is supposed to be 976 bytes right now. */
+ if(file_size<KB/2 || file_size>4*KB)
goto error;
/* Create and write dataset */
@@ -290,10 +301,15 @@ test_family(void)
if(H5Fget_filesize(file, &file_size) < 0)
goto error;
- /* Some data has been written. The file size should be bigger(4KB) now. */
- if(file_size<2*KB || file_size>6*KB)
- goto error;
-
+ /* Some data has been written. The file size should be bigger(18KB+976 bytes if int size is 4 bytes) now. */
+ if(sizeof(int)<=4) {
+ if(file_size<18*KB || file_size>20*KB)
+ goto error;
+ } else if(sizeof(int)>=8) {
+ if(file_size<32*KB || file_size>40*KB)
+ goto error;
+ }
+
if(H5Sclose(space)<0)
goto error;
if(H5Dclose(dset)<0)
diff --git a/test/filename.c b/test/filename.c
index 79dd19e..32dfd63 100644
--- a/test/filename.c
+++ b/test/filename.c
@@ -19,7 +19,6 @@
* Purpose: Tests the "H5Fget_name" functionality
*/
-#include "h5test.h"
#include "testhdf5.h"
#define FILENAME "get_file_name"
@@ -50,7 +49,6 @@ typedef struct s1_t {
"in %s\n", where, val, x, (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
} \
- strcmp(x, ""); \
} while(0)
int main( void )
diff --git a/test/fillval.c b/test/fillval.c
index 8161cd9..a5a2886 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -605,9 +605,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
hsize_t cur_size[5] = {2, 8, 8, 4, 2};
hsize_t one[5] = {1, 1, 1, 1, 1};
hsize_t hs_size[5], hs_stride[5];
- hssize_t hs_offset[5], nelmts;
+ hsize_t hs_offset[5], nelmts;
int fillval=(-1), val_rd, should_be;
int i, j, *buf=NULL, odd;
+ unsigned u;
comp_datatype rd_c, fill_c, should_be_c;
comp_datatype *buf_c=NULL;
H5D_space_status_t allocation;
@@ -646,11 +647,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
if (fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) {
H5_FAILED();
puts(" Value read was not a fill value.");
- printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
+ HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, "
"Fill value: %u\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4], val_rd, fillval);
+ hs_offset[0], hs_offset[1],
+ hs_offset[2], hs_offset[3],
+ hs_offset[4], val_rd, fillval);
goto error;
}
/* case for compound datatype */
@@ -662,11 +663,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
rd_c.z!=fill_c.z)) {
H5_FAILED();
puts(" Value read was not a fill value.");
- printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f, %d, %f, %c"
+ HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c"
"Fill value: %f, %d, %f, %c\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4], rd_c.a, rd_c.x, rd_c.y, rd_c.z,
+ hs_offset[0], hs_offset[1],
+ hs_offset[2], hs_offset[3],
+ hs_offset[4], rd_c.a, rd_c.x, rd_c.y, rd_c.z,
fill_c.a, fill_c.x, fill_c.y, fill_c.z);
goto error;
}
@@ -688,22 +689,22 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
/* case for atomic datatype */
if(datatype==H5T_INTEGER) {
/*check for overflow*/
- assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int))));
+ assert((nelmts*sizeof(int))==(hsize_t)((size_t)(nelmts*sizeof(int))));
buf = malloc((size_t)(nelmts*sizeof(int)));
- for (i=0; i<nelmts; i++) buf[i] = 9999;
+ for (u=0; u<nelmts; u++) buf[u] = 9999;
if (H5Dwrite(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT,
buf)<0) goto error;
}
/* case for compound datatype */
else if(datatype==H5T_COMPOUND) {
assert((nelmts*sizeof(comp_datatype))==
- (hssize_t)((size_t)(nelmts*sizeof(comp_datatype))));
+ (hsize_t)((size_t)(nelmts*sizeof(comp_datatype))));
buf_c = (comp_datatype*)calloc((size_t)nelmts,sizeof(comp_datatype));
- for (i=0; i<nelmts; i++) {
- buf_c[i].a = (float)1111.11;
- buf_c[i].x = 2222;
- buf_c[i].y = 3333.3333;
- buf_c[i].z = 'd';
+ for (u=0; u<nelmts; u++) {
+ buf_c[u].a = (float)1111.11;
+ buf_c[u].x = 2222;
+ buf_c[u].y = 3333.3333;
+ buf_c[u].z = 'd';
}
if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT,
buf_c)<0) goto error;
@@ -1030,7 +1031,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
hsize_t ch_size[5] = {1, 16, 8, 4, 2};
hsize_t one[5] = {1, 1, 1, 1, 1};
hsize_t hs_size[5], hs_stride[5];
- hssize_t hs_offset[5], nelmts;
+ hsize_t hs_offset[5], nelmts;
#ifdef NO_FILLING
int fillval = 0;
#else
@@ -1038,6 +1039,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
#endif
int val_rd, should_be;
int i, j, *buf=NULL, odd, fd;
+ unsigned u;
char filename[1024];
if (H5D_CHUNKED==layout) {
@@ -1127,11 +1129,11 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
if (val_rd!=fillval) {
H5_FAILED();
puts(" Value read was not a fill value.");
- printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
+ HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, "
"Fill value: %u\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4], val_rd, fillval);
+ hs_offset[0], hs_offset[1],
+ hs_offset[2], hs_offset[3],
+ hs_offset[4], val_rd, fillval);
goto error;
}
}
@@ -1145,9 +1147,9 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
nelmts *= hs_size[i];
}
if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error;
- assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/
+ assert((nelmts*sizeof(int))==(hsize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/
buf = malloc((size_t)(nelmts*sizeof(int)));
- for (i=0; i<nelmts; i++) buf[i] = 9999;
+ for (u=0; u<nelmts; u++) buf[u] = 9999;
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride,
hs_size, NULL)<0) goto error;
if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT,
@@ -1172,11 +1174,11 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
if (val_rd!=should_be) {
H5_FAILED();
puts(" Value read was not correct.");
- printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
+ HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, "
"should be: %u\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4], val_rd, should_be);
+ hs_offset[0], hs_offset[1],
+ hs_offset[2], hs_offset[3],
+ hs_offset[4], val_rd, should_be);
goto error;
}
}
@@ -1208,11 +1210,11 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
if (val_rd!=should_be) {
H5_FAILED();
puts(" Value read was not correct.");
- printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
+ HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, "
"should be: %u\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4], val_rd, should_be);
+ hs_offset[0], hs_offset[1],
+ hs_offset[2], hs_offset[3],
+ hs_offset[4], val_rd, should_be);
goto error;
}
}
@@ -1270,7 +1272,7 @@ test_compatible(void)
hid_t dcpl1=-1, dcpl2=-1, fspace=-1, mspace=-1;
int rd_fill=0, fill_val=4444, val_rd=0;
hsize_t dims[2], one[2]={1,1};
- hssize_t hs_offset[2]={3,4};
+ hsize_t hs_offset[2]={3,4};
H5D_fill_value_t status;
char *srcdir = getenv("srcdir"); /*where the src code is located*/
char testfile[512]=""; /* test file name */
diff --git a/test/getname.c b/test/getname.c
index 3e714f8..33b9141 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -1505,7 +1505,7 @@ PASSED();
if (H5Iget_name( type_id, name, size )<0) goto out;
if (check_name( name, "/g18/t2" )!=0) goto out;
- /* Get name for the IDs of the secondt file, should be "" */
+ /* Get name for the IDs of the second file, should be "" */
if (H5Iget_name( group6_id, name, size )<0) goto out;
if (check_name( name, "" )!=0) goto out;
diff --git a/test/h5test.c b/test/h5test.c
index 7c69e70..4e025888 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -148,7 +148,7 @@ h5_cleanup(const char *base_name[], hid_t fapl)
if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL)
continue;
- driver = H5Pget_driver(fapl);
+ driver = H5Pget_driver(fapl);
if (driver == H5FD_FAMILY) {
for (j = 0; /*void*/; j++) {
@@ -170,7 +170,7 @@ h5_cleanup(const char *base_name[], hid_t fapl)
} else if (driver == H5FD_MULTI) {
H5FD_mem_t mt;
- assert(strlen(multi_letters)==H5FD_MEM_NTYPES);
+ assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
HDsnprintf(temp, sizeof temp, "%s-%c.h5",
@@ -266,13 +266,10 @@ char *
h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
const char *prefix = NULL;
- const char *suffix = ".h5"; /* suffix has default */
+ const char *suffix = ".h5"; /* suffix has default */
char *ptr, last = '\0';
size_t i, j;
-#ifdef H5_HAVE_PARALLEL
- static int HDF5_PARAPREFIX_explained=0;
-#endif /* H5_HAVE_PARALLEL */
- hid_t driver=(-1);
+ hid_t driver = -1;
if (!base_name || !fullname || size < 1)
return NULL;
@@ -280,7 +277,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
memset(fullname, 0, size);
/* figure out the suffix */
- if (H5P_DEFAULT != fapl){
+ if (H5P_DEFAULT != fapl) {
if ((driver = H5Pget_driver(fapl)) < 0)
return NULL;
@@ -293,15 +290,21 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
/* Use different ones depending on parallel or serial driver used. */
if (H5P_DEFAULT != fapl && H5FD_MPIO == driver){
#ifdef H5_HAVE_PARALLEL
- /* For parallel:
- * First use command line option, then the environment variable,
- * then try the constant
+ /*
+ * For parallel:
+ * First use command line option, then the environment
+ * variable, then try the constant
*/
+ static int explained = 0;
+
prefix = (paraprefix ? paraprefix : getenv("HDF5_PARAPREFIX"));
- if (!prefix && !HDF5_PARAPREFIX_explained){
+
+ if (!prefix && !explained) {
/* print hint by process 0 once. */
int mpi_rank;
+
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
if (mpi_rank == 0)
printf("*** Hint ***\n"
"You can use environment variable HDF5_PARAPREFIX to "
@@ -310,15 +313,17 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
" HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
" export HDF5_PARAPREFIX\n"
"*** End of Hint ***\n");
- HDF5_PARAPREFIX_explained++;
+
+ explained = TRUE;
#ifdef HDF5_PARAPREFIX
prefix = HDF5_PARAPREFIX;
#endif /* HDF5_PARAPREFIX */
}
-#endif
- }else{
- /* For serial:
- * First use the environment variable, then try the constant
+#endif /* H5_HAVE_PARALLEL */
+ } else {
+ /*
+ * For serial:
+ * First use the environment variable, then try the constant
*/
prefix = HDgetenv("HDF5_PREFIX");
@@ -335,9 +340,11 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
char *subdir;
if (!HDstrcmp(prefix, HDF5_PARAPREFIX)) {
- /* If the prefix specifies the HDF5_PARAPREFIX directory, then
+ /*
+ * If the prefix specifies the HDF5_PARAPREFIX directory, then
* default to using the "/tmp/$USER" or "/tmp/$LOGIN"
- * directory instead. */
+ * directory instead.
+ */
char *user, *login;
user = HDgetenv("USER");
@@ -350,7 +357,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
fullname[i++] = '/';
- for (j = 0; i < size && subdir[j]; i++, j++)
+ for (j = 0; i < size && subdir[j]; ++i, ++j)
fullname[i] = subdir[j];
}
}
@@ -360,17 +367,21 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
HDstrncpy(fullname, prefix, MIN(strlen(prefix), size));
if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
- /* Append the base_name with a slash first. Multiple slashes are
- * handled below. */
+ /*
+ * Append the base_name with a slash first. Multiple
+ * slashes are handled below.
+ */
h5_stat_t buf;
if (HDstat(fullname, &buf) < 0)
/* The directory doesn't exist just yet */
- if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) {
- /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
- * Default to PREFIX's original prefix value. */
+ if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST)
+ /*
+ * We couldn't make the "/tmp/${USER,LOGIN}"
+ * subdirectory. Default to PREFIX's original
+ * prefix value.
+ */
HDstrcpy(fullname, prefix);
- }
HDstrcat(fullname, "/");
HDstrcat(fullname, base_name);
@@ -435,13 +446,6 @@ h5_fileaccess(void)
const char *name;
char s[1024];
hid_t fapl = -1;
- hsize_t fam_size = 100*1024*1024; /*100 MB*/
-#ifdef H5_WANT_H5_V1_4_COMPAT
- long verbosity = 1;
-#else /* H5_WANT_H5_V1_4_COMPAT */
- long log_flags = H5FD_LOG_LOC_IO;
-#endif /* H5_WANT_H5_V1_4_COMPAT */
- H5FD_mem_t mt;
/* First use the environment variable, then the constant */
val = HDgetenv("HDF5_DRIVER");
@@ -478,6 +482,7 @@ h5_fileaccess(void)
const char *memb_name[H5FD_MEM_NTYPES];
char sv[H5FD_MEM_NTYPES][1024];
haddr_t memb_addr[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt;
HDmemset(memb_map, 0, sizeof memb_map);
HDmemset(memb_fapl, 0, sizeof memb_fapl);
@@ -497,13 +502,17 @@ h5_fileaccess(void)
return -1;
}
} else if (!HDstrcmp(name, "family")) {
+ hsize_t fam_size = 100*1024*1024; /*100 MB*/
+
/* Family of files, each 1MB and using the default driver */
- if ((val=HDstrtok(NULL, " \t\n\r"))) {
+ if ((val=HDstrtok(NULL, " \t\n\r")))
fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
- }
- if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1;
+ if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
+ return -1;
} else if (!HDstrcmp(name, "log")) {
#ifdef H5_WANT_H5_V1_4_COMPAT
+ long verbosity = 1;
+
/* Log file access */
if ((val = strtok(NULL, " \t\n\r")))
verbosity = strtol(val, NULL, 0);
@@ -511,11 +520,13 @@ h5_fileaccess(void)
if (H5Pset_fapl_log(fapl, NULL, (int)verbosity) < 0)
return -1;
#else /* H5_WANT_H5_V1_4_COMPAT */
+ unsigned log_flags = H5FD_LOG_LOC_IO;
+
/* Log file access */
if ((val = HDstrtok(NULL, " \t\n\r")))
- log_flags = HDstrtol(val, NULL, 0);
+ log_flags = (unsigned)HDstrtol(val, NULL, 0);
- if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0)
+ if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0)
return -1;
#endif /* H5_WANT_H5_V1_4_COMPAT */
} else {
@@ -781,17 +792,64 @@ h5_get_file_size(const char *filename)
/*
* This routine is designed to provide equivalent functionality to 'printf'
* and allow easy replacement for environments which don't have stdin/stdout
- * available. (i.e. Windows & the Mac)
+ * available. (i.e. Windows & the Mac)
*/
int
-print_func(const char *format,...)
+print_func(const char *format, ...)
{
- va_list arglist;
- int ret_value;
+ va_list arglist;
+ int ret_value;
- va_start(arglist, format);
- ret_value = vprintf(format, arglist);
- va_end(arglist);
- return (ret_value);
+ va_start(arglist, format);
+ ret_value = vprintf(format, arglist);
+ va_end(arglist);
+ return ret_value;
}
+#ifdef H5_HAVE_FILTER_SZIP
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_szip_can_encode
+ *
+ * Purpose: Retrieve the filter config flags for szip, tell if
+ * encoder is available.
+ *
+ * Return: 1: decode+encode is enabled
+ * 0: only decode is enabled
+ * -1: other
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int h5_szip_can_encode(void )
+{
+
+ herr_t status;
+ unsigned int filter_config_flags;
+
+ status =H5Zget_filter_info(H5Z_FILTER_SZIP, &filter_config_flags);
+ if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
+ /* filter present but neither encode nor decode is supported (???) */
+ return -1;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_DECODE_ENABLED) {
+ /* decoder only: read but not write */
+ return 0;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
+ /* encoder only: write but not read (???) */
+ return -1;
+ } else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
+ return 1;
+ }
+}
+#endif /* H5_HAVE_FILTER_SZIP */
diff --git a/test/h5test.h b/test/h5test.h
index 886a681..ac73506 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -140,6 +140,10 @@ H5TEST_DLL int TestErrPrintf(const char *format, ...);
H5TEST_DLL void SetTest(const char *testname, int action);
+#ifdef H5_HAVE_FILTER_SZIP
+H5TEST_DLL int h5_szip_can_encode(void);
+#endif /* H5_HAVE_FILTER_SZIP */
+
#ifdef H5_HAVE_PARALLEL
H5TEST_DLL int h5_set_info_object(void);
H5TEST_DLL void h5_dump_info_object(MPI_Info info);
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 720dc0f..59a9e08 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -160,7 +160,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
uint8_t *dst = NULL; /*destination array */
hsize_t hs_size[3]; /*hyperslab size */
hsize_t dst_size[3]; /*destination total size */
- hssize_t dst_offset[3]; /*offset of hyperslab in dest */
+ hsize_t dst_offset[3]; /*offset of hyperslab in dest */
unsigned ref_value; /*reference value */
unsigned acc; /*accumulator */
size_t i, j, k, dx, dy, dz; /*counters */
@@ -206,9 +206,9 @@ test_fill(size_t nx, size_t ny, size_t nz,
dst_size[0] = nx;
dst_size[1] = ny;
dst_size[2] = nz;
- dst_offset[0] = (hssize_t)i;
- dst_offset[1] = (hssize_t)j;
- dst_offset[2] = (hssize_t)k;
+ dst_offset[0] = i;
+ dst_offset[1] = j;
+ dst_offset[2] = k;
hs_size[0] = dx;
hs_size[1] = dy;
hs_size[2] = dz;
@@ -221,13 +221,13 @@ test_fill(size_t nx, size_t ny, size_t nz,
* original * fill values and add the new ones.
*/
ref_value = init_full(dst, nx, ny, nz);
- for (u=(size_t)dst_offset[0];
+ for (u=dst_offset[0];
u<dst_offset[0]+dx;
u++) {
- for (v = (size_t)dst_offset[1];
+ for (v = dst_offset[1];
v < dst_offset[1] + dy;
v++) {
- for (w = (size_t)dst_offset[2];
+ for (w = dst_offset[2];
w < dst_offset[2] + dz;
w++) {
ref_value -= dst[u*ny*nz+v*nz+w];
@@ -333,8 +333,8 @@ test_copy(int mode,
hsize_t hs_size[3]; /*hyperslab size */
hsize_t dst_size[3]; /*destination total size */
hsize_t src_size[3]; /*source total size */
- hssize_t dst_offset[3]; /*offset of hyperslab in dest */
- hssize_t src_offset[3]; /*offset of hyperslab in source */
+ hsize_t dst_offset[3]; /*offset of hyperslab in dest */
+ hsize_t src_offset[3]; /*offset of hyperslab in source */
unsigned ref_value; /*reference value */
unsigned acc; /*accumulator */
hsize_t i, j, k, dx, dy, dz; /*counters */
@@ -422,25 +422,25 @@ test_copy(int mode,
dst_offset[0] = 0;
dst_offset[1] = 0;
dst_offset[2] = 0;
- src_offset[0] = (hssize_t)i;
- src_offset[1] = (hssize_t)j;
- src_offset[2] = (hssize_t)k;
+ src_offset[0] = i;
+ src_offset[1] = j;
+ src_offset[2] = k;
break;
case VARIABLE_DST:
- dst_offset[0] = (hssize_t)i;
- dst_offset[1] = (hssize_t)j;
- dst_offset[2] = (hssize_t)k;
+ dst_offset[0] = i;
+ dst_offset[1] = j;
+ dst_offset[2] = k;
src_offset[0] = 0;
src_offset[1] = 0;
src_offset[2] = 0;
break;
case VARIABLE_BOTH:
- dst_offset[0] = (hssize_t)i;
- dst_offset[1] = (hssize_t)j;
- dst_offset[2] = (hssize_t)k;
- src_offset[0] = (hssize_t)i;
- src_offset[1] = (hssize_t)j;
- src_offset[2] = (hssize_t)k;
+ dst_offset[0] = i;
+ dst_offset[1] = j;
+ dst_offset[2] = k;
+ src_offset[0] = i;
+ src_offset[1] = j;
+ src_offset[2] = k;
break;
default:
abort();
@@ -608,8 +608,8 @@ test_multifill(size_t nx)
{
hsize_t i, j;
hsize_t size;
- hssize_t src_stride;
- hssize_t dst_stride;
+ hsize_t src_stride;
+ hsize_t dst_stride;
char s[64];
struct a_struct {
@@ -743,7 +743,7 @@ test_endian(size_t nx)
size[1] = 4;
/* Copy the array */
- H5V_stride_copy(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
+ H5V_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
/* Compare */
for (i = 0; i < nx; i++) {
@@ -802,7 +802,7 @@ test_transpose(size_t nx, size_t ny)
int *src = NULL;
int *dst = NULL;
hsize_t i, j;
- hssize_t src_stride[2], dst_stride[2];
+ hsize_t src_stride[2], dst_stride[2];
hsize_t size[2];
char s[256];
@@ -906,8 +906,8 @@ test_sub_super(size_t nx, size_t ny)
uint8_t *full = NULL; /*original image */
uint8_t *half = NULL; /*image at 1/2 resolution */
uint8_t *twice = NULL; /*2x2 pixels */
- hssize_t src_stride[4]; /*source stride info */
- hssize_t dst_stride[4]; /*destination stride info */
+ hsize_t src_stride[4]; /*source stride info */
+ hsize_t dst_stride[4]; /*destination stride info */
hsize_t size[4]; /*number of sample points */
hsize_t i, j;
char s[256];
@@ -1077,7 +1077,7 @@ test_array_fill(size_t lo, size_t hi)
/* Setup */
for(u=0; u<ARRAY_FILL_SIZE; u++)
- src[u]=(int)u;
+ src[u]=(char)u;
/* Fill */
for(w=lo; w<=hi; w++) {
@@ -1125,8 +1125,8 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
hsize_t off; /* Offset in array */
size_t u, v, w; /* Local index variables */
hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */
- hssize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
- hssize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
+ hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
+ hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
char s[256];
sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x);
diff --git a/test/istore.c b/test/istore.c
index f7baf31..2f3f907 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -53,7 +53,7 @@ const char *FILENAME[] = {
#endif /* H5_HAVE_LARGE_HSIZET */
hsize_t chunk_dims[H5O_LAYOUT_NDIMS];
-hssize_t zero[H5O_LAYOUT_NDIMS];
+hsize_t zero[H5O_LAYOUT_NDIMS];
/*-------------------------------------------------------------------------
@@ -228,8 +228,8 @@ test_extend(hid_t f, const char *prefix,
int ndims;
uint8_t *buf = NULL, *check = NULL, *whole = NULL;
char dims[64], s[256], name[256];
- hssize_t offset[3];
- hssize_t max_corner[3];
+ hsize_t offset[3];
+ hsize_t max_corner[3];
hsize_t size[3];
hsize_t whole_size[3];
hsize_t nelmts;
@@ -274,7 +274,7 @@ test_extend(hid_t f, const char *prefix,
if((fspace=H5Dget_space(dataset))<0) TEST_ERROR;
for (ctr = 0;
- H5V_vector_lt_s((unsigned)ndims, max_corner, (hssize_t*)whole_size);
+ H5V_vector_lt_u((unsigned)ndims, max_corner, whole_size);
ctr++) {
/* Size and location */
@@ -359,9 +359,8 @@ test_extend(hid_t f, const char *prefix,
size, H5V_ZERO, buf); /*src*/
/* Update max corner */
- for (i=0; i<(size_t)ndims; i++) {
- max_corner[i] = MAX(max_corner[i], offset[i]+(hssize_t)size[i]);
- }
+ for (i=0; i<(size_t)ndims; i++)
+ max_corner[i] = MAX(max_corner[i], offset[i]+size[i]);
}
/* Now read the entire array back out and check it */
@@ -442,7 +441,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
int ndims;
hsize_t ctr;
char dims[64], s[256], name[256];
- hssize_t offset[3];
+ hsize_t offset[3];
hsize_t size[3], total = 0;
uint8_t *buf = NULL;
hsize_t whole_size[3]; /* Size of dataset's dataspace */
@@ -492,9 +491,9 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
if((mspace=H5Screate_simple(ndims,size,NULL))<0) TEST_ERROR;
for (ctr=0; ctr<nblocks; ctr++) {
- offset[0] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx));
- offset[1] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny));
- offset[2] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz));
+ offset[0] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx));
+ offset[1] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny));
+ offset[2] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz));
/* Select region in file dataspace */
if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL)<0) TEST_ERROR;
diff --git a/test/ntypes.c b/test/ntypes.c
index 6b7c827..bcbbcf8 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -13,10 +13,10 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu
- * October 14, 2001
+ * Programmer: Raymond Lu
+ * October 14, 2001
*
- * Purpose: Tests the H5Tget_native_type function.
+ * Purpose: Tests the H5Tget_native_type function.
*/
#include "h5test.h"
@@ -30,23 +30,24 @@ const char *FILENAME[] = {
#define DIM1 200
#define DIM3 20
-int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
-short spoints2[DIM0][DIM1], scheck2[DIM0][DIM1];
-int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5];
-#define DSET_ATOMIC_NAME_1 "atomic_type_1"
-#define DSET_ATOMIC_NAME_2 "atomic_type_2"
-#define DSET_ATOMIC_NAME_3 "atomic_type_3"
-#define DSET_ATOMIC_NAME_4 "atomic_type_4"
-#define DSET_ATOMIC_NAME_5 "atomic_type_5"
+int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
+short spoints2[DIM0][DIM1], scheck2[DIM0][DIM1];
+int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5];
+
+#define DSET_ATOMIC_NAME_1 "atomic_type_1"
+#define DSET_ATOMIC_NAME_2 "atomic_type_2"
+#define DSET_ATOMIC_NAME_3 "atomic_type_3"
+#define DSET_ATOMIC_NAME_4 "atomic_type_4"
+#define DSET_ATOMIC_NAME_5 "atomic_type_5"
#define DSET_COMPOUND_NAME "compound_type"
#define DSET_COMPOUND_NAME_2 "compound_type_2"
#define DSET_COMPOUND_NAME_3 "compound_type_3"
#define DSET_COMPOUND_NAME_4 "compound_type_4"
-#define DSET_ENUM_NAME "enum_type"
-#define DSET_ARRAY_NAME "array_type"
-#define DSET_ARRAY2_NAME "array_type_2"
-#define DSET_VL_NAME "vl_type"
+#define DSET_ENUM_NAME "enum_type"
+#define DSET_ARRAY_NAME "array_type"
+#define DSET_ARRAY2_NAME "array_type_2"
+#define DSET_VL_NAME "vl_type"
#define DSET_VLSTR_NAME "vlstr_type"
#define DSET_STR_NAME "str_type"
#define DSET_OPAQUE_NAME "opaque_type"
@@ -54,22 +55,22 @@ int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5];
#define SPACE1_DIM1 4
#define SPACE1_RANK 1
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 10
+#define SPACE2_DIM2 10
/*-------------------------------------------------------------------------
- * Function: test_atomic_dtype
+ * Function: test_atomic_dtype
*
- * Purpose: Test H5Tget_native_type for atomic datatype
+ * Purpose: Test H5Tget_native_type for atomic datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -78,19 +79,19 @@ int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5];
static herr_t
test_atomic_dtype(hid_t file)
{
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t dtype, native_type;
- int i, j, n;
- hsize_t dims[2];
+ int i, j, n;
+ hsize_t dims[2];
void *tmp;
TESTING("atomic datatype");
/* Initialize the dataset */
for (i = n = 0; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++) {
- ipoints2[i][j] = n++;
- }
+ for (j = 0; j < DIM1; j++) {
+ ipoints2[i][j] = n++;
+ }
}
/* Create the data space */
@@ -101,11 +102,11 @@ test_atomic_dtype(hid_t file)
/*------------------- Test data values ------------------------*/
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Write the data to the dataset */
if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -131,7 +132,7 @@ test_atomic_dtype(hid_t file)
tmp = malloc((size_t)(DIM0*DIM1*H5Tget_size(native_type)));
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Copy data from temporary buffer to destination buffer */
memcpy(icheck2, tmp, (size_t)(DIM0*DIM1*H5Tget_size(native_type)));
@@ -143,14 +144,14 @@ test_atomic_dtype(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++) {
- if (ipoints2[i][j] != icheck2[i][j]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
- goto error;
- }
- }
+ for (j = 0; j < DIM1; j++) {
+ if (ipoints2[i][j] != icheck2[i][j]) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ goto error;
+ }
+ }
}
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -161,7 +162,7 @@ test_atomic_dtype(hid_t file)
/* Create the dataset of H5T_STD_I64LE */
if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
if((dtype=H5Dget_type(dataset))<0) TEST_ERROR;
@@ -183,7 +184,7 @@ test_atomic_dtype(hid_t file)
/* Create the dataset of H5T_STD_I8LE */
if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
if((dtype=H5Dget_type(dataset))<0) TEST_ERROR;
@@ -205,7 +206,7 @@ test_atomic_dtype(hid_t file)
/* Create the dataset of H5T_IEEE_F32BE */
if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
if((dtype=H5Dget_type(dataset))<0) TEST_ERROR;
@@ -227,7 +228,7 @@ test_atomic_dtype(hid_t file)
/* Create the dataset of H5T_IEEE_F64BE */
if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
if((dtype=H5Dget_type(dataset))<0) TEST_ERROR;
@@ -259,16 +260,16 @@ test_atomic_dtype(hid_t file)
/*-------------------------------------------------------------------------
- * Function: test_compound_dtype2
+ * Function: test_compound_dtype2
*
- * Purpose: Test H5Tget_native_type for compound datatype
+ * Purpose: Test H5Tget_native_type for compound datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -287,13 +288,13 @@ test_compound_dtype2(hid_t file)
s2 st;
unsigned long_long l;
} s1;
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t dtype, native_type, tid, tid2, tid_m, tid_m2,
mem_id, nest_mem_id;
- int i, j, n;
- hsize_t dims[2];
+ int i, j, n;
+ hsize_t dims[2];
s1 *temp_point, *temp_check;
- s1 *points=NULL, *check=NULL;
+ s1 *points=NULL, *check=NULL;
void *tmp, *bkg;
TESTING("nested compound datatype");
@@ -306,13 +307,13 @@ test_compound_dtype2(hid_t file)
/* Initialize the dataset */
for (i = n = 0, temp_point=points; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++,temp_point++) {
- temp_point->c = 't';
- temp_point->i = n++;
- temp_point->st.c2 = i+j;
- temp_point->st.l2 = (i*5+j*50)*n;
- temp_point->l = (i*10+j*100)*n;
- }
+ for (j = 0; j < DIM1; j++,temp_point++) {
+ temp_point->c = 't';
+ temp_point->i = n++;
+ temp_point->st.c2 = i+j;
+ temp_point->st.l2 = (i*5+j*50)*n;
+ temp_point->l = (i*10+j*100)*n;
+ }
}
/* Create the data space */
@@ -354,7 +355,7 @@ test_compound_dtype2(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_2, tid, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Create compound datatype for memory */
if((tid_m2=H5Tcreate(H5T_COMPOUND, sizeof(s2)))<0) TEST_ERROR;
@@ -370,7 +371,7 @@ test_compound_dtype2(hid_t file)
/* Write the data to the dataset */
if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -457,7 +458,7 @@ test_compound_dtype2(hid_t file)
TEST_ERROR;
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type));
free(tmp);
@@ -469,18 +470,18 @@ test_compound_dtype2(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
- if (temp_point->c != temp_check->c ||
- temp_point->i != temp_check->i ||
- temp_point->st.c2 != temp_check->st.c2 ||
- temp_point->st.l2 != temp_check->st.l2 ||
- temp_point->l != temp_check->l ) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
- goto error;
- }
- }
+ for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
+ if (temp_point->c != temp_check->c ||
+ temp_point->i != temp_check->i ||
+ temp_point->st.c2 != temp_check->st.c2 ||
+ temp_point->st.l2 != temp_check->st.l2 ||
+ temp_point->l != temp_check->l ) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ goto error;
+ }
+ }
}
/* Close temporary datatypes */
@@ -511,16 +512,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_compound_dtype
+ * Function: test_compound_dtype
*
- * Purpose: Test H5Tget_native_type for compound datatype
+ * Purpose: Test H5Tget_native_type for compound datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -534,12 +535,12 @@ test_compound_dtype(hid_t file)
unsigned int i;
long_long l;
} s1;
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t dtype, native_type, tid, tid2, mem_id;
- int i, j, n;
- hsize_t dims[2];
+ int i, j, n;
+ hsize_t dims[2];
s1 *temp_point, *temp_check;
- s1 *points, *check;
+ s1 *points, *check;
void *tmp, *bkg;
TESTING("compound datatype");
@@ -553,11 +554,11 @@ test_compound_dtype(hid_t file)
/* Initialize the dataset */
for (i = n = 0, temp_point=points; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++,temp_point++) {
- temp_point->c = 't';
- temp_point->i = n++;
- temp_point->l = (i*10+j*100)*n;
- }
+ for (j = 0; j < DIM1; j++,temp_point++) {
+ temp_point->c = 't';
+ temp_point->i = n++;
+ temp_point->l = (i*10+j*100)*n;
+ }
}
/* Create the data space */
@@ -575,7 +576,7 @@ test_compound_dtype(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME, tid, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Create compound datatype for datatype in memory */
if((tid2=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR;
@@ -585,7 +586,7 @@ test_compound_dtype(hid_t file)
/* Write the data to the dataset */
if (H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -639,7 +640,7 @@ test_compound_dtype(hid_t file)
bkg = calloc(sizeof(s1),DIM0*DIM1);
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type));
free(tmp);
@@ -651,16 +652,16 @@ test_compound_dtype(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
- if (temp_point->c != temp_check->c ||
- temp_point->i != temp_check->i ||
- temp_point->l != temp_check->l ) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
- goto error;
- }
- }
+ for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
+ if (temp_point->c != temp_check->c ||
+ temp_point->i != temp_check->i ||
+ temp_point->l != temp_check->l ) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ goto error;
+ }
+ }
}
/* Close datatype */
@@ -684,16 +685,16 @@ test_compound_dtype(hid_t file)
/*-------------------------------------------------------------------------
- * Function: test_compound_dtype3
+ * Function: test_compound_dtype3
*
- * Purpose: Test H5Tget_native_type for compound datatype
+ * Purpose: Test H5Tget_native_type for compound datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -707,14 +708,14 @@ test_compound_dtype3(hid_t file)
int a[5];
long_long l;
} s1;
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t dtype, native_type, tid, tid2, tid_m, tid_m2,
mem_id, nest_mem_id;
hsize_t array_dims[1]={5};
- int i, j, k, n;
- hsize_t dims[2];
+ int i, j, k, n;
+ hsize_t dims[2];
s1 *temp_point, *temp_check;
- s1 *points=NULL, *check=NULL;
+ s1 *points=NULL, *check=NULL;
void *tmp, *bkg;
TESTING("compound datatype with array as field");
@@ -727,12 +728,12 @@ test_compound_dtype3(hid_t file)
/* Initialize the dataset */
for (i = n = 0, temp_point=points; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++,temp_point++) {
- temp_point->c = 't';
- temp_point->l = (i*10+j*100)*n;
- for (k = 0; k < 5; k++)
- (temp_point->a)[k] = n++;
- }
+ for (j = 0; j < DIM1; j++,temp_point++) {
+ temp_point->c = 't';
+ temp_point->l = (i*10+j*100)*n;
+ for (k = 0; k < 5; k++)
+ (temp_point->a)[k] = n++;
+ }
}
/* Create the data space */
@@ -753,7 +754,7 @@ test_compound_dtype3(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_3, tid, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Create array datatype */
if((tid_m2=H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL))<0) TEST_ERROR;
@@ -766,7 +767,7 @@ test_compound_dtype3(hid_t file)
/* Write the data to the dataset */
if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -833,7 +834,7 @@ test_compound_dtype3(hid_t file)
TEST_ERROR;
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type));
free(tmp);
@@ -845,24 +846,24 @@ test_compound_dtype3(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
- if (temp_point->c != temp_check->c ||
- temp_point->l != temp_check->l ) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
- goto error;
- }
-
- for (k = 0; k < 5; k++) {
+ for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
+ if (temp_point->c != temp_check->c ||
+ temp_point->l != temp_check->l ) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ goto error;
+ }
+
+ for (k = 0; k < 5; k++) {
if(temp_point->a[k] != temp_check->a[k]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d,%d\n", i, j, k);
- goto error;
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d,%d\n", i, j, k);
+ goto error;
}
}
- }
+ }
}
H5Dclose(dataset);
@@ -884,16 +885,16 @@ test_compound_dtype3(hid_t file)
/*-------------------------------------------------------------------------
- * Function: test_compound_opaque
+ * Function: test_compound_opaque
*
- * Purpose: Test H5Tget_native_type for compound datatype with opaque field
+ * Purpose: Test H5Tget_native_type for compound datatype with opaque field
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Quincey Koziol
- * January 31, 2004
+ * Programmer: Quincey Koziol
+ * January 31, 2004
*
* Modifications:
*
@@ -907,13 +908,13 @@ test_compound_opaque(hid_t file)
unsigned char o[5];
long_long l;
} s1;
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t dtype, native_type, tid, tid2, tid_m,
mem_id;
- int i, j, k, n;
- hsize_t dims[2];
+ int i, j, k, n;
+ hsize_t dims[2];
s1 *temp_point, *temp_check;
- s1 *points=NULL, *check=NULL;
+ s1 *points=NULL, *check=NULL;
void *tmp, *bkg;
TESTING("compound datatype with opaque field");
@@ -926,12 +927,12 @@ test_compound_opaque(hid_t file)
/* Initialize the dataset */
for (i = n = 0, temp_point=points; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++,temp_point++) {
- temp_point->c = 't';
- temp_point->l = (i*10+j*100)*n;
- for (k = 0; k < 5; k++)
- (temp_point->o)[k] = n++;
- }
+ for (j = 0; j < DIM1; j++,temp_point++) {
+ temp_point->c = 't';
+ temp_point->l = (i*10+j*100)*n;
+ for (k = 0; k < 5; k++)
+ (temp_point->o)[k] = n++;
+ }
}
/* Create the data space */
@@ -953,7 +954,7 @@ test_compound_opaque(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_4, tid, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Create compound datatype for datatype in memory */
if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR;
@@ -963,7 +964,7 @@ test_compound_opaque(hid_t file)
/* Write the data to the dataset */
if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -1023,7 +1024,7 @@ test_compound_opaque(hid_t file)
TEST_ERROR;
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
HDmemcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type));
HDfree(tmp);
@@ -1035,24 +1036,24 @@ test_compound_opaque(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
- if (temp_point->c != temp_check->c ||
- temp_point->l != temp_check->l ) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
- goto error;
- }
-
- for (k = 0; k < 5; k++) {
+ for (j = 0; j < DIM1; j++, temp_point++,temp_check++) {
+ if (temp_point->c != temp_check->c ||
+ temp_point->l != temp_check->l ) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ goto error;
+ }
+
+ for (k = 0; k < 5; k++) {
if(temp_point->o[k] != temp_check->o[k]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d,%d\n", i, j, k);
- goto error;
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d,%d\n", i, j, k);
+ goto error;
}
}
- }
+ }
}
H5Dclose(dataset);
@@ -1073,16 +1074,16 @@ test_compound_opaque(hid_t file)
/*-------------------------------------------------------------------------
- * Function: test_enum_dtype
+ * Function: test_enum_dtype
*
- * Purpose: Test H5Tget_native_type for enumerate datatype
+ * Purpose: Test H5Tget_native_type for enumerate datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -1091,10 +1092,10 @@ test_compound_opaque(hid_t file)
static herr_t
test_enum_dtype(hid_t file)
{
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t tid, tid_m, dtype, native_type;
- int i, j, n;
- hsize_t dims[2];
+ int i, j, n;
+ hsize_t dims[2];
void *tmp;
short colors[8];
unsigned char sub_colors[16];
@@ -1112,7 +1113,7 @@ test_enum_dtype(hid_t file)
/* Initialize the dataset */
for (i = 0; i < DIM0; i++) {
for (j=0, n=0; j < DIM1; j++, n++)
- spoints2[i][j] = (i*10+j*100+n)%8;
+ spoints2[i][j] = (i*10+j*100+n)%8;
}
/* Create the data space */
@@ -1131,7 +1132,7 @@ test_enum_dtype(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_ENUM_NAME, tid, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Construct enum type based on native type in memory */
if((tid_m=H5Tenum_create(H5T_NATIVE_SHORT))<0) TEST_ERROR;
@@ -1143,7 +1144,7 @@ test_enum_dtype(hid_t file)
/* Write the data to the dataset */
if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, spoints2)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -1167,7 +1168,7 @@ test_enum_dtype(hid_t file)
tmp = malloc(DIM0*DIM1*H5Tget_size(native_type));
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
memcpy(scheck2, tmp, DIM0*DIM1*H5Tget_size(native_type));
free(tmp);
@@ -1177,16 +1178,16 @@ test_enum_dtype(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++) {
- if (spoints2[i][j] != scheck2[i][j]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
+ for (j = 0; j < DIM1; j++) {
+ if (spoints2[i][j] != scheck2[i][j]) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
printf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j],
scheck2[i][j]);
- goto error;
- }
- }
+ goto error;
+ }
+ }
}
H5Dclose(dataset);
@@ -1202,16 +1203,16 @@ test_enum_dtype(hid_t file)
/*-------------------------------------------------------------------------
- * Function: test_array_dtype
+ * Function: test_array_dtype
*
- * Purpose: Test H5Tget_native_type for array datatype
+ * Purpose: Test H5Tget_native_type for array datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -1225,12 +1226,12 @@ test_array_dtype(hid_t file)
int i;
long_long l;
} s1;
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t dtype, native_type, tid, tid2, tid3, tid_m;
- int i, j, k, n;
- hsize_t space_dims[2], array_dims[1]={5};
+ int i, j, k, n;
+ hsize_t space_dims[2], array_dims[1]={5};
s1 *temp_point, *temp_check;
- s1 *points=NULL, *check=NULL;
+ s1 *points=NULL, *check=NULL;
void *tmp;
TESTING("array of compound datatype");
@@ -1243,7 +1244,7 @@ test_array_dtype(hid_t file)
/* Initialize the dataset */
for(i = n = 0, temp_point=points; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
+ for(j = 0; j < DIM1; j++)
for(k = 0; k < 5; k++,temp_point++) {
temp_point->c= 't';
temp_point->i= n++;
@@ -1268,7 +1269,7 @@ test_array_dtype(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_ARRAY_NAME, tid, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Create compound datatype for datatype in memory */
if((tid3=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR;
@@ -1281,7 +1282,7 @@ test_array_dtype(hid_t file)
/* Write the data to the dataset */
if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -1306,7 +1307,7 @@ test_array_dtype(hid_t file)
tmp = malloc(DIM0*DIM1*H5Tget_size(native_type));
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type));
free(tmp);
@@ -1316,18 +1317,18 @@ test_array_dtype(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++) {
+ for (j = 0; j < DIM1; j++) {
for (k = 0; k < 5; k++, temp_point++,temp_check++) {
if (temp_point->c != temp_check->c ||
- temp_point->i != temp_check->i ||
- temp_point->l != temp_check->l ) {
+ temp_point->i != temp_check->i ||
+ temp_point->l != temp_check->l ) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %d,%d\n", i, j);
goto error;
}
- }
- }
+ }
+ }
}
/* Close HDF5 objects */
@@ -1354,16 +1355,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_array_dtype2
+ * Function: test_array_dtype2
*
- * Purpose: Test H5Tget_native_type for array datatype
+ * Purpose: Test H5Tget_native_type for array datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -1372,17 +1373,17 @@ error:
static herr_t
test_array_dtype2(hid_t file)
{
- hid_t dataset, space;
+ hid_t dataset, space;
hid_t dtype, native_type, tid, tid_m;
- int i, j, k, n;
- hsize_t space_dims[2], array_dims[1]={5};
+ int i, j, k, n;
+ hsize_t space_dims[2], array_dims[1]={5};
void *tmp;
TESTING("array of atomic datatype");
/* Initialize the dataset */
for(i = n = 0;i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
+ for(j = 0; j < DIM1; j++)
for(k = 0; k < 5; k++)
ipoints3[i][j][k] = n++;
@@ -1396,14 +1397,14 @@ test_array_dtype2(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_ARRAY2_NAME, tid, space,
- H5P_DEFAULT))<0) TEST_ERROR;
+ H5P_DEFAULT))<0) TEST_ERROR;
/* Create array datatype for memory */
if((tid_m=H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL))<0) TEST_ERROR;
/* Write the data to the dataset */
if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3)<0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
@@ -1428,7 +1429,7 @@ test_array_dtype2(hid_t file)
tmp = malloc(DIM0*DIM1*H5Tget_size(native_type));
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0)
- TEST_ERROR;
+ TEST_ERROR;
memcpy(icheck3, tmp, DIM0*DIM1*H5Tget_size(native_type));
free(tmp);
@@ -1438,7 +1439,7 @@ test_array_dtype2(hid_t file)
/* Check that the values read are the same as the values written */
for (i = 0; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++) {
+ for (j = 0; j < DIM1; j++) {
for (k = 0; k < 5; k++) {
if(icheck3[i][j][k] != ipoints3[i][j][k]) {
H5_FAILED();
@@ -1446,8 +1447,8 @@ test_array_dtype2(hid_t file)
printf(" At index %d,%d\n", i, j);
goto error;
}
- }
- }
+ }
+ }
}
/* Close HDF5 objects */
@@ -1465,16 +1466,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_vl_dtype
+ * Function: test_vl_dtype
*
- * Purpose: Test H5Tget_native_type for variable length datatype
+ * Purpose: Test H5Tget_native_type for variable length datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -1486,10 +1487,10 @@ test_vl_dtype(hid_t file)
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hvl_t rdata[SPACE1_DIM1]; /* Information read in */
hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hsize_t dims1[] = {SPACE1_DIM1};
- hid_t dataset, space;
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dataset, space;
hid_t dtype, native_type, nat_super_type, tid, tid2, tid_m, tid_m2;
- size_t i, j, k;
+ size_t i, j, k;
void* *tmp;
TESTING("variable length datatype");
@@ -1627,16 +1628,16 @@ test_vl_dtype(hid_t file)
/*-------------------------------------------------------------------------
- * Function: test_vlstr_dtype
+ * Function: test_vlstr_dtype
*
- * Purpose: Test H5Tget_native_type for variable length string datatype
+ * Purpose: Test H5Tget_native_type for variable length string datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -1652,10 +1653,10 @@ test_vlstr_dtype(hid_t file)
"testing whether that nation or any nation so conceived and so dedicated can long endure."
}; /* Information to write */
char *rdata[SPACE1_DIM1]; /* Information read in */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1,dtype,native_type; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1,dtype,native_type; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
unsigned i; /* counting variable */
/* Output message about test being performed */
@@ -1737,16 +1738,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_str_dtype
+ * Function: test_str_dtype
*
- * Purpose: Test H5Tget_native_type for fixed-length string datatype
+ * Purpose: Test H5Tget_native_type for fixed-length string datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -1762,10 +1763,10 @@ test_str_dtype(hid_t file)
"4th"
}; /* Information to write */
char rdata[SPACE1_DIM1][4]; /* Information read in */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1,dtype,native_type; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1,dtype,native_type; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
unsigned i; /* counting variable */
/* Output message about test being performed */
@@ -1844,16 +1845,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_refer_dtype
+ * Function: test_refer_dtype
*
- * Purpose: Test H5Tget_native_type for reference datatype
+ * Purpose: Test H5Tget_native_type for reference datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -1870,11 +1871,11 @@ test_refer_dtype(hid_t file)
float c;
} s1_t;
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, dtype, native_type; /* Datatype ID */
- hsize_t dims1[] = {1};
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, dtype, native_type; /* Datatype ID */
+ hsize_t dims1[] = {1};
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
@@ -1999,16 +2000,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_refer_dtype2
+ * Function: test_refer_dtype2
*
- * Purpose: Test H5Tget_native_type for reference
+ * Purpose: Test H5Tget_native_type for reference
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -2017,17 +2018,17 @@ error:
static herr_t
test_refer_dtype2(hid_t file)
{
- hid_t dset1, /* Dataset ID */
+ hid_t dset1, /* Dataset ID */
dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
hid_t dtype, native_type;
- hsize_t dims1[] = {1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t dims1[] = {1},
+ dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
hdset_reg_ref_t wbuf, /* buffer to write to disk */
rbuf; /* buffer read from disk */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
@@ -2190,16 +2191,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_opaque_dtype
+ * Function: test_opaque_dtype
*
- * Purpose: Test H5Tget_native_type for opaque datatype
+ * Purpose: Test H5Tget_native_type for opaque datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -2208,11 +2209,11 @@ error:
static herr_t
test_opaque_dtype(hid_t file)
{
- hid_t type=-1, space=-1, dset=-1;
+ hid_t type=-1, space=-1, dset=-1;
hid_t dataset, dtype, native_type;
size_t i;
- unsigned char wbuf[32], rbuf[32];
- hsize_t nelmts;
+ unsigned char wbuf[32], rbuf[32];
+ hsize_t nelmts;
TESTING("opaque datatype");
@@ -2222,13 +2223,13 @@ test_opaque_dtype(hid_t file)
H5Tset_tag(type, "testing 1-byte opaque type")<0 ||
(space=H5Screate_simple(1, &nelmts, NULL))<0 ||
(dset=H5Dcreate(file, DSET_OPAQUE_NAME, type, space, H5P_DEFAULT))<0)
- TEST_ERROR;
+ TEST_ERROR;
for (i=0; i<sizeof(wbuf); i++)
wbuf[i] = (unsigned char)0xff ^ (unsigned char)i;
if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf)<0)
- TEST_ERROR;
+ TEST_ERROR;
if (H5Sclose(space)<0) TEST_ERROR;
if (H5Dclose(dset)<0) TEST_ERROR;
@@ -2247,11 +2248,11 @@ test_opaque_dtype(hid_t file)
TEST_ERROR;
for(i=0; i<sizeof(rbuf); i++) {
- if (rbuf[i] != wbuf[i]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
+ if (rbuf[i] != wbuf[i]) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
printf(" At index %u\n", (unsigned)i);
- goto error;
+ goto error;
}
}
@@ -2269,16 +2270,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_bitfield_dtype
+ * Function: test_bitfield_dtype
*
- * Purpose: Test H5Tget_native_type for bitfield datatype
+ * Purpose: Test H5Tget_native_type for bitfield datatype
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -2287,11 +2288,11 @@ error:
static herr_t
test_bitfield_dtype(hid_t file)
{
- hid_t type=-1, space=-1, dset=-1;
+ hid_t type=-1, space=-1, dset=-1;
hid_t dataset, dtype, native_type;
- size_t i;
- unsigned char wbuf[32], rbuf[32];
- hsize_t nelmts;
+ size_t i;
+ unsigned char wbuf[32];
+ hsize_t nelmts;
TESTING("bitfield datatype");
@@ -2300,13 +2301,13 @@ test_bitfield_dtype(hid_t file)
if ((type=H5Tcopy(H5T_STD_B8LE))<0 ||
(space=H5Screate_simple(1, &nelmts, NULL))<0 ||
(dset=H5Dcreate(file, DSET_BITFIELD_NAME, type, space, H5P_DEFAULT))<0)
- TEST_ERROR;
+ TEST_ERROR;
for (i=0; i<sizeof(wbuf); i++)
wbuf[i] = (unsigned char)0xff ^ (unsigned char)i;
if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf)<0)
- TEST_ERROR;
+ TEST_ERROR;
if (H5Sclose(space)<0) TEST_ERROR;
if (H5Dclose(dset)<0) TEST_ERROR;
@@ -2324,7 +2325,7 @@ test_bitfield_dtype(hid_t file)
puts(" Bit field isn't supported. Should have failed.");
TEST_ERROR;
}
-
+
if (H5Tclose(type)<0) TEST_ERROR;
if (H5Tclose(dtype)<0) TEST_ERROR;
if (H5Dclose(dataset)<0) TEST_ERROR;
@@ -2359,21 +2360,18 @@ error:
static herr_t
test_ninteger(void)
{
- hid_t fid1; /* file ID */
- hid_t fid2; /* file ID */
- hid_t did1; /* dataset ID */
- hid_t did2; /* dataset ID */
- hid_t sid1; /* dataspace ID */
- hid_t dcpl1; /* dataset creation property list ID */
- hid_t dcpl2; /* dataset creation property list ID */
- hid_t tid1; /* file datatype */
- hid_t tid2; /* file datatype */
- hid_t nid1; /* native datatype */
- hid_t nid2; /* native datatype */
- size_t prec1; /* precision */
- size_t prec2; /* precision */
+ hid_t fid1=(-1); /* file ID */
+ hid_t fid2=(-1); /* file ID */
+ hid_t did1=(-1); /* dataset ID */
+ hid_t did2=(-1); /* dataset ID */
+ hid_t sid1=(-1); /* dataspace ID */
+ hid_t dcpl1=(-1); /* dataset creation property list ID */
+ hid_t dcpl2=(-1); /* dataset creation property list ID */
+ hid_t tid1=(-1); /* file datatype */
+ hid_t tid2=(-1); /* file datatype */
+ hid_t nid1=(-1); /* native datatype */
+ hid_t nid2=(-1); /* native datatype */
hsize_t dims[1]={DIM3}; /* dataspace dimensions */
- size_t nsize; /* size of native type */
hsize_t nelmts; /* number of elements in dataset */
int rank=1; /* rank of dataset */
int buf[DIM3];
@@ -2442,7 +2440,7 @@ test_ninteger(void)
goto error;
/* get size */
- if ((nsize=H5Tget_size(nid1))==0)
+ if (H5Tget_size(nid1)==0)
goto error;
/* get rank */
@@ -2485,7 +2483,7 @@ test_ninteger(void)
goto error;
/* check */
- if ((prec1=H5Tget_precision(nid1))!=(prec2=H5Tget_precision(nid2))) {
+ if (H5Tget_precision(nid1)!=H5Tget_precision(nid2)) {
printf(" Precision differ.\n");
goto error;
}
@@ -2540,16 +2538,15 @@ error:
return -1;
} /* end test_ninteger() */
-
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Test H5Tget_native_type for different datatype
+ * Purpose: Test H5Tget_native_type for different datatype
*
- * Programmer: Raymond Lu
- * October 15, 2002
+ * Programmer: Raymond Lu
+ * October 15, 2002
*
* Modifications:
*
@@ -2558,32 +2555,32 @@ error:
int
main(void)
{
- hid_t file, fapl;
- int nerrors=0;
- char filename[1024];
+ hid_t file, fapl;
+ int nerrors=0;
+ char filename[1024];
h5_reset();
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- goto error;
-
- nerrors += test_atomic_dtype(file)<0 ?1:0;
- nerrors += test_compound_dtype(file)<0 ?1:0;
- nerrors += test_compound_dtype2(file)<0 ?1:0;
- nerrors += test_compound_dtype3(file)<0 ?1:0;
- nerrors += test_compound_opaque(file)<0 ?1:0;
- nerrors += test_enum_dtype(file)<0 ?1:0;
- nerrors += test_array_dtype(file)<0 ?1:0;
- nerrors += test_array_dtype2(file)<0 ?1:0;
- nerrors += test_vl_dtype(file)<0 ?1:0;
- nerrors += test_vlstr_dtype(file)<0 ?1:0;
+ goto error;
+
+ nerrors += test_atomic_dtype(file)<0 ?1:0;
+ nerrors += test_compound_dtype(file)<0 ?1:0;
+ nerrors += test_compound_dtype2(file)<0 ?1:0;
+ nerrors += test_compound_dtype3(file)<0 ?1:0;
+ nerrors += test_compound_opaque(file)<0 ?1:0;
+ nerrors += test_enum_dtype(file)<0 ?1:0;
+ nerrors += test_array_dtype(file)<0 ?1:0;
+ nerrors += test_array_dtype2(file)<0 ?1:0;
+ nerrors += test_vl_dtype(file)<0 ?1:0;
+ nerrors += test_vlstr_dtype(file)<0 ?1:0;
nerrors += test_str_dtype(file)<0 ?1:0;
- nerrors += test_refer_dtype(file)<0 ?1:0;
- nerrors += test_refer_dtype2(file)<0 ?1:0;
- nerrors += test_opaque_dtype(file)<0 ?1:0;
- nerrors += test_bitfield_dtype(file)<0 ?1:0;
+ nerrors += test_refer_dtype(file)<0 ?1:0;
+ nerrors += test_refer_dtype2(file)<0 ?1:0;
+ nerrors += test_opaque_dtype(file)<0 ?1:0;
+ nerrors += test_bitfield_dtype(file)<0 ?1:0;
nerrors += test_ninteger()<0 ?1:0;
if (H5Fclose(file)<0) goto error;
@@ -2595,6 +2592,6 @@ main(void)
error:
nerrors = MAX(1, nerrors);
printf("***** %d DATASET TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ nerrors, 1 == nerrors ? "" : "S");
return 1;
}
diff --git a/test/ohdr.c b/test/ohdr.c
index 261ae68..4813260 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -309,12 +309,12 @@ main(void)
}
PASSED();
- h5_cleanup(FILENAME, fapl);
-
puts("All object header tests passed.");
+ h5_cleanup(FILENAME, fapl);
return 0;
error:
+ puts("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
diff --git a/test/reserved.c b/test/reserved.c
index 2a9739a..d08c02d 100755
--- a/test/reserved.c
+++ b/test/reserved.c
@@ -43,8 +43,8 @@ const char *FILENAME[] = {
static herr_t
rsrv_heap(void)
{
- hid_t file_id, dataset_id, dataspace_id;
- hid_t fapl, fcpl;
+ hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1);
+ hid_t fapl=(-1), fcpl=(-1);
hsize_t dims[1] = {1};
char filename[1024], dset_name[10];
int i;
@@ -54,10 +54,6 @@ rsrv_heap(void)
/* Create a new file. */
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-/* H5Pset_userblock(fapl, (hsize_t)0);
- H5Pset_sym_k(fapl, 1, 1);
- H5Pset_istore_k(fapl, 1);
-*/
/* Set file address sizes to be very small. */
fcpl = H5Pcreate(H5P_FILE_CREATE);
if(fcpl < 0) TEST_ERROR;
@@ -160,8 +156,8 @@ rsrv_heap(void)
static herr_t
rsrv_ohdr(void)
{
- hid_t file_id, dataset_id, dataspace_id;
- hid_t fapl, fcpl, aid, attr_id;
+ hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1);
+ hid_t fapl=(-1), fcpl=(-1), aid, attr_id;
hsize_t dims[2];
herr_t status;
int attrval[4][6];
@@ -176,9 +172,6 @@ rsrv_ohdr(void)
fcpl = H5Pcreate(H5P_FILE_CREATE);
if(fcpl < 0) TEST_ERROR;
-/* H5Pset_userblock(pfc_id, (hsize_t)0);
- H5Pset_sym_k(pfc_id, 1, 1);
- H5Pset_istore_k(pfc_id, 1); */
if( H5Pset_sizes(fcpl, (size_t)2,(size_t)2) < 0) TEST_ERROR;
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
@@ -289,10 +282,10 @@ rsrv_ohdr(void)
static herr_t
rsrv_vlen(void)
{
- hid_t file_id, dataset_id, dataspace_id, type_id;
- hid_t fapl, fcpl, mem_space_id;
+ hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1), type_id=(-1);
+ hid_t fapl=(-1), fcpl=(-1), mem_space_id=(-1);
hssize_t offset[1];
- hssize_t start[1];
+ hsize_t start[1];
hsize_t dims[1], count[1];
herr_t status;
int i;
@@ -309,11 +302,6 @@ rsrv_vlen(void)
/* Make file address space very small */
fcpl = H5Pcreate(H5P_FILE_CREATE);
if( fcpl < 0) TEST_ERROR;
-/*
- H5Pset_userblock(pfc_id, (hsize_t)0);
- H5Pset_sym_k(pfc_id, 1, 1);
- H5Pset_istore_k(pfc_id, 1);
-*/
if( H5Pset_sizes(fcpl, (size_t)2,(size_t)2) < 0) TEST_ERROR;
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
diff --git a/test/stab.c b/test/stab.c
index 6ce9871..68c7630 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -86,10 +86,10 @@ test_misc(hid_t file)
g1=H5Gcreate(file, "/", 0);
} H5E_END_TRY
if(g1 >= 0) goto error;
-
+
H5E_BEGIN_TRY {
g1=H5Gcreate(file, "./././", 0);
- } H5E_END_TRY
+ } H5E_END_TRY
if(g1 >= 0) goto error;
PASSED();
diff --git a/test/stream_test.c b/test/stream_test.c
index aecf656..a69d78e 100644
--- a/test/stream_test.c
+++ b/test/stream_test.c
@@ -6,8 +6,6 @@
* Author: Thomas Radke <tradke@aei-potsdam.mpg.de>
* Tuesday, September 12, 2000
*
- * Version: $Id$
- *
* Modifications:
* Thomas Radke, Thursday, October 26, 2000
* Made it compiling under Windows.
diff --git a/test/tarray.c b/test/tarray.c
index aa6e767..871ff9c 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: tarray
@@ -596,9 +594,8 @@ test_array_compound_atomic(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid2,0);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0) {
+ if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 1st field's offset */
@@ -608,18 +605,16 @@ test_array_compound_atomic(void)
/* Check the 1st field's datatype */
mtid=H5Tget_member_type(tid2,0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0) {
+ if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid2,1);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0) {
+ if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 2nd field's offset */
@@ -629,9 +624,8 @@ test_array_compound_atomic(void)
/* Check the 2nd field's datatype */
mtid=H5Tget_member_type(tid2,1);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_NATIVE_FLOAT))<=0) {
+ if((ret=H5Tequal(mtid,H5T_NATIVE_FLOAT))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
@@ -814,9 +808,8 @@ test_array_compound_array(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid2,0);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0) {
+ if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 1st field's offset */
@@ -826,18 +819,16 @@ test_array_compound_array(void)
/* Check the 1st field's datatype */
mtid=H5Tget_member_type(tid2,0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0) {
+ if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid2,1);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0) {
+ if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 2nd field's offset */
@@ -871,9 +862,8 @@ test_array_compound_array(void)
tid3=H5Tget_super(mtid);
CHECK(tid3, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid3,H5T_NATIVE_FLOAT))<=0) {
+ if((ret=H5Tequal(tid3,H5T_NATIVE_FLOAT))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
/* Close the array's base type datatype */
ret=H5Tclose(tid3);
@@ -1106,9 +1096,8 @@ test_array_vlen_atomic(void)
tid3=H5Tget_super(tid2);
CHECK(tid3, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid3,H5T_NATIVE_UINT))<=0) {
+ if((ret=H5Tequal(tid3,H5T_NATIVE_UINT))<=0)
TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
/* Close the array's base type datatype */
ret=H5Tclose(tid3);
@@ -1351,9 +1340,8 @@ test_array_vlen_array(void)
CHECK(tid4, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid4,H5T_NATIVE_UINT))<=0) {
+ if((ret=H5Tequal(tid4,H5T_NATIVE_UINT))<=0)
TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
/* Close the array's base type datatype */
ret=H5Tclose(tid4);
@@ -1586,7 +1574,7 @@ test_array_bkg(void)
/* Verify correct data */
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
- for (j = 0; j < ALEN; j++) {
+ for (j = 0; j < ALEN; j++) {
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
@@ -1606,7 +1594,7 @@ test_array_bkg(void)
/* Release memory resources */
/* ------------------------ */
for (i = 0; i < dtsinfo.nsubfields; i++)
- free(dtsinfo.name[i]);
+ free(dtsinfo.name[i]);
/* Release IDs */
@@ -1679,7 +1667,7 @@ test_array_bkg(void)
/* Verify correct data */
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
- for (j = 0; j < ALEN; j++) {
+ for (j = 0; j < ALEN; j++) {
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
@@ -1728,7 +1716,7 @@ test_array_bkg(void)
/* Verify correct data */
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
- for (j = 0; j < ALEN; j++) {
+ for (j = 0; j < ALEN; j++) {
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
@@ -1837,9 +1825,8 @@ test_compat(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid1,0);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0) {
+ if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 1st field's offset */
@@ -1849,18 +1836,16 @@ test_compat(void)
/* Check the 1st field's datatype */
mtid=H5Tget_member_type(tid1,0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0) {
+ if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid1,1);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0) {
+ if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 2nd field's offset */
@@ -1870,18 +1855,16 @@ test_compat(void)
/* Check the 2nd field's datatype */
mtid=H5Tget_member_type(tid1,1);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_IEEE_F32LE))<=0) {
+ if((ret=H5Tequal(mtid,H5T_IEEE_F32LE))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 3rd field's name */
mname=H5Tget_member_name(tid1,2);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"l")!=0) {
+ if(HDstrcmp(mname,"l")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 3rd field's offset */
@@ -1891,9 +1874,8 @@ test_compat(void)
/* Check the 3rd field's datatype */
mtid=H5Tget_member_type(tid1,2);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I32LE))<=0) {
+ if((ret=H5Tequal(mtid,H5T_STD_I32LE))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
@@ -1925,9 +1907,8 @@ test_compat(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid1,0);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0) {
+ if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 1st field's offset */
@@ -1937,18 +1918,16 @@ test_compat(void)
/* Check the 1st field's datatype */
mtid=H5Tget_member_type(tid1,0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0) {
+ if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid1,1);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0) {
+ if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 2nd field's offset */
@@ -1980,11 +1959,10 @@ test_compat(void)
/* Check the array's base datatype */
tid2=H5Tget_super(mtid);
- CHECK(tid2, FAIL, "H5Tget_member_type");
+ CHECK(tid2, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid2,H5T_IEEE_F32LE))<=0) {
+ if((ret=H5Tequal(tid2,H5T_IEEE_F32LE))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
ret=H5Tclose(mtid);
@@ -1993,9 +1971,8 @@ test_compat(void)
/* Check the 3rd field's name */
mname=H5Tget_member_name(tid1,2);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"l")!=0) {
+ if(HDstrcmp(mname,"l")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 3rd field's offset */
@@ -2027,11 +2004,10 @@ test_compat(void)
/* Check the array's base datatype */
tid2=H5Tget_super(mtid);
- CHECK(tid2, FAIL, "H5Tget_member_type");
+ CHECK(tid2, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid2,H5T_STD_I32LE))<=0) {
+ if((ret=H5Tequal(tid2,H5T_STD_I32LE))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
ret=H5Tclose(mtid);
@@ -2040,9 +2016,8 @@ test_compat(void)
/* Check the 4th field's name */
mname=H5Tget_member_name(tid1,3);
CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"d")!=0) {
+ if(HDstrcmp(mname,"d")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- } /* end if */
free(mname);
/* Check the 4th field's offset */
@@ -2052,9 +2027,8 @@ test_compat(void)
/* Check the 4th field's datatype */
mtid=H5Tget_member_type(tid1,3);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_IEEE_F64LE))<=0) {
+ if((ret=H5Tequal(mtid,H5T_IEEE_F64LE))<=0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- } /* end if */
ret=H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
diff --git a/test/tattr.c b/test/tattr.c
index c303171..6727442 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -615,7 +615,7 @@ test_attr_compound_read(void)
fields=H5Tget_nmembers(type);
VERIFY(fields, 3, "H5Tget_nmembers");
for(i=0; i<fields; i++) {
- fieldname=H5Tget_member_name(type,i);
+ fieldname=H5Tget_member_name(type,(unsigned)i);
if(!(HDstrcmp(fieldname,ATTR4_FIELDNAME1) ||
HDstrcmp(fieldname,ATTR4_FIELDNAME2) ||
HDstrcmp(fieldname,ATTR4_FIELDNAME3)))
diff --git a/test/testhdf5.h b/test/testhdf5.h
index fd3976f..e148362 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -32,36 +32,36 @@
/* Use %ld to print the value because long should cover most cases. */
/* Used to make certain a return value _is_not_ a value */
#define CHECK(ret, val, where) do { \
- if (GetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \
+ if (GetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \
"in %s returned %ld \n", \
where, (int)__LINE__, __FILE__, \
(long)(ret)); \
- if ((ret) == (val)) { \
- TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
+ if ((ret) == (val)) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
} \
} while(0)
#define CHECK_I(ret,where) { \
- if (GetTestVerbosity()>=VERBO_HI) { \
+ if (GetTestVerbosity()>=VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
(where), (int)__LINE__, __FILE__, (long)(ret)); \
} \
if ((ret)<0) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
(where), (long)(ret), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
} \
}
#define CHECK_PTR(ret,where) { \
- if (GetTestVerbosity()>=VERBO_HI) { \
+ if (GetTestVerbosity()>=VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
(where), (int)__LINE__, __FILE__, (ret)); \
} \
if (!(ret)) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
(where), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
} \
@@ -69,27 +69,28 @@
/* Used to make certain a return value _is_ a value */
#define VERIFY(x, val, where) do { \
- if (GetTestVerbosity()>=VERBO_HI) { \
+ if (GetTestVerbosity()>=VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
- "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \
+ "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \
} \
if ((x) != (val)) { \
- TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
- "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
+ "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
} \
} while(0)
/* Used to document process through a test and to check for errors */
#define RESULT(ret,func) do { \
- if (GetTestVerbosity()>VERBO_MED) { \
+ if (GetTestVerbosity()>VERBO_MED) { \
print_func(" Call to routine: %15s at line %4d in %s returned " \
- "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
+ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
} \
- if (GetTestVerbosity()>=VERBO_HI) H5Eprint(stdout); \
- if ((ret) == FAIL) { \
- TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
+ if (GetTestVerbosity()>=VERBO_HI) \
+ H5Eprint(stdout); \
+ if ((ret) == FAIL) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
} \
} while(0)
diff --git a/test/tfile.c b/test/tfile.c
index d2ff1c3..ed691dc 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: tfile
@@ -53,6 +51,12 @@
#define F3_SYM_INTERN_K F2_SYM_INTERN_K
#define FILE3 "tfile3.h5"
+#define GRP_NAME "/group"
+#define DSET_NAME "dataset"
+#define ATTR_NAME "attr"
+#define TYPE_NAME "type"
+#define FILE4 "tfile4.h5"
+
#define OBJ_ID_COUNT_0 0
#define OBJ_ID_COUNT_1 1
#define OBJ_ID_COUNT_2 2
@@ -65,6 +69,8 @@ static void
create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *);
static void
test_obj_count_and_id(hid_t, hid_t, hid_t, hid_t, hid_t, hid_t);
+static void
+check_file_id(hid_t, hid_t);
/****************************************************************
**
@@ -79,7 +85,7 @@ test_file_create(void)
hsize_t ublock; /*sizeof userblock */
size_t parm; /*file-creation parameters */
size_t parm2; /*file-creation parameters */
- int iparm;
+ unsigned iparm;
#ifdef H5_WANT_H5_V1_4_COMPAT
int iparm2;
#else /* H5_WANT_H5_V1_4_COMPAT */
@@ -318,7 +324,7 @@ test_file_open(void)
hsize_t ublock; /*sizeof user block */
size_t parm; /*file-creation parameters */
size_t parm2; /*file-creation parameters */
- int iparm;
+ unsigned iparm;
#ifdef H5_WANT_H5_V1_4_COMPAT
int iparm2;
#else /* H5_WANT_H5_V1_4_COMPAT */
@@ -817,6 +823,158 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
/****************************************************************
**
+** test_get_file_id(): Test H5Iget_file_id()
+**
+*****************************************************************/
+static void
+test_get_file_id(void)
+{
+ hid_t fid, fid2, fid3;
+ hid_t datatype_id, dataset_id, dataspace_id, group_id, attr_id;
+ hid_t plist;
+ hsize_t dims[F2_RANK];
+ herr_t ret;
+
+ /* Create a file */
+ fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(fid, fid);
+
+ /* Create a group in the file. Make a duplicated file ID from the group.
+ * And close this duplicated ID
+ */
+ group_id = H5Gcreate(fid, GRP_NAME, 0);
+ CHECK(group_id, FAIL, "H5Gcreate");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(fid, group_id);
+
+ /* Close the file and get file ID from the group ID */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(-1, group_id);
+
+ ret = H5Gclose(group_id);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Open the file again. Test H5Iget_file_id() */
+ fid = H5Fopen(FILE4, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ group_id = H5Gopen(fid, GRP_NAME);
+ CHECK(group_id, FAIL, "H5Gcreate");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(fid, group_id);
+
+ /* Open the file for second time. Test H5Iget_file_id() */
+ fid3 = H5Freopen(fid);
+ CHECK(fid3, FAIL, "H5Freopen");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(fid3, fid3);
+
+ ret = H5Fclose(fid3);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create a dataset in the group. Make a duplicated file ID from the
+ * dataset. And close this duplicated ID.
+ */
+ dims[0] = F2_DIM0;
+ dims[1] = F2_DIM1;
+ dataspace_id = H5Screate_simple(F2_RANK, dims, NULL);
+ CHECK(dataspace_id, FAIL, "H5Screate_simple");
+
+ dataset_id = H5Dcreate(group_id, DSET_NAME, H5T_NATIVE_INT, dataspace_id,
+ H5P_DEFAULT);
+ CHECK(dataset_id, FAIL, "H5Dcreate");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(fid, dataset_id);
+
+ /* Create an attribute for the dataset. Make a duplicated file ID from
+ * this attribute. And close it.
+ */
+ attr_id=H5Acreate(dataset_id,ATTR_NAME,H5T_NATIVE_INT,dataspace_id,H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Acreate");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(fid, attr_id);
+
+ /* Create a named datatype. Make a duplicated file ID from
+ * this attribute. And close it.
+ */
+ datatype_id=H5Tcopy(H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Acreate");
+
+ ret = H5Tcommit(fid, TYPE_NAME, datatype_id);
+ CHECK(ret, FAIL, "H5Tcommit");
+
+ /* Test H5Iget_file_id() */
+ check_file_id(fid, datatype_id);
+
+ /* Create a property list and try to get file ID from it.
+ * Supposed to fail.
+ */
+ plist = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(plist, FAIL, "H5Pcreate");
+
+ H5E_BEGIN_TRY {
+ fid2 = H5Iget_file_id(plist);
+ } H5E_END_TRY;
+ VERIFY(fid2, FAIL, "H5Iget_file_id");
+
+ /* Close objects */
+ ret = H5Tclose(datatype_id);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ ret = H5Sclose(dataspace_id);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Dclose(dataset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ ret = H5Gclose(group_id);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+}
+
+/****************************************************************
+**
+** check_file_id(): Internal function of test_get_file_id()
+**
+*****************************************************************/
+static void
+check_file_id(hid_t fid, hid_t object_id)
+{
+ hid_t new_fid;
+ herr_t ret;
+
+ /* Return a duplicated file ID even not expecting user to do it.
+ * And close this duplicated ID
+ */
+ new_fid = H5Iget_file_id(object_id);
+
+ if(fid >=0)
+ VERIFY(new_fid, fid, "H5Iget_file_id");
+ else
+ CHECK(new_fid, FAIL, "H5Iget_file_id");
+
+ ret = H5Fclose(new_fid);
+ CHECK(ret, FAIL, "H5Fclose");
+}
+
+/****************************************************************
+**
** test_obj_count_and_id(): test object count and ID list functions.
**
****************************************************************/
@@ -1078,6 +1236,7 @@ test_file(void)
#ifndef H5_NO_SHARED_WRITING
test_file_close(); /* Test file close behavior */
#endif /* H5_NO_SHARED_WRITING */
+ test_get_file_id(); /* Test H5Iget_file_id */
test_file_perm(); /* Test file access permissions */
test_file_freespace(); /* Test file free space information */
} /* test_file() */
@@ -1103,4 +1262,5 @@ cleanup_file(void)
remove(FILE1);
remove(FILE2);
remove(FILE3);
+ remove(FILE4);
}
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 4a6e99c..bf35440 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: tgenprop
@@ -87,9 +85,8 @@ test_genprop_basic_class(void)
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0) {
+ if(HDstrcmp(name,CLASS1_NAME)!=0)
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
- } /* end if */
free(name);
/* Check class parent */
@@ -119,9 +116,8 @@ test_genprop_basic_class(void)
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS2_NAME)!=0) {
+ if(HDstrcmp(name,CLASS2_NAME)!=0)
TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME);
- } /* end if */
free(name);
/* Check class parent */
@@ -682,9 +678,8 @@ test_genprop_basic_list_prop(void)
/* Check values of temporary properties (set with regular values) */
ret = H5Pget(lid1,PROP3_NAME,&prop3_value);
CHECK_I(ret, "H5Pget");
- if(memcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0) {
+ if(HDmemcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0)
TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
- } /* end if */
ret = H5Pget(lid1,PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget");
@@ -1058,12 +1053,10 @@ test_genprop_list_callback(void)
/* Verify creation callback information for properties tracked */
VERIFY(prop1_cb_info.crt_count, 1, "H5Pcreate");
- if(HDstrcmp(prop1_cb_info.crt_name,PROP1_NAME)!=0) {
+ if(HDstrcmp(prop1_cb_info.crt_name,PROP1_NAME)!=0)
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- } /* end if */
- if(HDmemcmp(prop1_cb_info.crt_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0) {
+ if(HDmemcmp(prop1_cb_info.crt_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0)
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
- } /* end if */
/* Check values of permanent properties (set with default values) */
ret = H5Pget(lid1,PROP1_NAME,&prop1_value);
@@ -1076,9 +1069,8 @@ test_genprop_list_callback(void)
/* Check values of temporary properties (set with regular values) */
ret = H5Pget(lid1,PROP3_NAME,&prop3_value);
CHECK_I(ret, "H5Pget");
- if(memcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0) {
+ if(HDmemcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0)
TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
- } /* end if */
ret = H5Pget(lid1,PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget");
@@ -1086,12 +1078,10 @@ test_genprop_list_callback(void)
/* Verify get callback information for properties tracked */
VERIFY(prop1_cb_info.get_count, 1, "H5Pget");
VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget");
- if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0) {
+ if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0)
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- } /* end if */
- if(HDmemcmp(prop1_cb_info.get_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0) {
+ if(HDmemcmp(prop1_cb_info.get_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0)
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
- } /* end if */
/* Set value of property #1 to different value */
ret = H5Pset(lid1,PROP1_NAME,&prop1_new_value);
@@ -1100,12 +1090,10 @@ test_genprop_list_callback(void)
/* Verify set callback information for properties tracked */
VERIFY(prop1_cb_info.set_count, 1, "H5Pset");
VERIFY(prop1_cb_info.set_plist_id, lid1, "H5Pset");
- if(HDstrcmp(prop1_cb_info.set_name,PROP1_NAME)!=0) {
+ if(HDstrcmp(prop1_cb_info.set_name,PROP1_NAME)!=0)
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- } /* end if */
- if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value,PROP1_SIZE)!=0) {
+ if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value,PROP1_SIZE)!=0)
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
- } /* end if */
/* Check new value of tracked properties */
ret = H5Pget(lid1,PROP1_NAME,&prop1_value);
@@ -1115,12 +1103,10 @@ test_genprop_list_callback(void)
/* Verify get callback information again for properties tracked */
VERIFY(prop1_cb_info.get_count, 2, "H5Pget");
VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget");
- if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0) {
+ if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0)
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- } /* end if */
- if(HDmemcmp(prop1_cb_info.get_value,&prop1_new_value,PROP1_SIZE)!=0) {
+ if(HDmemcmp(prop1_cb_info.get_value,&prop1_new_value,PROP1_SIZE)!=0)
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
- } /* end if */
/* Delete property #2 */
ret = H5Premove(lid1,PROP2_NAME);
@@ -1129,12 +1115,10 @@ test_genprop_list_callback(void)
/* Verify delete callback information for properties tracked */
VERIFY(prop2_cb_info.del_count, 1, "H5Premove");
VERIFY(prop2_cb_info.del_plist_id, lid1, "H5Premove");
- if(HDstrcmp(prop2_cb_info.del_name,PROP2_NAME)!=0) {
+ if(HDstrcmp(prop2_cb_info.del_name,PROP2_NAME)!=0)
TestErrPrintf("Property #2 name doesn't match!, line=%d\n",__LINE__);
- } /* end if */
- if(HDmemcmp(prop2_cb_info.del_value,PROP2_DEF_VALUE,PROP2_SIZE)!=0) {
+ if(HDmemcmp(prop2_cb_info.del_value,PROP2_DEF_VALUE,PROP2_SIZE)!=0)
TestErrPrintf("Property #2 value doesn't match!, line=%d\n",__LINE__);
- } /* end if */
/* Copy first list */
lid2 = H5Pcopy(lid1);
@@ -1142,12 +1126,10 @@ test_genprop_list_callback(void)
/* Verify copy callback information for properties tracked */
VERIFY(prop1_cb_info.cop_count, 1, "H5Pcopy");
- if(HDstrcmp(prop1_cb_info.cop_name,PROP1_NAME)!=0) {
+ if(HDstrcmp(prop1_cb_info.cop_name,PROP1_NAME)!=0)
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- } /* end if */
- if(HDmemcmp(prop1_cb_info.cop_value,&prop1_new_value,PROP1_SIZE)!=0) {
+ if(HDmemcmp(prop1_cb_info.cop_value,&prop1_new_value,PROP1_SIZE)!=0)
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
- } /* end if */
/* Verify that the class creation callback occurred */
VERIFY(cop_cb_struct.count, 1, "H5Pcopy");
@@ -1159,12 +1141,10 @@ test_genprop_list_callback(void)
/* Verify close callback information for properties tracked */
VERIFY(prop1_cb_info.cls_count, 1, "H5Pclose");
- if(HDstrcmp(prop1_cb_info.cls_name,PROP1_NAME)!=0) {
+ if(HDstrcmp(prop1_cb_info.cls_name,PROP1_NAME)!=0)
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- } /* end if */
- if(HDmemcmp(prop1_cb_info.cls_value,&prop1_new_value,PROP1_SIZE)!=0) {
+ if(HDmemcmp(prop1_cb_info.cls_value,&prop1_new_value,PROP1_SIZE)!=0)
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
- } /* end if */
/* Close second list */
ret = H5Pclose(lid2);
@@ -1432,10 +1412,9 @@ test_genprop_path(void)
/* Get full path for first class */
path=H5P_get_class_path_test(cid1);
CHECK_PTR(path, "H5P_get_class_path_test");
- if(HDstrcmp(path,CLASS1_PATH)!=0) {
+ if(HDstrcmp(path,CLASS1_PATH)!=0)
TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH);
- } /* end if */
- free(path);
+ HDfree(path);
/* Create another new generic class, derived from first class */
cid2 = H5Pcreate_class(cid1,CLASS2_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
@@ -1448,9 +1427,8 @@ test_genprop_path(void)
/* Get full path for second class */
path=H5P_get_class_path_test(cid2);
CHECK_PTR(path, "H5P_get_class_path_test");
- if(HDstrcmp(path,CLASS2_PATH)!=0) {
+ if(HDstrcmp(path,CLASS2_PATH)!=0)
TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH);
- } /* end if */
/* Open a copy of the class with the path name */
cid3 = H5P_open_class_path_test(path);
@@ -1509,10 +1487,9 @@ test_genprop_refcount(void)
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0) {
+ if(HDstrcmp(name,CLASS1_NAME)!=0)
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
- } /* end if */
- free(name);
+ HDfree(name);
/* Close class */
ret = H5Pclose_class(cid1);
@@ -1529,10 +1506,9 @@ test_genprop_refcount(void)
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0) {
+ if(HDstrcmp(name,CLASS1_NAME)!=0)
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
- } /* end if */
- free(name);
+ HDfree(name);
/* Close list */
ret = H5Pclose(lid1);
@@ -1541,10 +1517,9 @@ test_genprop_refcount(void)
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0) {
+ if(HDstrcmp(name,CLASS1_NAME)!=0)
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
- } /* end if */
- free(name);
+ HDfree(name);
/* Close class */
ret = H5Pclose_class(cid1);
diff --git a/test/th5s.c b/test/th5s.c
index 4ba4088..ae92179 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -92,7 +92,7 @@ test_h5s_basic(void)
hid_t fid1; /* HDF5 File IDs */
hid_t sid1, sid2; /* Dataspace ID */
hid_t dset1; /* Dataset ID */
- hid_t aid1; /* Attribute ID */
+ hid_t aid1; /* Attribute ID */
int rank; /* Logical rank of dataspace */
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3,
@@ -152,9 +152,9 @@ test_h5s_basic(void)
rank = H5Sget_simple_extent_dims(sid1, tdims, tmax);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ "H5Sget_simple_extent_dims");
VERIFY(HDmemcmp(tmax, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ "H5Sget_simple_extent_dims");
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
@@ -654,9 +654,8 @@ test_h5s_chunk(void)
for(i=0; i<50000; i++) {
for(j=0; j<3; j++) {
- if(chunk_data_dbl[i][j]!=chunk_data_flt[i][j]) {
+ if(chunk_data_dbl[i][j]!=chunk_data_flt[i][j])
TestErrPrintf("chunk_data_dbl[%d][%d]=%f, chunk_data_flt[%d][%d]=%f\n",i,j,chunk_data_dbl[i][j],i,j,chunk_data_flt[i][j]);
- } /* end if */
} /* end for */
} /* end for */
} /* test_h5s_chunk() */
diff --git a/test/theap.c b/test/theap.c
index 87c4836..8e5105a 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -87,10 +87,12 @@ static int tst_inc_sort(const void *_i1, const void *_i2)
static void
test_heap_init(void)
{
+ time_t curr_time; /* Current time, for seeding random number generator */
size_t u; /* Local index variables */
/* Create randomized set of numbers */
- HDsrandom((unsigned long)HDtime(NULL));
+ curr_time=time(NULL);
+ HDsrandom((unsigned long)curr_time);
for(u=0; u<NUM_ELEMS; u++)
/* Generate random numbers from -1000 to 1000 */
rand_num[u].val=(int)(HDrandom()%2001)-1001;
@@ -591,14 +593,12 @@ static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, siz
/* Check that the value is correct, based on the heap type */
if(heap_type==H5HP_MAX_HEAP) {
- if(val>last_val) {
+ if(val>last_val)
TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
- } /* end if */
} /* end if */
else {
- if(val<last_val) {
+ if(val<last_val)
TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
- } /* end if */
} /* end else */
/* Update last value */
@@ -636,14 +636,12 @@ static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, siz
/* Check that the value is correct, based on the heap type */
if(heap_type==H5HP_MAX_HEAP) {
- if(val>last_val) {
+ if(val>last_val)
TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
- } /* end if */
} /* end if */
else {
- if(val<last_val) {
+ if(val<last_val)
TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
- } /* end if */
} /* end else */
/* Update last value */
diff --git a/test/titerate.c b/test/titerate.c
index 18a7246..4f9d15c 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -197,11 +197,17 @@ static void test_iter_group(void)
VERIFY(num_membs,NDATASETS+2,"H5Gget_num_objs");
for(i=0; i< (int)num_membs; i++) {
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ int obj_type; /* Type of object in file */
+#else /*H5_WANT_H5_V1_4_COMPAT*/
+ H5G_obj_t obj_type; /* Type of object in file */
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
+
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN);
CHECK(ret, FAIL, "H5Gget_objname_by_idx");
- ret = (herr_t)H5Gget_objtype_by_idx(root_group, (hsize_t)i);
- CHECK(ret, FAIL, "H5Gget_objtype_by_idx");
+ obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx");
}
H5E_BEGIN_TRY {
@@ -775,11 +781,17 @@ static void test_grp_memb_funcs(void)
VERIFY(num_membs,NDATASETS+2,"H5Gget_num_objs");
for(i=0; i< (int)num_membs; i++) {
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ int obj_type; /* Type of object in file */
+#else /*H5_WANT_H5_V1_4_COMPAT*/
+ H5G_obj_t obj_type; /* Type of object in file */
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
+
/* Test with NULL for name, to query length */
name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, NAMELEN);
CHECK(name_len, FAIL, "H5Gget_objname_by_idx");
- ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, name_len+1);
+ ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)(name_len+1));
CHECK(ret, FAIL, "H5Gget_objname_by_idx");
/* Double-check that the length is the same */
@@ -787,17 +799,17 @@ static void test_grp_memb_funcs(void)
/* Keep a copy of the dataset names around for later */
obj_names[i]=HDstrdup(dataset_name);
- CHECK(obj_names[i], NULL, "strdup");
+ CHECK(obj_names[i], NULL, "strdup");
- ret = (herr_t)H5Gget_objtype_by_idx(root_group, (hsize_t)i);
- CHECK(ret, FAIL, "H5Gget_objtype_by_idx");
+ obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx");
if(!HDstrcmp(dataset_name, "grp"))
- VERIFY(ret, H5G_GROUP, "H5Gget_objname_by_idx");
+ VERIFY(obj_type, H5G_GROUP, "H5Gget_objname_by_idx");
if(!HDstrcmp(dataset_name, "dtype"))
- VERIFY(ret, H5G_TYPE, "H5Gget_objname_by_idx");
+ VERIFY(obj_type, H5G_TYPE, "H5Gget_objname_by_idx");
if(!HDstrncmp(dataset_name, "Dataset", 7))
- VERIFY(ret, H5G_DATASET, "H5Gget_objname_by_idx");
+ VERIFY(obj_type, H5G_DATASET, "H5Gget_objname_by_idx");
}
H5E_BEGIN_TRY {
@@ -841,7 +853,7 @@ static void test_links(void)
ssize_t name_len; /* Length of object's name */
herr_t ret; /* Generic return value */
hid_t gid, gid1;
- int i;
+ hsize_t i;
#ifdef H5_WANT_H5_V1_4_COMPAT
int obj_type; /* Type of object */
#else /*H5_WANT_H5_V1_4_COMPAT*/
@@ -877,10 +889,10 @@ static void test_links(void)
/* Test these two functions, H5Gget_num_objs and H5Gget_objname_by_idx */
for(i=0; i<nobjs; i++) {
/* Get object name */
- name_len = H5Gget_objname_by_idx(gid, (hsize_t)i, obj_name, NAMELEN);
+ name_len = H5Gget_objname_by_idx(gid, i, obj_name, NAMELEN);
CHECK(name_len, FAIL, "H5Gget_objname_by_idx");
- obj_type = H5Gget_objtype_by_idx(gid, (hsize_t)i);
+ obj_type = H5Gget_objtype_by_idx(gid, i);
CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx");
if(!HDstrcmp(obj_name, "g1.1"))
diff --git a/test/tmeta.c b/test/tmeta.c
index 07c67bc..87fd4fd 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: tmeta
@@ -81,9 +79,8 @@ test_metadata(void)
unsigned u; /* local counting variable */
for (u = 0; u < sizeof(compar_buffer); u++) {
- if (compar_buffer[u] != encode_buffer[u]) {
+ if (compar_buffer[u] != encode_buffer[u])
TestErrPrintf("Error encoding meta-data at offset %u, wanted: %u, got: %u\n", (unsigned) u, (unsigned) compar_buffer[u], (unsigned) encode_buffer[u]);
- } /* end if */
} /* end for */
} /* end if */
/* Test decoding macros */
@@ -94,26 +91,22 @@ test_metadata(void)
UINT32DECODE(p, du32); /* Decode the uint32 value */
/* Check the values decoded */
- if (di16 != TEST_INT16_VALUE) {
+ if (di16 != TEST_INT16_VALUE)
TestErrPrintf("Error decoding int16 meta-data wanted: %d, got: %d "
"at %s:%d\n", (int) TEST_INT16_VALUE, (int) di16,
__FILE__, __LINE__);
- } /* end if */
- if (du16 != TEST_UINT16_VALUE) {
+ if (du16 != TEST_UINT16_VALUE)
TestErrPrintf("Error decoding uint16 meta-data wanted: %u, got: %u "
"at %s:%d\n", (unsigned) TEST_UINT16_VALUE, (unsigned) du16,
__FILE__, __LINE__);
- } /* end if */
- if (di32 != TEST_INT32_VALUE) {
+ if (di32 != TEST_INT32_VALUE)
TestErrPrintf("Error decoding int32 meta-data wanted: %ld, got: %ld "
"at %s:%d\n", (long) TEST_INT32_VALUE, (long) di32,
__FILE__, __LINE__);
- } /* end if */
- if (du32 != TEST_UINT32_VALUE) {
+ if (du32 != TEST_UINT32_VALUE)
TestErrPrintf("Error decoding uint32 meta-data wanted: %lu, got: %lu "
"at %s:%d\n", (unsigned long) TEST_UINT32_VALUE, (unsigned long) du32,
__FILE__, __LINE__);
- } /* end if */
} /* test_metadata() */
diff --git a/test/tmisc.c b/test/tmisc.c
index 943152f..a564375 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -1172,7 +1172,7 @@ test_misc8(void)
#endif /* H5_WANT_H5_V1_4_COMPAT */
size_t rdcc_nbytes; /* Raw data number of bytes */
double rdcc_w0; /* Raw data write percentage */
- hssize_t start[MISC8_RANK]; /* Hyperslab start */
+ hsize_t start[MISC8_RANK]; /* Hyperslab start */
hsize_t count[MISC8_RANK]; /* Hyperslab block count */
herr_t ret;
@@ -1439,9 +1439,8 @@ test_misc8(void)
tdata2=rdata;
for(u=0; u<MISC8_DIM0; u++)
for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
- if(*tdata!=*tdata2) {
+ if(*tdata!=*tdata2)
TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
- }
#endif /* VERIFY_DATA */
/* Check the storage size after data is written */
@@ -1750,17 +1749,17 @@ test_misc11(void)
hsize_t userblock; /* Userblock size retrieved from FCPL */
size_t off_size; /* Size of offsets in the file */
size_t len_size; /* Size of lengths in the file */
- int sym_ik; /* Symbol table B-tree initial 'K' value */
- int istore_ik; /* Indexed storage B-tree initial 'K' value */
+ unsigned sym_ik; /* Symbol table B-tree initial 'K' value */
+ unsigned istore_ik; /* Indexed storage B-tree initial 'K' value */
#ifdef H5_WANT_H5_V1_4_COMPAT
int sym_lk; /* Symbol table B-tree leaf 'K' value */
#else /* H5_WANT_H5_V1_4_COMPAT */
unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */
#endif /* H5_WANT_H5_V1_4_COMPAT */
- int super; /* Superblock version # */
- int freelist; /* Free list version # */
- int stab; /* Symbol table entry version # */
- int shhdr; /* Shared object header version # */
+ unsigned super; /* Superblock version # */
+ unsigned freelist; /* Free list version # */
+ unsigned stab; /* Symbol table entry version # */
+ unsigned shhdr; /* Shared object header version # */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1920,7 +1919,7 @@ test_misc12(void)
hsize_t maxdims1[1] = {H5S_UNLIMITED};
hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE};
hsize_t newsize[1] = {MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE};
- hssize_t offset[1] = {MISC12_SPACE1_DIM1};
+ hsize_t offset[1] = {MISC12_SPACE1_DIM1};
hsize_t count[1] = {MISC12_APPEND_SIZE};
int i; /* counting variable */
herr_t ret; /* Generic return value */
@@ -3386,13 +3385,14 @@ test_misc20(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_misc20() */
-
-/*
- test_misc21 and test_misc22 should be executed only when SZIP is present
- and encoder is available
- EIP 2004/8/04
-*/
-#if defined H5_HAVE_FILTER_SZIP & defined H5_SZIP_CAN_ENCODE
+
+/*
+ test_misc21 and test_misc22 should be executed when SZIP is present
+ and encoder is available.
+ EIP 2004/8/04
+*/
+#if defined H5_HAVE_FILTER_SZIP
+
/****************************************************************
**
** test_misc21(): Test that late allocation time is treated the same
@@ -3410,6 +3410,7 @@ test_misc21(void)
chunk_size[2]={MISC21_CHUNK_DIM0,MISC21_CHUNK_DIM1};
herr_t ret; /* Generic return value */
+ if (h5_szip_can_encode() != 1) return;
/* Output message about test being performed */
MESSAGE(5, ("Testing late allocation time w/chunks & filters\n"));
@@ -3488,6 +3489,7 @@ test_misc22(void)
unsigned int cd_values[32];
int correct;
+ if (h5_szip_can_encode() != 1) return;
idts[0]=H5Tcopy(H5T_NATIVE_UINT8);
idts[1]=H5Tcopy(H5T_NATIVE_UINT16);
idts[2]=H5Tcopy(H5T_NATIVE_UINT32);
@@ -3538,7 +3540,7 @@ test_misc22(void)
/* compute the correct PPB that should be set by SZIP */
if (offsets[k] == 0) {
- correct=prec[j];
+ correct=prec[j];
} else {
correct=H5Tget_size(idts[i])*8;
}
@@ -3601,7 +3603,7 @@ test_misc22(void)
HDfree(buf);
} /* end test_misc22() */
-#endif /* H5_SZIP_CAN_ENCODE & H5_HAVE_FILTER_SZIP */
+#endif /* H5_HAVE_FILTER_SZIP */
/****************************************************************
**
@@ -3634,10 +3636,11 @@ test_misc(void)
test_misc18(); /* Test new object header information in H5G_stat_t struct */
test_misc19(); /* Test incrementing & decrementing ref count on IDs */
test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */
-#if defined H5_HAVE_FILTER_SZIP & defined H5_SZIP_CAN_ENCODE
+#if defined H5_HAVE_FILTER_SZIP
test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */
test_misc22(); /* check szip bits per pixel */
-#endif /* H5_SZIP_CAN_ENCODE & H5_HAVE_FILTER_SZIP */
+#endif /* H5_HAVE_FILTER_SZIP */
+
} /* test_misc() */
@@ -3681,8 +3684,9 @@ cleanup_misc(void)
HDremove(MISC18_FILE);
HDremove(MISC19_FILE);
HDremove(MISC20_FILE);
-#if defined H5_HAVE_FILTER_SZIP & defined H5_SZIP_CAN_ENCODE
+#if defined H5_HAVE_FILTER_SZIP
HDremove(MISC21_FILE);
HDremove(MISC22_FILE);
-#endif /* H5_SZIP_CAN_ENCODE & H5_HAVE_FILTER_SZIP */
+#endif /* H5_HAVE_FILTER_SZIP */
}
+
diff --git a/test/trefer.c b/test/trefer.c
index f911a32..46c702e 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: trefer
@@ -262,9 +260,8 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Gget_comment");
/* Check for correct comment value */
- if(HDstrcmp(write_comment,read_comment)!=0) {
+ if(HDstrcmp(write_comment,read_comment)!=0)
TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment);
- }
/* Close group */
ret = H5Gclose(group);
@@ -312,33 +309,28 @@ test_reference_obj(void)
static void
test_reference_region(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hsize_t dims1[] = {SPACE1_DIM1},
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hsize_t dims1[] = {SPACE1_DIM1},
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
-#ifdef H5_WANT_H5_V1_4_COMPAT
- hsize_t low[SPACE2_RANK]; /* Selection bounds */
- hsize_t high[SPACE2_RANK]; /* Selection bounds */
-#else /* H5_WANT_H5_V1_4_COMPAT */
- hssize_t low[SPACE2_RANK]; /* Selection bounds */
- hssize_t high[SPACE2_RANK]; /* Selection bounds */
-#endif /* H5_WANT_H5_V1_4_COMPAT */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t * coords; /* Coordinate buffer */
+ hsize_t low[SPACE2_RANK]; /* Selection bounds */
+ hsize_t high[SPACE2_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
- int i; /* counting variables */
- herr_t ret; /* Generic return value */
+ int i; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
@@ -410,7 +402,7 @@ test_reference_region(void)
coord1[7][0]=9; coord1[7][1]=0;
coord1[8][0]=7; coord1[8][1]=1;
coord1[9][0]=3; coord1[9][1]=3;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
ret = (int)H5Sget_select_npoints(sid2);
@@ -514,26 +506,26 @@ test_reference_region(void)
coords=HDmalloc(ret*SPACE2_RANK*sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)ret,coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
- VERIFY((hssize_t)coords[0], coord1[0][0], "Element Coordinates");
- VERIFY((hssize_t)coords[1], coord1[0][1], "Element Coordinates");
- VERIFY((hssize_t)coords[2], coord1[1][0], "Element Coordinates");
- VERIFY((hssize_t)coords[3], coord1[1][1], "Element Coordinates");
- VERIFY((hssize_t)coords[4], coord1[2][0], "Element Coordinates");
- VERIFY((hssize_t)coords[5], coord1[2][1], "Element Coordinates");
- VERIFY((hssize_t)coords[6], coord1[3][0], "Element Coordinates");
- VERIFY((hssize_t)coords[7], coord1[3][1], "Element Coordinates");
- VERIFY((hssize_t)coords[8], coord1[4][0], "Element Coordinates");
- VERIFY((hssize_t)coords[9], coord1[4][1], "Element Coordinates");
- VERIFY((hssize_t)coords[10], coord1[5][0], "Element Coordinates");
- VERIFY((hssize_t)coords[11], coord1[5][1], "Element Coordinates");
- VERIFY((hssize_t)coords[12], coord1[6][0], "Element Coordinates");
- VERIFY((hssize_t)coords[13], coord1[6][1], "Element Coordinates");
- VERIFY((hssize_t)coords[14], coord1[7][0], "Element Coordinates");
- VERIFY((hssize_t)coords[15], coord1[7][1], "Element Coordinates");
- VERIFY((hssize_t)coords[16], coord1[8][0], "Element Coordinates");
- VERIFY((hssize_t)coords[17], coord1[8][1], "Element Coordinates");
- VERIFY((hssize_t)coords[18], coord1[9][0], "Element Coordinates");
- VERIFY((hssize_t)coords[19], coord1[9][1], "Element Coordinates");
+ VERIFY(coords[0], coord1[0][0], "Element Coordinates");
+ VERIFY(coords[1], coord1[0][1], "Element Coordinates");
+ VERIFY(coords[2], coord1[1][0], "Element Coordinates");
+ VERIFY(coords[3], coord1[1][1], "Element Coordinates");
+ VERIFY(coords[4], coord1[2][0], "Element Coordinates");
+ VERIFY(coords[5], coord1[2][1], "Element Coordinates");
+ VERIFY(coords[6], coord1[3][0], "Element Coordinates");
+ VERIFY(coords[7], coord1[3][1], "Element Coordinates");
+ VERIFY(coords[8], coord1[4][0], "Element Coordinates");
+ VERIFY(coords[9], coord1[4][1], "Element Coordinates");
+ VERIFY(coords[10], coord1[5][0], "Element Coordinates");
+ VERIFY(coords[11], coord1[5][1], "Element Coordinates");
+ VERIFY(coords[12], coord1[6][0], "Element Coordinates");
+ VERIFY(coords[13], coord1[6][1], "Element Coordinates");
+ VERIFY(coords[14], coord1[7][0], "Element Coordinates");
+ VERIFY(coords[15], coord1[7][1], "Element Coordinates");
+ VERIFY(coords[16], coord1[8][0], "Element Coordinates");
+ VERIFY(coords[17], coord1[8][1], "Element Coordinates");
+ VERIFY(coords[18], coord1[9][0], "Element Coordinates");
+ VERIFY(coords[19], coord1[9][1], "Element Coordinates");
HDfree(coords);
ret = H5Sget_select_bounds(sid2,low,high);
CHECK(ret, FAIL, "H5Sget_select_bounds");
@@ -585,14 +577,14 @@ test_reference_region_1D(void)
sid3; /* Dataspace ID #3 */
hsize_t dims1[] = {SPACE1_DIM1},
dims3[] = {SPACE3_DIM1};
- hssize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hssize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
hsize_t * coords; /* Coordinate buffer */
- hssize_t low[SPACE3_RANK]; /* Selection bounds */
- hssize_t high[SPACE3_RANK]; /* Selection bounds */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
@@ -671,7 +663,7 @@ test_reference_region_1D(void)
coord1[7][0]=89;
coord1[8][0]=97;
coord1[9][0]=03;
- ret = H5Sselect_elements(sid3,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(sid3,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
ret = (int)H5Sget_select_npoints(sid3);
@@ -799,16 +791,16 @@ test_reference_region_1D(void)
coords=HDmalloc(ret*SPACE3_RANK*sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid3,(hsize_t)0,(hsize_t)ret,coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
- VERIFY((hssize_t)coords[0], coord1[0][0], "Element Coordinates");
- VERIFY((hssize_t)coords[1], coord1[1][0], "Element Coordinates");
- VERIFY((hssize_t)coords[2], coord1[2][0], "Element Coordinates");
- VERIFY((hssize_t)coords[3], coord1[3][0], "Element Coordinates");
- VERIFY((hssize_t)coords[4], coord1[4][0], "Element Coordinates");
- VERIFY((hssize_t)coords[5], coord1[5][0], "Element Coordinates");
- VERIFY((hssize_t)coords[6], coord1[6][0], "Element Coordinates");
- VERIFY((hssize_t)coords[7], coord1[7][0], "Element Coordinates");
- VERIFY((hssize_t)coords[8], coord1[8][0], "Element Coordinates");
- VERIFY((hssize_t)coords[9], coord1[9][0], "Element Coordinates");
+ VERIFY(coords[0], coord1[0][0], "Element Coordinates");
+ VERIFY(coords[1], coord1[1][0], "Element Coordinates");
+ VERIFY(coords[2], coord1[2][0], "Element Coordinates");
+ VERIFY(coords[3], coord1[3][0], "Element Coordinates");
+ VERIFY(coords[4], coord1[4][0], "Element Coordinates");
+ VERIFY(coords[5], coord1[5][0], "Element Coordinates");
+ VERIFY(coords[6], coord1[6][0], "Element Coordinates");
+ VERIFY(coords[7], coord1[7][0], "Element Coordinates");
+ VERIFY(coords[8], coord1[8][0], "Element Coordinates");
+ VERIFY(coords[9], coord1[9][0], "Element Coordinates");
HDfree(coords);
ret = H5Sget_select_bounds(sid3,low,high);
CHECK(ret, FAIL, "H5Sget_select_bounds");
diff --git a/test/trefstr.c b/test/trefstr.c
index 2ca8839..a278ebc 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -207,9 +207,8 @@ test_refstr_cmp(void)
cmp=H5RS_cmp(rs2,rs2);
VERIFY(cmp, 0, "H5RS_cmp");
cmp=H5RS_cmp(rs1,rs2);
- if(cmp>=0) {
+ if(cmp>=0)
TestErrPrintf("%d: string comparison incorrect!\n",__LINE__);
- } /* end if */
/* Check the lengths of the strings also */
len=H5RS_len(rs1);
@@ -269,9 +268,8 @@ test_refstr_wrap(void)
CHECK(s, NULL, "H5RS_get_str");
CHECK(s, buf, "wrapping");
cmp=HDstrcmp(s,buf);
- if(cmp<=0) {
+ if(cmp<=0)
TestErrPrintf("%d: string comparison incorrect!\n",__LINE__);
- } /* end if */
/* Decrement reference count for string */
ret=H5RS_decr(rs);
diff --git a/test/tselect.c b/test/tselect.c
index cdec45e..7586d90 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -127,15 +127,21 @@
#define SPACE10_DIM1 180
#define SPACE10_CHUNK_SIZE 12
+/* Information for bounds checking test */
+#define SPACE11_RANK 2
+#define SPACE11_DIM1 100
+#define SPACE11_DIM2 100
+#define SPACE11_NPOINTS 4
+
/* Location comparison function */
int compare_size_t(const void *s1, const void *s2);
-herr_t test_select_hyper_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data);
-herr_t test_select_point_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data);
-herr_t test_select_all_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data);
-herr_t test_select_none_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data);
-herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *_operator_data);
-herr_t test_select_hyper_iter3(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data);
+herr_t test_select_hyper_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
+herr_t test_select_point_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
+herr_t test_select_all_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
+herr_t test_select_none_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
+herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_operator_data);
+herr_t test_select_hyper_iter3(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
/****************************************************************
**
@@ -143,7 +149,7 @@ herr_t test_select_hyper_iter3(void *elem,hid_t type_id, hsize_t ndim, hssize_t
**
****************************************************************/
herr_t
-test_select_hyper_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data)
+test_select_hyper_iter1(void *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *_operator_data)
{
uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */
**tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */
@@ -165,16 +171,16 @@ test_select_hyper_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, h
static void
test_select_hyper(hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temporary buffer pointer */
@@ -312,7 +318,7 @@ test_select_hyper(hid_t xfer_plist)
} /* test_select_hyper() */
struct pnt_iter {
- hssize_t coord[POINT1_NPOINTS*2][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord[POINT1_NPOINTS*2][SPACE2_RANK]; /* Coordinates for point selection */
uint8_t *buf; /* Buffer the points are in */
int offset; /* Which point we are looking at */
};
@@ -324,7 +330,7 @@ struct pnt_iter {
**
****************************************************************/
herr_t
-test_select_point_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data)
+test_select_point_iter1(void *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *_operator_data)
{
uint8_t *elem=(uint8_t *)_elem; /* Pointer to the element to examine */
uint8_t *tmp; /* temporary ptr to element in operator data */
@@ -337,7 +343,7 @@ test_select_point_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, h
pnt_info->offset++;
return(0);
}
-} /* end test_select_hyper_iter1() */
+} /* end test_select_point_iter1() */
/****************************************************************
**
@@ -355,12 +361,12 @@ test_select_point(hid_t xfer_plist)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hssize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hssize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hssize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temporary buffer pointer */
@@ -403,7 +409,7 @@ test_select_point(hid_t xfer_plist)
coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
@@ -428,7 +434,7 @@ test_select_point(hid_t xfer_plist)
coord1[7][0]=1; coord1[7][1]=14; coord1[7][2]= 6;
coord1[8][0]=2; coord1[8][1]= 2; coord1[8][2]= 5;
coord1[9][0]=0; coord1[9][1]= 6; coord1[9][2]=13;
- ret = H5Sselect_elements(sid1,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(sid1,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
@@ -453,7 +459,7 @@ test_select_point(hid_t xfer_plist)
coord2[7][0]=29; coord2[7][1]= 4;
coord2[8][0]= 8; coord2[8][1]= 8;
coord2[9][0]=19; coord2[9][1]=17;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
@@ -482,7 +488,7 @@ test_select_point(hid_t xfer_plist)
coord2[7][0]=12; coord2[7][1]= 2;
coord2[8][0]=21; coord2[8][1]=12;
coord2[9][0]= 9; coord2[9][1]=18;
- ret = H5Sselect_elements(sid2,H5S_SELECT_PREPEND,POINT1_NPOINTS,(const hssize_t **)coord2);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_PREPEND,POINT1_NPOINTS,(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
@@ -524,7 +530,7 @@ test_select_point(hid_t xfer_plist)
coord3[7][0]= 1; coord3[7][1]=22;
coord3[8][0]=12; coord3[8][1]=21;
coord3[9][0]=11; coord3[9][1]= 6;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
@@ -548,7 +554,7 @@ test_select_point(hid_t xfer_plist)
coord3[7][0]= 9; coord3[7][1]=16;
coord3[8][0]=12; coord3[8][1]=22;
coord3[9][0]=13; coord3[9][1]= 9;
- ret = H5Sselect_elements(sid2,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hssize_t **)coord3);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hsize_t **)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
@@ -598,7 +604,7 @@ test_select_point(hid_t xfer_plist)
**
****************************************************************/
herr_t
-test_select_all_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data)
+test_select_all_iter1(void *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *_operator_data)
{
uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */
**tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */
@@ -618,7 +624,7 @@ test_select_all_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hss
**
****************************************************************/
herr_t
-test_select_none_iter1(void UNUSED *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void UNUSED *_operator_data)
+test_select_none_iter1(void UNUSED *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void UNUSED *_operator_data)
{
return(-1);
} /* end test_select_none_iter1() */
@@ -716,7 +722,7 @@ test_select_all_hyper(hid_t xfer_plist)
hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
@@ -854,8 +860,8 @@ test_select_combo(void)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
@@ -901,7 +907,7 @@ test_select_combo(void)
coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Select 1x10 hyperslab for writing memory dataset */
@@ -995,7 +1001,7 @@ test_select_hyper_stride(hid_t xfer_plist)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
@@ -1145,7 +1151,7 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
hid_t dataset; /* Dataset ID */
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims2[] = {SPACE2_DIM2, SPACE2_DIM1};
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
@@ -1274,7 +1280,7 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
hid_t dataset; /* Dataset ID */
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1};
- hssize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */
uint16_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
@@ -1398,12 +1404,12 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
hid_t dataset; /* Dataset ID */
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1};
- hssize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */
uint16_t *wbuf, /* Buffer to write to disk */
*rbuf, /* Buffer read from disk */
*tbuf, *tbuf2; /* Temporary buffer pointers */
- int i,j,k,l; /* Counters */
+ unsigned i,j,k,l; /* Counters */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1480,19 +1486,19 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
for(j=0; j<SPACE8_DIM3; j++)
for(k=0; k<SPACE8_DIM2; k++)
for(l=0; l<SPACE8_DIM1; l++,tbuf++,tbuf2++)
- if( (i>=start[0] && i<(int)(start[0]+count[0])) &&
- (j>=start[1] && j<(int)(start[1]+count[1])) &&
- (k>=start[2] && k<(int)(start[2]+count[2])) &&
- (l>=start[3] && l<(int)(start[3]+count[3])) ) {
+ if( (i>=start[0] && i<(start[0]+count[0])) &&
+ (j>=start[1] && j<(start[1]+count[1])) &&
+ (k>=start[2] && k<(start[2]+count[2])) &&
+ (l>=start[3] && l<(start[3]+count[3])) ) {
if(*tbuf!=*tbuf2) {
printf("Error: hyperslab values don't match!\n");
- TestErrPrintf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2);
+ TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2);
} /* end if */
} /* end if */
else {
if(*tbuf2!=0) {
printf("Error: invalid data in read buffer!\n");
- TestErrPrintf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2);
+ TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2);
} /* end if */
} /* end else */
@@ -1532,7 +1538,7 @@ test_select_hyper_copy(void)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
@@ -1690,9 +1696,9 @@ test_select_point_copy(void)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
uint16_t *wbuf, /* buffer to write to disk */
*rbuf, /* 1st buffer read from disk */
*rbuf2, /* 2nd buffer read from disk */
@@ -1736,7 +1742,7 @@ test_select_point_copy(void)
coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Select sequence of ten points for write dataset */
@@ -1750,7 +1756,7 @@ test_select_point_copy(void)
coord2[7][0]=29; coord2[7][1]= 4;
coord2[8][0]= 8; coord2[8][1]= 8;
coord2[9][0]=19; coord2[9][1]=17;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Make a copy of the dataspace to write */
@@ -1794,7 +1800,7 @@ test_select_point_copy(void)
coord3[7][0]= 1; coord3[7][1]=22;
coord3[8][0]=12; coord3[8][1]=21;
coord3[9][0]=11; coord3[9][1]= 6;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Make a copy of the dataspace to read */
@@ -1859,7 +1865,7 @@ test_select_hyper_offset(void)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
@@ -2017,7 +2023,7 @@ test_select_hyper_offset2(void)
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
- hssize_t start[SPACE7_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE7_RANK]; /* Starting location of hyperslab */
hsize_t count[SPACE7_RANK]; /* Element count of hyperslab */
hssize_t offset[SPACE7_RANK]; /* Offset of selection */
uint8_t *wbuf, /* buffer to write to disk */
@@ -2136,9 +2142,9 @@ test_select_point_offset(void)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
hssize_t offset[SPACE1_RANK]; /* Offset of selection */
uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
@@ -2183,7 +2189,7 @@ test_select_point_offset(void)
coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Check a valid offset */
@@ -2218,7 +2224,7 @@ test_select_point_offset(void)
coord2[7][0]=23; coord2[7][1]= 4;
coord2[8][0]= 8; coord2[8][1]= 8;
coord2[9][0]=19; coord2[9][1]=17;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Choose a valid offset for the memory dataspace */
@@ -2254,7 +2260,7 @@ test_select_point_offset(void)
coord3[7][0]= 1; coord3[7][1]=22;
coord3[8][0]=12; coord3[8][1]=21;
coord3[9][0]=11; coord3[9][1]= 6;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Read selection from disk */
@@ -2306,7 +2312,7 @@ test_select_hyper_union(void)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
@@ -2820,7 +2826,7 @@ test_select_hyper_and_2d(void)
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims2[] = {SPACE2A_DIM1};
- hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
@@ -2946,7 +2952,7 @@ test_select_hyper_xor_2d(void)
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims2[] = {SPACE2A_DIM1};
- hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
@@ -3074,7 +3080,7 @@ test_select_hyper_notb_2d(void)
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims2[] = {SPACE2A_DIM1};
- hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
@@ -3201,7 +3207,7 @@ test_select_hyper_nota_2d(void)
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t dims2[] = {SPACE2A_DIM1};
- hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
@@ -3320,7 +3326,7 @@ test_select_hyper_nota_2d(void)
**
****************************************************************/
herr_t
-test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_t *point, void *_operator_data)
+test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, unsigned ndim, const hsize_t *point, void *_operator_data)
{
int *tbuf=(int *)_elem, /* temporary buffer pointer */
**tbuf2=(int **)_operator_data; /* temporary buffer handle */
@@ -3329,9 +3335,9 @@ test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_
if(*tbuf!=**tbuf2) {
TestErrPrintf("Error in hyperslab iteration!\n");
printf("location: { ");
- for(u=0; u<(unsigned)ndim; u++) {
+ for(u=0; u<ndim; u++) {
printf("%2d",(int)point[u]);
- if(u<(unsigned)(ndim-1))
+ if(u<(ndim-1))
printf(", ");
} /* end for */
printf("}\n");
@@ -3342,7 +3348,7 @@ test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_
(*tbuf2)++;
return(0);
}
-} /* end test_select_hyper_iter1() */
+} /* end test_select_hyper_iter2() */
/****************************************************************
**
@@ -3358,7 +3364,7 @@ test_select_hyper_union_random_5d(hid_t read_plist)
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims1[] = {SPACE5_DIM1, SPACE5_DIM2, SPACE5_DIM3, SPACE5_DIM4, SPACE5_DIM5};
hsize_t dims2[] = {SPACE6_DIM1};
- hssize_t start[SPACE5_RANK]; /* Starting location of hyperslab */
+ hsize_t start[SPACE5_RANK]; /* Starting location of hyperslab */
hsize_t count[SPACE5_RANK]; /* Element count of hyperslab */
int *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
@@ -3555,9 +3561,9 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
short *tmpdata_out; /* output buffer */
hsize_t count[3]; /* size of the hyperslab in the file */
- hssize_t offset[3]; /* hyperslab offset in the file */
+ hsize_t offset[3]; /* hyperslab offset in the file */
hsize_t count_out[3]; /* size of the hyperslab in memory */
- hssize_t offset_out[3]; /* hyperslab offset in memory */
+ hsize_t offset_out[3]; /* hyperslab offset in memory */
int i, j, k, status_n, rank;
/* Output message about test being performed */
@@ -3788,9 +3794,9 @@ test_select_point_chunk(void)
unsigned *tmpdata_out; /* output buffer */
#endif /* LATER */
- hssize_t start[SPACE7_RANK]; /* hyperslab offset */
+ hsize_t start[SPACE7_RANK]; /* hyperslab offset */
hsize_t count[SPACE7_RANK]; /* size of the hyperslab */
- hssize_t points[SPACE7_NPOINTS][SPACE7_RANK]; /* points for selection */
+ hsize_t points[SPACE7_NPOINTS][SPACE7_RANK]; /* points for selection */
unsigned i, j; /* Local index variables */
/* Output message about test being performed */
@@ -3853,7 +3859,7 @@ test_select_point_chunk(void)
points[6][1]=1;
points[7][0]=6; /* In same chunk as point #3, but "earlier" in chunk */
points[7][1]=6;
- ret = H5Sselect_elements(pnt1_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hssize_t **)points);
+ ret = H5Sselect_elements(pnt1_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hsize_t **)points);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create 1st hyperslab selection */
@@ -3889,7 +3895,7 @@ test_select_point_chunk(void)
points[6][1]=2;
points[7][0]=7; /* In same chunk as point #3, but "earlier" in chunk */
points[7][1]=7;
- ret = H5Sselect_elements(pnt2_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hssize_t **)points);
+ ret = H5Sselect_elements(pnt2_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hsize_t **)points);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create 2nd hyperslab selection */
@@ -3967,7 +3973,7 @@ test_select_scalar_chunk(void)
hid_t m_sid; /* Memory dataspace */
hsize_t dims[] = {2}; /* Dataset dimensions */
hsize_t maxdims[] = {H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hssize_t offset[] = {0}; /* Hyperslab start */
+ hsize_t offset[] = {0}; /* Hyperslab start */
hsize_t count[] = {1}; /* Hyperslab count */
unsigned data = 2; /* Data to write */
herr_t ret;
@@ -4029,9 +4035,9 @@ test_select_valid(void)
herr_t error;
htri_t valid;
hid_t main_space, sub_space;
- hssize_t safe_start[2]={1,1};
+ hsize_t safe_start[2]={1,1};
hsize_t safe_count[2]={1,1};
- hssize_t start[2];
+ hsize_t start[2];
hsize_t dims[2],maxdims[2],size[2],count[2];
/* Output message about test being performed */
@@ -4126,7 +4132,7 @@ test_select_combine(void)
hid_t all_id; /* Dataspace for "all" selection */
hid_t none_id; /* Dataspace for "none" selection */
hid_t space1; /* Temporary dataspace #1 */
- hssize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
hsize_t stride[SPACE7_RANK]; /* Hyperslab stride */
hsize_t count[SPACE7_RANK]; /* Hyperslab count */
hsize_t block[SPACE7_RANK]; /* Hyperslab block */
@@ -4477,7 +4483,7 @@ test_select_combine(void)
typedef struct {
unsigned short fill_value; /* The fill value to check */
size_t curr_coord; /* Current coordinate to examine */
- hssize_t *coords; /* Pointer to selection's coordinates */
+ hsize_t *coords; /* Pointer to selection's coordinates */
} fill_iter_info;
/****************************************************************
@@ -4486,11 +4492,11 @@ typedef struct {
**
****************************************************************/
herr_t
-test_select_hyper_iter3(void *_elem,hid_t UNUSED type_id, hsize_t ndim, hssize_t *point, void *_operator_data)
+test_select_hyper_iter3(void *_elem, hid_t UNUSED type_id, unsigned ndim, const hsize_t *point, void *_operator_data)
{
unsigned short *tbuf=(unsigned short *)_elem; /* temporary buffer pointer */
fill_iter_info *iter_info=(fill_iter_info *)_operator_data; /* Get the pointer to the iterator information */
- hssize_t *coord_ptr; /* Pointer to the coordinate information for a point*/
+ hsize_t *coord_ptr; /* Pointer to the coordinate information for a point*/
/* Check value in current buffer location */
if(*tbuf!=iter_info->fill_value)
@@ -4526,7 +4532,7 @@ test_select_fill_all(void)
hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
int fill_value; /* Fill value */
fill_iter_info iter_info; /* Iterator information structure */
- hssize_t points[SPACE7_DIM1*SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */
+ hsize_t points[SPACE7_DIM1*SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */
unsigned short *wbuf, /* buffer to write to disk */
*tbuf; /* temporary buffer pointer */
int i,j; /* Counters */
@@ -4572,7 +4578,7 @@ test_select_fill_all(void)
/* Initialize the iterator structure */
iter_info.fill_value=SPACE7_FILL;
iter_info.curr_coord=0;
- iter_info.coords=(hssize_t *)points;
+ iter_info.coords=(hsize_t *)points;
/* Iterate through selection, verifying correct data */
ret = H5Diterate(wbuf,H5T_NATIVE_USHORT,sid1,test_select_hyper_iter3,&iter_info);
@@ -4598,7 +4604,7 @@ test_select_fill_point(hssize_t *offset)
hid_t sid1; /* Dataspace ID */
hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hssize_t points[5][SPACE7_RANK] = {{2,4}, {3,8}, {8,4}, {7,5}, {7,7}};
+ hsize_t points[5][SPACE7_RANK] = {{2,4}, {3,8}, {8,4}, {7,5}, {7,7}};
size_t num_points=5; /* Number of points selected */
int fill_value; /* Fill value */
fill_iter_info iter_info; /* Iterator information structure */
@@ -4623,7 +4629,7 @@ test_select_fill_point(hssize_t *offset)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Select "point" selection */
- ret = H5Sselect_elements(sid1, H5S_SELECT_SET,num_points,(const hssize_t **)points);
+ ret = H5Sselect_elements(sid1, H5S_SELECT_SET,num_points,(const hsize_t **)points);
CHECK(ret, FAIL, "H5Sselect_elements");
if(offset!=NULL) {
@@ -4647,7 +4653,7 @@ test_select_fill_point(hssize_t *offset)
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
for(j=0; j<SPACE7_DIM2; j++, tbuf++) {
for(k=0; k<(int)num_points; k++) {
- if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) {
+ if(i==(int)(points[k][0]+real_offset[0]) && j==(int)(points[k][1]+real_offset[1])) {
if(*tbuf!=(unsigned short)fill_value)
TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value);
break;
@@ -4660,7 +4666,7 @@ test_select_fill_point(hssize_t *offset)
/* Initialize the iterator structure */
iter_info.fill_value=SPACE7_FILL;
iter_info.curr_coord=0;
- iter_info.coords=(hssize_t *)points;
+ iter_info.coords=(hsize_t *)points;
/* Add in the offset */
for(i=0; i<(int)num_points; i++) {
@@ -4692,10 +4698,10 @@ test_select_fill_hyper_simple(hssize_t *offset)
hid_t sid1; /* Dataspace ID */
hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hssize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
hsize_t count[SPACE7_RANK]; /* Hyperslab block size */
size_t num_points; /* Number of points in selection */
- hssize_t points[16][SPACE7_RANK]; /* Coordinates selected */
+ hsize_t points[16][SPACE7_RANK]; /* Coordinates selected */
int fill_value; /* Fill value */
fill_iter_info iter_info; /* Iterator information structure */
unsigned short *wbuf, /* buffer to write to disk */
@@ -4758,7 +4764,7 @@ test_select_fill_hyper_simple(hssize_t *offset)
/* Initialize the iterator structure */
iter_info.fill_value=SPACE7_FILL;
iter_info.curr_coord=0;
- iter_info.coords=(hssize_t *)points;
+ iter_info.coords=(hsize_t *)points;
/* Set the coordinates of the selection (with the offset) */
for(i=0, num_points=0; i<(int)count[0]; i++)
@@ -4791,11 +4797,11 @@ test_select_fill_hyper_regular(hssize_t *offset)
hid_t sid1; /* Dataspace ID */
hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hssize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
hsize_t stride[SPACE7_RANK]; /* Hyperslab stride size */
hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
hsize_t block[SPACE7_RANK]; /* Hyperslab block size */
- hssize_t points[16][SPACE7_RANK] = {
+ hsize_t points[16][SPACE7_RANK] = {
{2,2}, {2,3}, {2,6}, {2,7},
{3,2}, {3,3}, {3,6}, {3,7},
{6,2}, {6,3}, {6,6}, {6,7},
@@ -4853,7 +4859,7 @@ test_select_fill_hyper_regular(hssize_t *offset)
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
for(j=0; j<SPACE7_DIM2; j++, tbuf++) {
for(k=0; k<(int)num_points; k++) {
- if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) {
+ if(i==(int)(points[k][0]+real_offset[0]) && j==(int)(points[k][1]+real_offset[1])) {
if(*tbuf!=(unsigned short)fill_value)
TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value);
break;
@@ -4866,7 +4872,7 @@ test_select_fill_hyper_regular(hssize_t *offset)
/* Initialize the iterator structure */
iter_info.fill_value=SPACE7_FILL;
iter_info.curr_coord=0;
- iter_info.coords=(hssize_t *)points;
+ iter_info.coords=(hsize_t *)points;
/* Add in the offset */
for(i=0; i<(int)num_points; i++) {
@@ -4898,9 +4904,9 @@ test_select_fill_hyper_irregular(hssize_t *offset)
hid_t sid1; /* Dataspace ID */
hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hssize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
- hssize_t points[32][SPACE7_RANK] = { /* Yes, some of the are duplicated.. */
+ hsize_t points[32][SPACE7_RANK] = { /* Yes, some of the are duplicated.. */
{2,2}, {2,3}, {2,4}, {2,5},
{3,2}, {3,3}, {3,4}, {3,5},
{4,2}, {4,3}, {4,4}, {4,5},
@@ -4910,7 +4916,7 @@ test_select_fill_hyper_irregular(hssize_t *offset)
{6,4}, {6,5}, {6,6}, {6,7},
{7,4}, {7,5}, {7,6}, {7,7},
};
- hssize_t iter_points[28][SPACE7_RANK] = { /* Coordinates, as iterated through */
+ hsize_t iter_points[28][SPACE7_RANK] = { /* Coordinates, as iterated through */
{2,2}, {2,3}, {2,4}, {2,5},
{3,2}, {3,3}, {3,4}, {3,5},
{4,2}, {4,3}, {4,4}, {4,5}, {4,6}, {4,7},
@@ -4975,7 +4981,7 @@ test_select_fill_hyper_irregular(hssize_t *offset)
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
for(j=0; j<SPACE7_DIM2; j++, tbuf++) {
for(k=0; k<(int)num_points; k++) {
- if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) {
+ if(i==(int)(points[k][0]+real_offset[0]) && j==(int)(points[k][1]+real_offset[1])) {
if(*tbuf!=(unsigned short)fill_value)
TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value);
break;
@@ -4988,7 +4994,7 @@ test_select_fill_hyper_irregular(hssize_t *offset)
/* Initialize the iterator structure */
iter_info.fill_value=SPACE7_FILL;
iter_info.curr_coord=0;
- iter_info.coords=(hssize_t *)iter_points;
+ iter_info.coords=(hsize_t *)iter_points;
/* Add in the offset */
for(i=0; i<(int)num_iter_points; i++) {
@@ -5117,8 +5123,8 @@ test_scalar_select(void)
hid_t dataset; /* Dataset ID */
hid_t sid1,sid2; /* Dataspace ID */
hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
- hssize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */
- hssize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
uint8_t *wbuf_uint8, /* buffer to write to disk */
rval_uint8, /* value read back in */
@@ -5161,7 +5167,7 @@ test_scalar_select(void)
/* Select one element in memory with a point selection */
coord1[0]=0; coord1[1]= 2;
- ret = H5Sselect_elements(sid2,H5S_SELECT_SET,1,(const hssize_t **)&coord1);
+ ret = H5Sselect_elements(sid2,H5S_SELECT_SET,1,(const hsize_t **)&coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Write single point to disk */
@@ -5265,8 +5271,8 @@ static void
test_scalar_select2(void)
{
hid_t sid; /* Dataspace ID */
- hssize_t coord1[1]; /* Coordinates for point selection */
- hssize_t start[1]; /* Hyperslab start */
+ hsize_t coord1[1]; /* Coordinates for point selection */
+ hsize_t start[1]; /* Hyperslab start */
hsize_t count[1]; /* Hyperslab block count */
herr_t ret; /* Generic return value */
@@ -5280,7 +5286,7 @@ test_scalar_select2(void)
/* Select one element in memory with a point selection */
coord1[0]=0;
H5E_BEGIN_TRY {
- ret = H5Sselect_elements(sid,H5S_SELECT_SET,1,(const hssize_t **)&coord1);
+ ret = H5Sselect_elements(sid,H5S_SELECT_SET,1,(const hsize_t **)&coord1);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_elements");
@@ -5331,9 +5337,9 @@ test_shape_same(void)
hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */
hid_t tmp_sid; /* Temporary dataspace ID */
hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2};
- hssize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
- hssize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
- hssize_t start[SPACE9_RANK]; /* Hyperslab start */
+ hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
+ hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
+ hsize_t start[SPACE9_RANK]; /* Hyperslab start */
hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */
hsize_t count[SPACE9_RANK]; /* Hyperslab block count */
hsize_t block[SPACE9_RANK]; /* Hyperslab block size */
@@ -5367,7 +5373,7 @@ test_shape_same(void)
/* Select sequence of ten points for multiple point selection */
coord1[0][0]=2; coord1[0][1]=2;
- ret = H5Sselect_elements(single_pt_sid,H5S_SELECT_SET,1,(const hssize_t **)coord1);
+ ret = H5Sselect_elements(single_pt_sid,H5S_SELECT_SET,1,(const hsize_t **)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create dataspace for multiple point selection */
@@ -5385,7 +5391,7 @@ test_shape_same(void)
coord2[7][0]=1; coord2[7][1]=0;
coord2[8][0]=5; coord2[8][1]=1;
coord2[9][0]=9; coord2[9][1]=3;
- ret = H5Sselect_elements(mult_pt_sid,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2);
+ ret = H5Sselect_elements(mult_pt_sid,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create dataspace for single hyperslab selection */
@@ -5742,7 +5748,7 @@ test_shape_same(void)
for(v=1; v<(SPACE9_DIM2-1); v++) {
coord2[v-1][0]=u; coord2[v-1][1]=v;
} /* end for */
- ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,(SPACE9_DIM2-2),(const hssize_t **)coord2);
+ ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,(SPACE9_DIM2-2),(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
} /* end for */
@@ -5848,7 +5854,7 @@ test_shape_same(void)
for(v=0; v<SPACE9_DIM2; v++) {
coord2[v][0]=u; coord2[v][1]=v;
} /* end for */
- ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,SPACE9_DIM2,(const hssize_t **)coord2);
+ ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,SPACE9_DIM2,(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
} /* end for */
@@ -5998,7 +6004,7 @@ test_shape_same(void)
for(v=0; v<2; v++) {
coord2[v][0]=u; coord2[v][1]=(v*2)+2;
} /* end for */
- ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,2,(const hssize_t **)coord2);
+ ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,2,(const hsize_t **)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
} /* end for */
@@ -6180,7 +6186,7 @@ test_select_hyper_chunk_offset(void)
int *rbuf; /* Buffer for reading data */
hid_t dcpl; /* Dataset creation property list ID */
hsize_t chunks[1]={SPACE10_CHUNK_SIZE }; /* Chunk size */
- hssize_t start[1] = { 0 }; /* The start of the hyperslab */
+ hsize_t start[1] = { 0 }; /* The start of the hyperslab */
hsize_t count[1] = { SPACE10_CHUNK_SIZE }; /* The size of the hyperslab */
int i,j; /* Local index */
herr_t ret; /* Generic return value */
@@ -6376,6 +6382,210 @@ test_select_hyper_chunk_offset(void)
/****************************************************************
**
+** test_select_bounds(): Tests selection bounds on dataspaces,
+** both with and without offsets.
+**
+****************************************************************/
+static void
+test_select_bounds(void)
+{
+ hid_t sid; /* Dataspace ID */
+ const hsize_t dims[SPACE11_RANK] = { SPACE11_DIM1, SPACE11_DIM2 }; /* Dataspace dimensions */
+ hsize_t coord[SPACE11_NPOINTS][SPACE11_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE11_RANK]; /* The start of the hyperslab */
+ hsize_t stride[SPACE11_RANK]; /* The stride between block starts for the hyperslab */
+ hsize_t count[SPACE11_RANK]; /* The number of blocks for the hyperslab */
+ hsize_t block[SPACE11_RANK]; /* The size of each block for the hyperslab */
+ hssize_t offset[SPACE11_RANK]; /* Offset amount for selection */
+ hsize_t low_bounds[SPACE11_RANK]; /* The low bounds for the selection */
+ hsize_t high_bounds[SPACE11_RANK]; /* The high bounds for the selection */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing selection bounds\n"));
+
+ /* Create dataspace */
+ sid = H5Screate_simple (SPACE11_RANK, dims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Get bounds for 'all' selection */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],0,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds");
+
+ /* Set offset for selection */
+ offset[0]=1; offset[1]=1;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Get bounds for 'all' selection with offset (which should be ignored) */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],0,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds");
+
+ /* Reset offset for selection */
+ offset[0]=0; offset[1]=0;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Set 'none' selection */
+ ret=H5Sselect_none(sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
+
+ /* Get bounds for 'none' selection */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_select_bounds");
+
+ /* Set point selection */
+ coord[0][0]= 3; coord[0][1]= 3;
+ coord[1][0]= 3; coord[1][1]= 96;
+ coord[2][0]= 96; coord[2][1]= 3;
+ coord[3][0]= 96; coord[3][1]= 96;
+ ret = H5Sselect_elements(sid,H5S_SELECT_SET,SPACE11_NPOINTS,(const hsize_t **)coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Get bounds for point selection */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],3,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],3,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],SPACE11_DIM1-4,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],SPACE11_DIM2-4,"H5Sget_select_bounds");
+
+ /* Set bad offset for selection */
+ offset[0]=5; offset[1]=-5;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Get bounds for hyperslab selection with negative offset */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_select_bounds");
+
+ /* Set valid offset for selection */
+ offset[0]=2; offset[1]=-2;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Get bounds for point selection with offset */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],5,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],1,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],SPACE11_DIM1-2,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],SPACE11_DIM2-6,"H5Sget_select_bounds");
+
+ /* Reset offset for selection */
+ offset[0]=0; offset[1]=0;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Set "regular" hyperslab selection */
+ start[0]= 2; start[1]= 2;
+ stride[0]= 10; stride[1]= 10;
+ count[0]= 4; count[1]= 4;
+ block[0]= 5; block[1]= 5;
+ ret = H5Sselect_hyperslab(sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Get bounds for hyperslab selection */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],2,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],2,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],36,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],36,"H5Sget_select_bounds");
+
+ /* Set bad offset for selection */
+ offset[0]=5; offset[1]=-5;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Get bounds for hyperslab selection with negative offset */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_select_bounds");
+
+ /* Set valid offset for selection */
+ offset[0]=5; offset[1]=-2;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Get bounds for hyperslab selection with offset */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],7,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],41,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],34,"H5Sget_select_bounds");
+
+ /* Reset offset for selection */
+ offset[0]=0; offset[1]=0;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Make "irregular" hyperslab selection */
+ start[0]= 20; start[1]= 20;
+ stride[0]= 20; stride[1]= 20;
+ count[0]= 2; count[1]= 2;
+ block[0]= 10; block[1]= 10;
+ ret = H5Sselect_hyperslab(sid,H5S_SELECT_OR,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Get bounds for hyperslab selection */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],2,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],2,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],49,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],49,"H5Sget_select_bounds");
+
+ /* Set bad offset for selection */
+ offset[0]=5; offset[1]=-5;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Get bounds for hyperslab selection with negative offset */
+ H5E_BEGIN_TRY {
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Sget_select_bounds");
+
+ /* Set valid offset for selection */
+ offset[0]=5; offset[1]=-2;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Get bounds for hyperslab selection with offset */
+ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low_bounds[0],7,"H5Sget_select_bounds");
+ VERIFY(low_bounds[1],0,"H5Sget_select_bounds");
+ VERIFY(high_bounds[0],54,"H5Sget_select_bounds");
+ VERIFY(high_bounds[1],47,"H5Sget_select_bounds");
+
+ /* Reset offset for selection */
+ offset[0]=0; offset[1]=0;
+ ret=H5Soffset_simple(sid, offset);
+ CHECK(ret, FAIL, "H5Soffset_simple");
+
+ /* Close the dataspace */
+ ret=H5Sclose (sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_select_bounds() */
+
+/****************************************************************
+**
** test_select(): Main H5S selection testing routine.
**
****************************************************************/
@@ -6519,6 +6729,9 @@ test_select(void)
/* Test using selection offset on hyperslab in chunked dataset */
test_select_hyper_chunk_offset();
+ /* Test selection bounds with & without offsets */
+ test_select_bounds();
+
} /* test_select() */
diff --git a/test/tskiplist.c b/test/tskiplist.c
index 4d527af..0a02da3 100644
--- a/test/tskiplist.c
+++ b/test/tskiplist.c
@@ -143,7 +143,7 @@ test_skiplist_insert(void)
item; /* Item to insert */
int search_key; /* Key of item to search for in skip list */
int *found_item; /* Item found in skip list */
- ssize_t num; /* Number of elements in skip list */
+ size_t num; /* Number of elements in skip list */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -202,7 +202,7 @@ static void
test_skiplist_insert_many(void)
{
H5SL_t *slist; /* Skip list created */
- ssize_t num; /* Number of elements in skip list */
+ size_t num; /* Number of elements in skip list */
size_t u; /* Local index variable */
int *found_item; /* Item found in skip list */
herr_t ret; /* Generic return value */
@@ -278,7 +278,7 @@ test_skiplist_remove(void)
key3; /* Key of 3rd item to insert */
int search_key; /* Key of item to search for in skip list */
int *found_item; /* Item found in skip list */
- ssize_t num; /* Number of elements in skip list */
+ size_t num; /* Number of elements in skip list */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -355,7 +355,7 @@ static void
test_skiplist_remove_many(void)
{
H5SL_t *slist; /* Skip list created */
- ssize_t num; /* Number of elements in skip list */
+ size_t num; /* Number of elements in skip list */
size_t u; /* Local index variable */
int *found_item; /* Item found in skip list */
herr_t ret; /* Generic return value */
@@ -455,7 +455,7 @@ test_skiplist_firstnext(void)
{
H5SL_t *slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- ssize_t num; /* Number of elements in skip list */
+ size_t num; /* Number of elements in skip list */
size_t u; /* Local index variable */
int *found_item; /* Item found in skip list */
herr_t ret; /* Generic return value */
@@ -508,7 +508,7 @@ test_skiplist_string(void)
{
H5SL_t *slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- ssize_t num; /* Number of elements in skip list */
+ size_t num; /* Number of elements in skip list */
size_t u; /* Local index variable */
typedef struct string_node {
int i;
@@ -597,7 +597,7 @@ static void
test_skiplist_iterate(void)
{
H5SL_t *slist; /* Skip list created */
- ssize_t num; /* Number of elements in skip list */
+ size_t num; /* Number of elements in skip list */
size_t u; /* Local index variable */
herr_t ret; /* Generic return value */
@@ -653,7 +653,7 @@ test_skiplist(void)
test_skiplist_insert_many(); /* Test insertion of many items into skip list */
test_skiplist_remove(); /* Test basic skip list removal */
test_skiplist_remove_many(); /* Test removal of many items from skip list */
- test_skiplist_firstnext(); /* Test iteration over skip list nodes */
+ test_skiplist_firstnext(); /* Test iteration over skip list nodes with first/next */
test_skiplist_string(); /* Test skip list string keys */
test_skiplist_iterate(); /* Test iteration over skip list nodes with callback */
diff --git a/test/ttbbt.c b/test/ttbbt.c
index 09f3f58..fa34c84 100644
--- a/test/ttbbt.c
+++ b/test/ttbbt.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/*
FILE
tbbt.c
diff --git a/test/ttime.c b/test/ttime.c
index 664fcdf..5f9b5e7 100644
--- a/test/ttime.c
+++ b/test/ttime.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: ttime
@@ -85,9 +83,8 @@ test_time_commit(void)
tid = H5Topen(file_id, "Committed D32LE type");
CHECK(tid, FAIL, "H5Topen");
- if(!H5Tequal(tid, H5T_UNIX_D32LE)) {
+ if(!H5Tequal(tid, H5T_UNIX_D32LE))
TestErrPrintf("H5T_UNIX_D32LE datatype not found\n");
- } /* end if */
status = H5Tclose (tid);
CHECK(status, FAIL, "H5Tclose");
@@ -95,9 +92,8 @@ test_time_commit(void)
tid = H5Topen(file_id, "Committed D32BE type");
CHECK(tid, FAIL, "H5Topen");
- if(!H5Tequal(tid, H5T_UNIX_D32BE)) {
+ if(!H5Tequal(tid, H5T_UNIX_D32BE))
TestErrPrintf("H5T_UNIX_D32BE datatype not found\n");
- } /* end if */
status = H5Tclose (tid);
CHECK(status, FAIL, "H5Tclose");
@@ -105,9 +101,8 @@ test_time_commit(void)
tid = H5Topen(file_id, "Committed D64LE type");
CHECK(tid, FAIL, "H5Topen");
- if(!H5Tequal(tid, H5T_UNIX_D64LE)) {
- TestErrPrintf("H5T_UNIX_D64LE datatype not found\n");
- } /* end if */
+ if(!H5Tequal(tid, H5T_UNIX_D64LE))
+ TestErrPrintf("H5T_UNIX_D64LE datatype not found");
status = H5Tclose (tid);
CHECK(status, FAIL, "H5Tclose");
@@ -115,9 +110,8 @@ test_time_commit(void)
tid = H5Topen(file_id, "Committed D64BE type");
CHECK(tid, FAIL, "H5Topen");
- if(!H5Tequal(tid, H5T_UNIX_D64BE)) {
- TestErrPrintf("H5T_UNIX_D64BE datatype not found\n");
- } /* end if */
+ if(!H5Tequal(tid, H5T_UNIX_D64BE))
+ TestErrPrintf("H5T_UNIX_D64BE datatype not found");
status = H5Tclose (tid);
CHECK(status, FAIL, "H5Tclose");
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index d5ed7b7..f535541 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -41,7 +41,7 @@
*
* 19 May 2000, Bill Wendling
* Changed so that it creates its own HDF5 file and removes it at cleanup
- * time. Added num_errs flag.
+ * time.
*
********************************************************************/
@@ -67,114 +67,109 @@ typedef struct acreate_data_struct {
void tts_acreate(void)
{
- /* Pthread declarations */
- pthread_t threads[NUM_THREADS];
-
- /* HDF5 data declarations */
- hid_t file, dataset;
- hid_t dataspace, datatype;
- hid_t attribute;
- hsize_t dimsf[1]; /* dataset dimensions */
-
- /* data declarations */
- int data; /* data to write */
- int buffer, ret, i;
-
- ttsafe_name_data_t *attrib_data;
-
- /*
- * Create an HDF5 file using H5F_ACC_TRUNC access, default file
- * creation plist and default file access plist
- */
- file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /* create a simple dataspace for the dataset */
- dimsf[0] = 1;
- dataspace = H5Screate_simple(1, dimsf, NULL);
-
- /* define datatype for the data using native little endian integers */
- datatype = H5Tcopy(H5T_NATIVE_INT);
- H5Tset_order(datatype, H5T_ORDER_LE);
-
- /* create a new dataset within the file */
- dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace,
- H5P_DEFAULT);
-
- /* initialize data for dataset and write value to dataset */
- data = NUM_THREADS;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, &data);
-
- /*
- * Simultaneously create a large number of attributes to be associated
- * with the dataset
- */
- for (i = 0; i < NUM_THREADS; i++) {
- attrib_data = malloc(sizeof(ttsafe_name_data_t));
- attrib_data->dataset = dataset;
- attrib_data->datatype = datatype;
- attrib_data->dataspace = dataspace;
- attrib_data->current_index = i;
- pthread_create(&threads[i], NULL, tts_acreate_thread,
- attrib_data);
- }
-
- for (i = 0; i < NUM_THREADS; i++)
- pthread_join(threads[i], NULL);
-
- /* verify the correctness of the test */
- for (i = 0; i < NUM_THREADS; i++) {
- attribute = H5Aopen_name(dataset,gen_name(i));
-
- if (attribute < 0) {
- TestErrPrintf(
- "unable to open appropriate attribute. "
- "Test failed!\n");
- } else {
- ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer);
-
- if (ret < 0 || buffer != i) {
- TestErrPrintf("wrong data values. Test failed!\n");
- }
-
- H5Aclose(attribute);
- }
- }
-
- /* close remaining resources */
- H5Sclose(dataspace);
- H5Tclose(datatype);
- H5Dclose(dataset);
- H5Fclose(file);
+ /* Pthread declarations */
+ pthread_t threads[NUM_THREADS];
+
+ /* HDF5 data declarations */
+ hid_t file, dataset;
+ hid_t dataspace, datatype;
+ hid_t attribute;
+ hsize_t dimsf[1]; /* dataset dimensions */
+
+ /* data declarations */
+ int data; /* data to write */
+ int buffer, ret, i;
+
+ ttsafe_name_data_t *attrib_data;
+
+ /*
+ * Create an HDF5 file using H5F_ACC_TRUNC access, default file
+ * creation plist and default file access plist
+ */
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* create a simple dataspace for the dataset */
+ dimsf[0] = 1;
+ dataspace = H5Screate_simple(1, dimsf, NULL);
+
+ /* define datatype for the data using native little endian integers */
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ H5Tset_order(datatype, H5T_ORDER_LE);
+
+ /* create a new dataset within the file */
+ dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT);
+
+ /* initialize data for dataset and write value to dataset */
+ data = NUM_THREADS;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, &data);
+
+ /*
+ * Simultaneously create a large number of attributes to be associated
+ * with the dataset
+ */
+ for (i = 0; i < NUM_THREADS; i++) {
+ attrib_data = malloc(sizeof(ttsafe_name_data_t));
+ attrib_data->dataset = dataset;
+ attrib_data->datatype = datatype;
+ attrib_data->dataspace = dataspace;
+ attrib_data->current_index = i;
+ pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data);
+ }
+
+ for (i = 0; i < NUM_THREADS; i++)
+ pthread_join(threads[i], NULL);
+
+ /* verify the correctness of the test */
+ for (i = 0; i < NUM_THREADS; i++) {
+ attribute = H5Aopen_name(dataset,gen_name(i));
+
+ if (attribute < 0)
+ TestErrPrintf("unable to open appropriate attribute. Test failed!\n");
+ else {
+ ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer);
+
+ if (ret < 0 || buffer != i)
+ TestErrPrintf("wrong data values. Test failed!\n");
+
+ H5Aclose(attribute);
+ }
+ }
+
+ /* close remaining resources */
+ H5Sclose(dataspace);
+ H5Tclose(datatype);
+ H5Dclose(dataset);
+ H5Fclose(file);
}
void *tts_acreate_thread(void *client_data)
{
- hid_t attribute;
- char *attribute_name;
- int *attribute_data; /* data for attributes */
-
- ttsafe_name_data_t *attrib_data;
-
- attrib_data = (ttsafe_name_data_t *)client_data;
-
- /* Create attribute */
- attribute_name = gen_name(attrib_data->current_index);
- attribute = H5Acreate(attrib_data->dataset, attribute_name,
- attrib_data->datatype, attrib_data->dataspace,
- H5P_DEFAULT);
-
- /* Write data to the attribute */
- attribute_data = malloc(sizeof(int));
- *attribute_data = attrib_data->current_index;
- H5Awrite(attribute, H5T_NATIVE_INT, attribute_data);
- H5Aclose(attribute);
- return NULL;
+ hid_t attribute;
+ char *attribute_name;
+ int *attribute_data; /* data for attributes */
+
+ ttsafe_name_data_t *attrib_data;
+
+ attrib_data = (ttsafe_name_data_t *)client_data;
+
+ /* Create attribute */
+ attribute_name = gen_name(attrib_data->current_index);
+ attribute = H5Acreate(attrib_data->dataset, attribute_name,
+ attrib_data->datatype, attrib_data->dataspace,
+ H5P_DEFAULT);
+
+ /* Write data to the attribute */
+ attribute_data = malloc(sizeof(int));
+ *attribute_data = attrib_data->current_index;
+ H5Awrite(attribute, H5T_NATIVE_INT, attribute_data);
+ H5Aclose(attribute);
+ return NULL;
}
void cleanup_acreate(void)
{
- HDunlink(FILENAME);
+ HDunlink(FILENAME);
}
#endif /*H5_HAVE_THREADSAFE*/
diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c
index dd1f74a..052e970 100644
--- a/test/ttsafe_cancel.c
+++ b/test/ttsafe_cancel.c
@@ -40,7 +40,7 @@
*
* 19 May 2000, Bill Wendling
* Changed so that it creates its own HDF5 file and removes it at cleanup
- * time. Added num_errs flag.
+ * time.
*
********************************************************************/
#include "ttsafe.h"
@@ -52,7 +52,7 @@
void *tts_cancel_thread(void *);
void tts_cancel_barrier(void);
-herr_t tts_cancel_callback(void *, hid_t, hsize_t, hssize_t *, void *);
+herr_t tts_cancel_callback(void *, hid_t, unsigned, const hsize_t *, void *);
void cancellation_cleanup(void *);
hid_t cancel_file;
@@ -68,114 +68,104 @@ pthread_cond_t cond;
void tts_cancel(void)
{
- pthread_attr_t attribute;
- hid_t dataset;
- int buffer;
+ pthread_attr_t attribute;
+ hid_t dataset;
+ int buffer;
- /* make thread scheduling global */
- pthread_attr_init(&attribute);
+ /* make thread scheduling global */
+ pthread_attr_init(&attribute);
#ifdef H5_HAVE_SYSTEM_SCOPE_THREADS
- pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
+ pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
#endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */
- /*
- * Create a hdf5 file using H5F_ACC_TRUNC access, default file
- * creation plist and default file access plist
- */
- cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- pthread_create(&childthread, &attribute, tts_cancel_thread, NULL);
- tts_cancel_barrier();
- pthread_cancel(childthread);
-
- dataset = H5Dopen(cancel_file, DATASETNAME);
- H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- &buffer);
-
- if (buffer != 11) {
- TestErrPrintf("operation unsuccessful with value at %d instead of 11\n",
- buffer);
- }
-
- H5Dclose(dataset);
- H5Fclose(cancel_file);
-
- /* Destroy the thread attribute */
- pthread_attr_destroy(&attribute);
+ /*
+ * Create a hdf5 file using H5F_ACC_TRUNC access, default file
+ * creation plist and default file access plist
+ */
+ cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ pthread_create(&childthread, &attribute, tts_cancel_thread, NULL);
+ tts_cancel_barrier();
+ pthread_cancel(childthread);
+
+ dataset = H5Dopen(cancel_file, DATASETNAME);
+ H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer);
+
+ if (buffer != 11)
+ TestErrPrintf("operation unsuccessful with value at %d instead of 11\n", buffer);
+
+ H5Dclose(dataset);
+ H5Fclose(cancel_file);
+
+ /* Destroy the thread attribute */
+ pthread_attr_destroy(&attribute);
}
void *tts_cancel_thread(void UNUSED *arg)
{
- int datavalue;
- int *buffer;
- hid_t dataspace, datatype, dataset;
- hsize_t dimsf[1]; /* dataset dimensions */
- cancel_cleanup_t *cleanup_structure;
-
- /* define dataspace for dataset */
- dimsf[0] = 1;
- dataspace = H5Screate_simple(1,dimsf,NULL);
-
- /* define datatype for the data using native little endian integers */
- datatype = H5Tcopy(H5T_NATIVE_INT);
- H5Tset_order(datatype, H5T_ORDER_LE);
-
- /* create a new dataset within the file */
- dataset = H5Dcreate(cancel_file, DATASETNAME, datatype, dataspace,
- H5P_DEFAULT);
-
- /* If thread is cancelled, make cleanup call */
- cleanup_structure = (cancel_cleanup_t*)malloc(sizeof(cancel_cleanup_t));
- cleanup_structure->dataset = dataset;
- cleanup_structure->datatype = datatype;
- cleanup_structure->dataspace = dataspace;
- pthread_cleanup_push(cancellation_cleanup, cleanup_structure);
-
- datavalue = 1;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- &datavalue);
-
- buffer = malloc(sizeof(int));
- H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- buffer);
- H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback,
- &dataset);
-
- sleep(3);
-
- datavalue = 100;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- &datavalue);
- H5Dclose(dataset);
- H5Tclose(datatype);
- H5Sclose(dataspace);
-
- /*
- * Required by pthreads. The argument 0 pops the stack but does not
- * execute the cleanup routine.
- */
- pthread_cleanup_pop(0);
- return NULL;
+ int datavalue;
+ int *buffer;
+ hid_t dataspace, datatype, dataset;
+ hsize_t dimsf[1]; /* dataset dimensions */
+ cancel_cleanup_t *cleanup_structure;
+
+ /* define dataspace for dataset */
+ dimsf[0] = 1;
+ dataspace = H5Screate_simple(1,dimsf,NULL);
+
+ /* define datatype for the data using native little endian integers */
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ H5Tset_order(datatype, H5T_ORDER_LE);
+
+ /* create a new dataset within the file */
+ dataset = H5Dcreate(cancel_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT);
+
+ /* If thread is cancelled, make cleanup call */
+ cleanup_structure = (cancel_cleanup_t*)malloc(sizeof(cancel_cleanup_t));
+ cleanup_structure->dataset = dataset;
+ cleanup_structure->datatype = datatype;
+ cleanup_structure->dataspace = dataspace;
+ pthread_cleanup_push(cancellation_cleanup, cleanup_structure);
+
+ datavalue = 1;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
+
+ buffer = malloc(sizeof(int));
+ H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
+ H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset);
+
+ sleep(3);
+
+ datavalue = 100;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
+ H5Dclose(dataset);
+ H5Tclose(datatype);
+ H5Sclose(dataspace);
+
+ /*
+ * Required by pthreads. The argument 0 pops the stack but does not
+ * execute the cleanup routine.
+ */
+ pthread_cleanup_pop(0);
+ return NULL;
}
-herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, hsize_t UNUSED ndim,
- hssize_t UNUSED *point, void *operator_data)
+herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, unsigned UNUSED ndim,
+ const hsize_t UNUSED *point, void *operator_data)
{
- int value = *(int *)elem;
- hid_t dataset = *(hid_t *)operator_data;
-
- tts_cancel_barrier();
- sleep(3);
-
- if (value != 1) {
- TestErrPrintf("Error! Element value should be 1 and not %d\n",
- value);
- return -1;
- }
-
- value += 10;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- &value);
- return 0;
+ int value = *(int *)elem;
+ hid_t dataset = *(hid_t *)operator_data;
+
+ tts_cancel_barrier();
+ sleep(3);
+
+ if (value != 1) {
+ TestErrPrintf("Error! Element value should be 1 and not %d\n", value);
+ return -1;
+ }
+
+ value += 10;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
+ return 0;
}
/*
@@ -184,13 +174,13 @@ herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, hsize_t UNUSED ndim
*/
void cancellation_cleanup(void *arg)
{
- cancel_cleanup_t *cleanup_structure = (cancel_cleanup_t *)arg;
- H5Dclose(cleanup_structure->dataset);
- H5Tclose(cleanup_structure->datatype);
- H5Sclose(cleanup_structure->dataspace);
+ cancel_cleanup_t *cleanup_structure = (cancel_cleanup_t *)arg;
+ H5Dclose(cleanup_structure->dataset);
+ H5Tclose(cleanup_structure->datatype);
+ H5Sclose(cleanup_structure->dataspace);
- /* retained for debugging */
- /* print_func("cancellation noted, cleaning up ... \n"); */
+ /* retained for debugging */
+ /* print_func("cancellation noted, cleaning up ... \n"); */
}
/*
@@ -199,18 +189,18 @@ void cancellation_cleanup(void *arg)
*/
void tts_cancel_barrier(void)
{
- static int count = 2;
+ static int count = 2;
- pthread_mutex_lock(&mutex);
+ pthread_mutex_lock(&mutex);
- if (count != 1) {
- count--;
- pthread_cond_wait(&cond, &mutex);
- } else {
- pthread_cond_signal(&cond);
- }
+ if (count != 1) {
+ count--;
+ pthread_cond_wait(&cond, &mutex);
+ } else {
+ pthread_cond_signal(&cond);
+ }
- pthread_mutex_unlock(&mutex);
+ pthread_mutex_unlock(&mutex);
}
void cleanup_cancel(void)
diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c
index f7552c6..8a4b38c 100644
--- a/test/ttsafe_dcreate.c
+++ b/test/ttsafe_dcreate.c
@@ -36,7 +36,7 @@
*
* 19 May 2000, Bill Wendling
* Changed so that it creates its own HDF5 file and removes it at cleanup
- * time. Added num_errs flag.
+ * time.
*
********************************************************************/
#include "ttsafe.h"
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index 4b3444e..07d9e7d 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -39,8 +39,7 @@
*
* 19 May 2000, Bill Wendling
* Modified so that it creates a unique HDF5 file and removes it on
- * cleanup. Also added the num_errs flag and increment it when necessary
- * to report the errors.
+ * cleanup.
*
********************************************************************/
#include "ttsafe.h"
@@ -84,130 +83,122 @@ pthread_mutex_t error_mutex;
void tts_error(void)
{
- pthread_t threads[NUM_THREAD];
- pthread_attr_t attribute;
- H5E_auto_t old_error_cb;
- void *old_error_client_data;
- hid_t dataset;
- int value, i;
+ pthread_t threads[NUM_THREAD];
+ pthread_attr_t attribute;
+ hid_t dataset;
+ int value, i;
- /* set up mutex for global count of errors */
- pthread_mutex_init(&error_mutex, NULL);
+ /* set up mutex for global count of errors */
+ pthread_mutex_init(&error_mutex, NULL);
- /* preserve previous error stack handler */
- H5Eget_auto(&old_error_cb, &old_error_client_data);
-
- /* set our own auto error stack handler */
- H5Eset_auto(error_callback, NULL);
-
- /* make thread scheduling global */
- pthread_attr_init(&attribute);
+ /* make thread scheduling global */
+ pthread_attr_init(&attribute);
#ifdef H5_HAVE_SYSTEM_SCOPE_THREADS
- pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
+ pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
#endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */
- /*
- * Create a hdf5 file using H5F_ACC_TRUNC access, default file
- * creation plist and default file access plist
- */
- error_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /*
+ * Create a hdf5 file using H5F_ACC_TRUNC access, default file
+ * creation plist and default file access plist
+ */
+ error_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- for (i = 0; i < NUM_THREAD; i++)
- pthread_create(&threads[i], &attribute, tts_error_thread, NULL);
+ for (i = 0; i < NUM_THREAD; i++)
+ pthread_create(&threads[i], &attribute, tts_error_thread, NULL);
- for (i = 0; i < NUM_THREAD; i++)
- pthread_join(threads[i],NULL);
+ for (i = 0; i < NUM_THREAD; i++)
+ pthread_join(threads[i],NULL);
- if (error_flag) {
- TestErrPrintf("Threads reporting different error values!\n");
- }
+ if (error_flag)
+ TestErrPrintf("Threads reporting different error values!\n");
- if (error_count != NUM_THREAD - 1) {
- TestErrPrintf("Error: %d threads failed instead of %d\n",
- error_count, NUM_THREAD-1);
- }
+ if (error_count != NUM_THREAD - 1)
+ TestErrPrintf("Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1);
- dataset = H5Dopen(error_file, DATASETNAME);
- H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
+ dataset = H5Dopen(error_file, DATASETNAME);
+ H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
- if (value != WRITE_NUMBER) {
- TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n",
- value, WRITE_NUMBER);
- }
+ if (value != WRITE_NUMBER)
+ TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER);
- H5Dclose(dataset);
- H5Fclose(error_file);
+ H5Dclose(dataset);
+ H5Fclose(error_file);
- /* turn our error stack handler off */
- H5Eset_auto(old_error_cb, old_error_client_data);
-
- /* Destroy the thread attribute */
- pthread_attr_destroy(&attribute);
+ /* Destroy the thread attribute */
+ pthread_attr_destroy(&attribute);
}
static
-void *tts_error_thread(void *arg)
+void *tts_error_thread(void UNUSED *arg)
{
- hid_t dataspace, datatype, dataset;
- hsize_t dimsf[1]; /* dataset dimensions */
- int value;
-
- /* define dataspace for dataset */
- dimsf[0] = 1;
- dataspace = H5Screate_simple(1,dimsf,NULL);
-
- /* define datatype for the data using native little endian integers */
- datatype = H5Tcopy(H5T_NATIVE_INT);
- H5Tset_order(datatype, H5T_ORDER_LE);
-
- /* create a new dataset within the file */
- dataset = H5Dcreate(error_file, DATASETNAME, datatype, dataspace,
- H5P_DEFAULT);
- if (dataset >= 0) { /* not an error */
- value = WRITE_NUMBER;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, &value);
- H5Dclose(dataset);
- }
-
- H5Tclose(datatype);
- H5Sclose(dataspace);
- arg = arg; /* gets rid of annoying warning message */
- return NULL;
+ hid_t dataspace, datatype, dataset;
+ hsize_t dimsf[1]; /* dataset dimensions */
+ H5E_auto_t old_error_cb;
+ void *old_error_client_data;
+ int value;
+
+ /* preserve previous error stack handler */
+ H5Eget_auto(&old_error_cb, &old_error_client_data);
+
+ /* set each thread's error stack handler */
+ H5Eset_auto(error_callback, NULL);
+
+ /* define dataspace for dataset */
+ dimsf[0] = 1;
+ dataspace = H5Screate_simple(1,dimsf,NULL);
+
+ /* define datatype for the data using native little endian integers */
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ H5Tset_order(datatype, H5T_ORDER_LE);
+
+ /* create a new dataset within the file */
+ dataset = H5Dcreate(error_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT);
+ if (dataset >= 0) { /* not an error */
+ value = WRITE_NUMBER;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
+ H5Dclose(dataset);
+ }
+
+ H5Tclose(datatype);
+ H5Sclose(dataspace);
+
+ /* turn our error stack handler off */
+ H5Eset_auto(old_error_cb, old_error_client_data);
+
+ return NULL;
}
static
herr_t error_callback(void *client_data)
{
- pthread_mutex_lock(&error_mutex);
- error_count++;
- pthread_mutex_unlock(&error_mutex);
- client_data = client_data; /* gets rid of annoying warning message */
- return H5Ewalk(H5E_WALK_DOWNWARD, walk_error_callback, NULL);
+ pthread_mutex_lock(&error_mutex);
+ error_count++;
+ pthread_mutex_unlock(&error_mutex);
+
+ return H5Ewalk(H5E_WALK_DOWNWARD, walk_error_callback, client_data);
}
static
-herr_t walk_error_callback(int n, H5E_error_t *err_desc, void *client_data)
+herr_t walk_error_callback(int n, H5E_error_t *err_desc, void UNUSED *client_data)
{
- int maj_num, min_num;
-
- if (err_desc) {
- maj_num = err_desc->maj_num;
- min_num = err_desc->min_num;
-
- if (n < EXPECTED_ERROR_DEPTH && maj_num == expected[n].maj_num &&
- min_num == expected[n].min_num)
- return SUCCEED;
- }
-
- error_flag = -1;
- client_data = client_data; /* gets rid of annoying warning message */
- return SUCCEED;
+ int maj_num, min_num;
+
+ if (err_desc) {
+ maj_num = err_desc->maj_num;
+ min_num = err_desc->min_num;
+
+ if (n < EXPECTED_ERROR_DEPTH && maj_num == expected[n].maj_num &&
+ min_num == expected[n].min_num)
+ return SUCCEED;
+ }
+
+ error_flag = -1;
+ return SUCCEED;
}
void cleanup_error(void)
{
- HDunlink(FILENAME);
+ HDunlink(FILENAME);
}
#endif /*H5_HAVE_THREADSAFE*/
diff --git a/test/ttst.c b/test/ttst.c
index 517c9b6..5663050 100644
--- a/test/ttst.c
+++ b/test/ttst.c
@@ -60,7 +60,7 @@ char **sort_uniq_words;
static int tst_strcmp(const void *_s1, const void *_s2)
{
- return(HDstrcmp(*(const char **)_s1,*(const char **)_s2));
+ return(HDstrcmp(*(const char * const *)_s1,*(const char * const *)_s2));
}
/****************************************************************
@@ -73,7 +73,7 @@ static void
test_tst_init(void)
{
time_t curr_time; /* Current time, for seeding random number generator */
- char *tmp_word=NULL;/* Temporary pointer to word in word set */
+ char *tmp_word;/* Temporary pointer to word in word set */
size_t u,v,w; /* Local index variables */
/* Compute the number of words in the test set */
@@ -208,16 +208,14 @@ test_tst_insert(void)
found=H5ST_find(tree,uniq_words[u]);
CHECK(found, NULL, "H5ST_find");
- if(HDstrcmp((const char *)found->eqkid,uniq_words[u])) {
+ if(HDstrcmp((const char *)found->eqkid,uniq_words[u]))
TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]);
- } /* end if */
obj=H5ST_locate(tree,uniq_words[u]);
CHECK(obj, NULL, "H5ST_locate");
- if(HDstrcmp((const char *)obj,uniq_words[u])) {
+ if(HDstrcmp((const char *)obj,uniq_words[u]))
TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]);
- } /* end if */
} /* end for */
/* Verify that words not in the TST aren't found */
@@ -266,9 +264,8 @@ test_tst_iterate(void)
u=0;
do {
/* Check that the strings in the TST are in the correct order */
- if(HDstrcmp((const char *)found->eqkid,sort_uniq_words[u])) {
+ if(HDstrcmp((const char *)found->eqkid,sort_uniq_words[u]))
TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,sort_uniq_words[u]);
- } /* end if */
/* Advance to next string in TST */
found=H5ST_findnext(found);
@@ -315,9 +312,8 @@ test_tst_remove(void)
CHECK(obj, NULL, "H5ST_remove");
/* Check that the correct string was removed from TST */
- if(HDstrcmp((const char *)obj,rand_uniq_words[u])) {
+ if(HDstrcmp((const char *)obj,rand_uniq_words[u]))
TestErrPrintf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,rand_uniq_words[u]);
- } /* end if */
/* Check that the string can't be found in the TST any longer */
check=H5ST_search(tree,rand_uniq_words[u]);
@@ -337,9 +333,8 @@ test_tst_remove(void)
CHECK(found, NULL, "H5ST_find");
/* Check that the correct object will be removed from TST */
- if(HDstrcmp((const char *)found->eqkid,rand_uniq_words[u])) {
+ if(HDstrcmp((const char *)found->eqkid,rand_uniq_words[u]))
TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,rand_uniq_words[u]);
- } /* end if */
/* Remove the node */
ret=H5ST_delete(tree,found);
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 60773f1..52d883b 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: tvlstr
@@ -195,7 +193,7 @@ test_vlstrings_basic(void)
/* Count the actual number of bytes used by the strings */
for(i=0,str_used=0; i<SPACE1_DIM1; i++)
- str_used+=strlen(wdata[i])+1;
+ str_used+=HDstrlen(wdata[i])+1;
/* Compare against the strings actually written */
VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size");
@@ -209,11 +207,11 @@ test_vlstrings_basic(void)
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
- if(strlen(wdata[i])!=strlen(rdata[i])) {
+ if(HDstrlen(wdata[i])!=strlen(rdata[i])) {
TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
continue;
} /* end if */
- if( strcmp(wdata[i],rdata[i]) != 0 ) {
+ if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
continue;
} /* end if */
@@ -297,11 +295,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i]!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i]!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
- } /* end if */
- } /* end for */
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
@@ -313,11 +309,11 @@ test_vlstrings_special(void)
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
- if(strlen(wdata[i])!=strlen(rdata[i])) {
+ if(HDstrlen(wdata[i])!=strlen(rdata[i])) {
TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
continue;
} /* end if */
- if( strcmp(wdata[i],rdata[i]) != 0 ) {
+ if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
continue;
} /* end if */
@@ -352,11 +348,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i]!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i]!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
- } /* end if */
- } /* end for */
/* Try to write nil strings to disk. */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata2);
@@ -367,11 +361,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i]!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i]!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
- } /* end if */
- } /* end for */
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -534,11 +526,11 @@ test_compact_vlstring(void)
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
- if(strlen(wdata[i])!=strlen(rdata[i])) {
+ if(HDstrlen(wdata[i])!=strlen(rdata[i])) {
TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
continue;
} /* end if */
- if( strcmp(wdata[i],rdata[i]) != 0 ) {
+ if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
continue;
} /* end if */
@@ -609,9 +601,8 @@ static void test_write_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att)!=0) {
+ if(HDstrcmp(string_att_check,string_att)!=0)
TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- } /* end if */
HDfree(string_att_check);
@@ -631,9 +622,8 @@ static void test_write_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0) {
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- } /* end if */
HDfree(string_att_check);
/* The attribute string written is freed below, in the test_read_vl_string_attribute() test */
@@ -691,9 +681,8 @@ static void test_read_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att)!=0) {
+ if(HDstrcmp(string_att_check,string_att)!=0)
TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- } /* end if */
HDfree(string_att_check);
@@ -707,9 +696,8 @@ static void test_read_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0) {
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- } /* end if */
HDfree(string_att_check);
HDfree(string_att_write); /* Free string allocated in test_write_vl_string_attribute */
@@ -861,7 +849,7 @@ test_vlstrings(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Variable-Length Strings\n"));
-/* These tests use the same file */
+ /* These tests use the same file */
/* Test basic VL string datatype */
test_vlstrings_basic();
test_vlstrings_special();
diff --git a/test/tvltypes.c b/test/tvltypes.c
index f2f95de..f510230 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: tvltypes
@@ -177,25 +175,25 @@ test_vltypes_vlen_atomic(void)
hvl_t wdata2[SPACE1_DIM1]; /* Information to write */
hvl_t rdata[SPACE1_DIM1]; /* Information read in */
hvl_t fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t sid2; /* ID of bad dataspace (no extent set */
- hid_t tid1; /* Datatype ID */
- hid_t dcpl_pid; /* Dataset creation property list ID */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t sid2; /* ID of bad dataspace (no extent set) */
+ hid_t tid1; /* Datatype ID */
+ hid_t dcpl_pid; /* Dataset creation property list ID */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i,j; /* counting variables */
+ size_t mem_used=0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Atomic VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+1)*sizeof(unsigned int));
+ wdata[i].p=HDmalloc((i+1)*sizeof(unsigned int));
wdata[i].len=i+1;
for(j=0; j<(i+1); j++)
((unsigned int *)wdata[i].p)[j]=i*10+j;
@@ -225,11 +223,9 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i].len!=0 || rdata[i].p!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i].len!=0 || rdata[i].p!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
- } /* end if */
- } /* end for */
/* Write "nil" data to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata2);
@@ -240,11 +236,9 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i].len!=0 || rdata[i].p!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i].len!=0 || rdata[i].p!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
- } /* end if */
- } /* end for */
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
@@ -276,11 +270,9 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i].len!=0 || rdata[i].p!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i].len!=0 || rdata[i].p!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
- } /* end if */
- } /* end for */
/* Write "nil" data to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata2);
@@ -291,11 +283,9 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i].len!=0 || rdata[i].p!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i].len!=0 || rdata[i].p!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
- } /* end if */
- } /* end for */
/* Write data to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
@@ -519,7 +509,7 @@ rewrite_vltypes_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+increment)*sizeof(unsigned int));
+ wdata[i].p=HDmalloc((i+increment)*sizeof(unsigned int));
wdata[i].len=i+increment;
for(j=0; j<(i+increment); j++)
((unsigned int *)wdata[i].p)[j]=i*20+j;
@@ -680,7 +670,7 @@ test_vltypes_vlen_compound(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+1)*sizeof(s1));
+ wdata[i].p=HDmalloc((i+1)*sizeof(s1));
wdata[i].len=i+1;
for(j=0; j<(i+1); j++) {
((s1 *)wdata[i].p)[j].i=i*10+j;
@@ -826,7 +816,7 @@ rewrite_vltypes_vlen_compound(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+increment)*sizeof(s1));
+ wdata[i].p=HDmalloc((i+increment)*sizeof(s1));
wdata[i].len=i+increment;
for(j=0; j<(i+increment); j++) {
((s1 *)wdata[i].p)[j].i=i*40+j;
@@ -972,10 +962,10 @@ test_vltypes_compound_vlen_vlen(void)
for(i=0; i<SPACE3_DIM1; i++) {
wdata[i].i=i*10;
wdata[i].f=(float)((i*20)/3.0);
- wdata[i].v.p=malloc((i+L1_INCM)*sizeof(hvl_t));
+ wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t));
wdata[i].v.len=i+L1_INCM;
for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) {
- t1->p=malloc((j+L2_INCM)*sizeof(unsigned int));
+ t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int));
t1->len=j+L2_INCM;
for(k=0; k<j+L2_INCM; k++)
((unsigned int*)t1->p)[k] = i*100 + j*10 + k;
@@ -1138,7 +1128,7 @@ test_vltypes_compound_vlen_atomic(void)
for(i=0; i<SPACE1_DIM1; i++) {
wdata[i].i=i*10;
wdata[i].f=(float)((i*20)/3.0);
- wdata[i].v.p=malloc((i+1)*sizeof(unsigned int));
+ wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
wdata[i].v.len=i+1;
for(j=0; j<(i+1); j++)
((unsigned int *)wdata[i].v.p)[j]=i*10+j;
@@ -1252,11 +1242,9 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i].i!=0 || rdata[i].f!=0.0 || rdata[i].v.len!=0 || rdata[i].v.p!=NULL) {
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i].i!=0 || rdata[i].f!=0.0 || rdata[i].v.len!=0 || rdata[i].v.p!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p);
- } /* end if */
- } /* end for */
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
@@ -1358,7 +1346,7 @@ rewrite_vltypes_compound_vlen_atomic(void)
for(i=0; i<SPACE1_DIM1; i++) {
wdata[i].i=i*40;
wdata[i].f=(float)((i*50)/3.0);
- wdata[i].v.p=malloc((i+increment)*sizeof(unsigned int));
+ wdata[i].v.p=HDmalloc((i+increment)*sizeof(unsigned int));
wdata[i].v.len=i+increment;
for(j=0; j<(i+increment); j++)
((unsigned int *)wdata[i].v.p)[j]=i*60+j;
@@ -1525,14 +1513,14 @@ test_vltypes_vlen_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+1)*sizeof(hvl_t));
+ wdata[i].p=HDmalloc((i+1)*sizeof(hvl_t));
if(wdata[i].p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
return;
} /* end if */
wdata[i].len=i+1;
for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) {
- t1->p=malloc((j+1)*sizeof(unsigned int));
+ t1->p=HDmalloc((j+1)*sizeof(unsigned int));
if(t1->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
return;
@@ -1716,14 +1704,14 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+increment)*sizeof(hvl_t));
+ wdata[i].p=HDmalloc((i+increment)*sizeof(hvl_t));
if(wdata[i].p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
return;
} /* end if */
wdata[i].len=i+increment;
for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) {
- t1->p=malloc((j+1)*sizeof(unsigned int));
+ t1->p=HDmalloc((j+1)*sizeof(unsigned int));
if(t1->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
return;
@@ -1892,14 +1880,14 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+increment)*sizeof(hvl_t));
+ wdata[i].p=HDmalloc((i+increment)*sizeof(hvl_t));
if(wdata[i].p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
return;
} /* end if */
wdata[i].len=i+increment;
for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) {
- t1->p=malloc((j+1)*sizeof(unsigned int));
+ t1->p=HDmalloc((j+1)*sizeof(unsigned int));
if(t1->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
return;
diff --git a/test/unlink.c b/test/unlink.c
index d0cfbaa..4888521 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -1899,7 +1899,7 @@ error:
static int
test_resurrect_datatype(void)
{
- hid_t file=-1, type=-1, fapl=-1, loc_id=-1;
+ hid_t file=-1, type=-1, fapl=-1;
char filename[1024];
TESTING("Resurrecting datatype after deletion");
@@ -2017,8 +2017,8 @@ error:
} H5E_END_TRY;
return 1;
} /* end test_resurrect_group() */
-
+
/*-------------------------------------------------------------------------
* Function: test_unlink_chunked_dataset
*