summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/big.c4
-rw-r--r--test/cache.c12
-rw-r--r--test/cmpd_dset.c26
-rw-r--r--test/dsets.c395
-rw-r--r--test/dtransform.c147
-rw-r--r--test/dtypes.c1797
-rw-r--r--test/extend.c2
-rw-r--r--test/external.c4
-rw-r--r--test/file_handle.c3
-rw-r--r--test/filename.c3
-rw-r--r--test/fillval.c68
-rw-r--r--test/gen_nullspace.c87
-rw-r--r--test/getname.c12
-rw-r--r--test/h5test.c6
-rw-r--r--test/hyperslab.c58
-rw-r--r--test/istore.c21
-rw-r--r--test/ntypes.c38
-rw-r--r--test/ohdr.c4
-rwxr-xr-xtest/reserved.c26
-rw-r--r--test/stream_test.c2
-rw-r--r--test/tarray.c4
-rw-r--r--test/tfile.c11
-rw-r--r--test/th5s.c10
-rw-r--r--test/tmeta.c2
-rw-r--r--test/tmisc.c22
-rw-r--r--test/trefer.c106
-rw-r--r--test/tselect.c455
-rw-r--r--test/tskiplist.c14
-rw-r--r--test/ttsafe_acreate.c42
-rw-r--r--test/ttsafe_cancel.c6
-rw-r--r--test/ttsafe_dcreate.c2
-rw-r--r--test/ttsafe_error.c2
-rw-r--r--test/ttst.c6
-rw-r--r--test/tvltypes.c27
-rw-r--r--test/unlink.c2
35 files changed, 1981 insertions, 1445 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 9b01c2e..36dda3b 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -315,7 +315,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);
@@ -792,7 +792,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)
{
@@ -1931,7 +1931,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);
}
@@ -5169,7 +5169,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 ) {
@@ -5181,7 +5181,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 ) {
@@ -13203,7 +13203,7 @@ check_auto_cache_resize_input_errs(void)
invalid_auto_size_ctl.decr_mode =
- (enum H5C_cache_incr_mode) 4; /* INVALID */
+ (enum H5C_cache_decr_mode) 4; /* INVALID */
invalid_auto_size_ctl.upper_hr_threshold = 0.999;
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 638a865..802fc87 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -1,4 +1,4 @@
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
@@ -23,7 +23,6 @@
#include <time.h>
#include "h5test.h"
-#include "H5private.h"
/*
* This file needs to access private datatypes from the H5Z package.
@@ -1296,7 +1295,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 */
@@ -1634,115 +1633,200 @@ error:
*
*-------------------------------------------------------------------------
*/
+#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 = 10;
- herr_t err;
- int test_ints[10] = { 12 };
- int read_buf[10];
- int i;
- char * srcdir = HDgetenv("srcdir"); /* 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 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);
+ 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 */
+
+ /*
+ * 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);
- file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
- if (file_id < 0) goto error;
+ file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
+ if (file_id < 0) goto error;
- dset_id = H5Dopen(file_id, dset_name);
- if (dset_id < 0) goto error;
+ dset_id = H5Dopen(file_id, dset_name);
+ if (dset_id < 0) goto error;
- space_id = H5Screate_simple(1, &dims, NULL);
- if (space_id < 0) goto error;
+ space_id = H5Screate_simple(1, &dims, NULL);
+ if (space_id < 0) goto error;
TESTING(" decoding without encoder");
/* 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;
+ err = H5Dread(dset_id, H5T_NATIVE_INT, space_id, space_id, H5P_DEFAULT, read_buf);
+ if (err < 0) goto error;
- for(i = 0; i < 10; i++)
- if ( read_buf[i] != i ) goto error;
+ for(i = 0; i < 10; i++)
+ if ( read_buf[i] != i ) goto error;
- H5Sclose(space_id);
+ H5Sclose(space_id);
- PASSED();
+ PASSED();
- /* 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.
- */
+ /* 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");
- dcpl_id = H5Dget_create_plist(dset_id);
- if (dcpl_id < 0) goto error;
+ dcpl_id = H5Dget_create_plist(dset_id);
+ if (dcpl_id < 0) goto error;
- space_id = H5Screate_simple(1, &dims, NULL);
- if (space_id < 0) goto error;
+ space_id = H5Screate_simple(1, &dims, NULL);
+ if (space_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
+ H5E_BEGIN_TRY{
+ test_dset_id = H5Dcreate(file_id, NOENCODER_TEST_DATASET, H5T_NATIVE_INT, space_id , dcpl_id);
+ }H5E_END_TRY
- if (test_dset_id >= 0) goto error;
+ if (test_dset_id >= 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 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 (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
+ /* 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;
- H5Fclose(file_id);
- H5Dclose(dset_id);
- H5Sclose(space_id);
- H5Pclose(dcpl_id);
+ H5Fclose(file_id);
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Pclose(dcpl_id);
- PASSED();
+ PASSED();
- return 0;
+ 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
+ *
+ * Purpose: Tests the H5Zget_filter_info function.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Nat Furrer and James Laird
+ * Thursday, June 10, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_get_filter_info(void)
+{
+ unsigned int flags; /* flags returned from H5Zget_filter_info */
+ herr_t err;
+
+ TESTING("H5Zget_filter_info");
+
+ /* Verify that each filter is reported as having the right combination
+ * of encoder and decoder.
+ */
+#ifdef H5_HAVE_FILTER_FLETCHER32
+ 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))
+ TEST_ERROR
+#endif
+
+#ifdef H5_HAVE_FILTER_SHUFFLE
+ 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))
+ TEST_ERROR
+#endif
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ 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))
+ TEST_ERROR
+#endif
+
+#ifdef H5_HAVE_FILTER_SZIP
+ 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))
+ TEST_ERROR
+#else
+ if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) != 0) ||
+ ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
+ 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 */
+ /* (Depends on 1.6 compatibility flag) */
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ if (H5Zget_filter_info(-1, &flags) < 0) TEST_ERROR
+ if (flags != 0) TEST_ERROR
+#else /* H5_WANT_H5_V1_6_COMPAT */
+ H5E_BEGIN_TRY {
+ err = H5Zget_filter_info(-1, &flags);
+ } H5E_END_TRY;
+ if (err >= 0) TEST_ERROR
+#endif /* H5_WANT_H5_V1_6_COMPAT */
+
+ PASSED();
+ return 0;
+
+error:
+ return -1;
}
/*-------------------------------------------------------------------------
@@ -1782,7 +1866,7 @@ test_filters(hid_t file)
hsize_t deflate_size; /* Size of dataset with deflate filter */
#endif /* H5_HAVE_FILTER_DEFLATE */
-#ifdef H5_HAVE_FILTER_SZIP
+#ifdef H5_HAVE_FILTER_SZIP
hsize_t szip_size; /* Size of dataset with szip filter */
unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block=4;
@@ -1795,7 +1879,10 @@ test_filters(hid_t file)
#if (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP) && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32
hsize_t combo_size; /* Size of dataset with shuffle+deflate filter */
#endif /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_FLETCHER32 */
-
+
+ /* test the H5Zget_filter_info function */
+ if(test_get_filter_info() < 0) goto error;
+
/*----------------------------------------------------------
* STEP 0: Test null I/O filter by itself.
*----------------------------------------------------------
@@ -1917,9 +2004,7 @@ test_filters(hid_t file)
* STEP 4: Test shuffling by itself.
*----------------------------------------------------------
*/
-
#ifdef H5_HAVE_FILTER_SHUFFLE
-
puts("Testing shuffle filter");
if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error;
@@ -1945,7 +2030,6 @@ test_filters(hid_t file)
*----------------------------------------------------------
*/
#if defined H5_HAVE_FILTER_DEFLATE && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32
-
puts("Testing shuffle+deflate+checksum filters(checksum first)");
if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error;
@@ -2008,9 +2092,9 @@ test_filters(hid_t file)
/* 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 */
+ TESTING("shuffle+szip+checksum filters(checksum last, with encoder)");
+ /* Make sure encoding is enabled */
if ( h5_szip_can_encode() == 1) {
puts("");
if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
@@ -2644,7 +2728,7 @@ test_can_apply(hid_t file)
} /* end if */
/* Create new dataset */
- /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
+ /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
H5E_BEGIN_TRY {
dsid = H5Dcreate(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_DOUBLE, sid, dcpl);
} H5E_END_TRY;
@@ -2782,139 +2866,140 @@ file)
if (h5_szip_can_encode() == 1) {
/* Create the data space */
- if ((sid = H5Screate_simple(2, dims, NULL))<0) {
+ if ((sid = H5Screate_simple(2, dims, NULL))<0) {
H5_FAILED();
printf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) {
+ /* Create dcpl with special filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) {
H5_FAILED();
printf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
- } /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) {
+ } /* end if */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) {
H5_FAILED();
printf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Set (invalid at property set time) szip parameters */
- szip_pixels_per_block=3;
- H5E_BEGIN_TRY {
+ /* Set (invalid at property set time) szip parameters */
+ szip_pixels_per_block=3;
+ H5E_BEGIN_TRY {
ret=H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block);
- } H5E_END_TRY;
- if(ret>=0) {
+ } H5E_END_TRY;
+ if(ret>=0) {
H5_FAILED();
printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
goto error;
- }
+ }
- /* Set (invalid at property set time) szip parameters */
- szip_pixels_per_block=512;
- H5E_BEGIN_TRY {
+ /* Set (invalid at property set time) szip parameters */
+ szip_pixels_per_block=512;
+ H5E_BEGIN_TRY {
ret=H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block);
- } H5E_END_TRY;
- if(ret>=0) {
+ } H5E_END_TRY;
+ if(ret>=0) {
H5_FAILED();
printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
goto error;
- }
+ }
- /* Set (invalid at dataset creation time) szip parameters */
- szip_pixels_per_block=2;
- if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) {
+ /* Set (invalid at dataset creation time) szip parameters */
+ szip_pixels_per_block=2;
+ if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) {
H5_FAILED();
printf(" Line %d: Can't set szip filter\n",__LINE__);
goto error;
- }
+ }
- /* Create new dataset */
- /* (Should succeed; according to the new algorithm, scanline should be reset
+ /* Create new dataset */
+ /* (Should succeed; according to the new algorithm, scanline should be reset
to 2*128 satisfying 'maximum blocks per scanline' condition) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY {
dsid = H5Dcreate(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, dcpl);
- } H5E_END_TRY;
- if (dsid <=0) {
+ } H5E_END_TRY;
+ if (dsid <=0) {
H5_FAILED();
printf(" Line %d: Should have created dataset!\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Close dataset */
- if(H5Dclose(dsid)<0) {
+ /* Close dataset */
+ if(H5Dclose(dsid)<0) {
H5_FAILED();
printf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Close dataspace */
- if(H5Sclose(sid)<0) {
+ /* Close dataspace */
+ if(H5Sclose(sid)<0) {
H5_FAILED();
printf(" Line %d: Can't close dataspace\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Close dataset creation property list */
- if(H5Pclose(dcpl)<0) {
+ /* Close dataset creation property list */
+ if(H5Pclose(dcpl)<0) {
H5_FAILED();
printf(" Line %d: Can't close dcpl\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Create another data space */
- if ((sid = H5Screate_simple(2, dims2, NULL))<0) {
+ /* Create another data space */
+ if ((sid = H5Screate_simple(2, dims2, NULL))<0) {
H5_FAILED();
printf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) {
+ /* Create dcpl with special filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) {
H5_FAILED();
printf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
- } /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims2)<0) {
+ } /* end if */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims2)<0) {
H5_FAILED();
printf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Set (invalid at dataset creation time) szip parameters */
- szip_pixels_per_block=32;
- if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) {
+ /* Set (invalid at dataset creation time) szip parameters */
+ szip_pixels_per_block=32;
+ if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) {
H5_FAILED();
printf(" Line %d: Can't set szip filter\n",__LINE__);
goto error;
- }
+ }
- /* Create new dataset */
- /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
- H5E_BEGIN_TRY {
+ /* Create new dataset */
+ /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
+ H5E_BEGIN_TRY {
dsid = H5Dcreate(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, dcpl);
- } H5E_END_TRY;
- if (dsid >=0) {
+ } H5E_END_TRY;
+ if (dsid >=0) {
H5_FAILED();
printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
H5Dclose(dsid);
goto error;
- } /* end if */
+ } /* end if */
- /* Close dataspace */
- if(H5Sclose(sid)<0) {
+ /* Close dataspace */
+ if(H5Sclose(sid)<0) {
H5_FAILED();
printf(" Line %d: Can't close dataspace\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
- /* Close dataset creation property list */
- if(H5Pclose(dcpl)<0) {
+ /* Close dataset creation property list */
+ if(H5Pclose(dcpl)<0) {
H5_FAILED();
printf(" Line %d: Can't close dcpl\n",__LINE__);
goto error;
- } /* end if */
+ } /* end if */
+
PASSED();
} else {
@@ -3701,7 +3786,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];
diff --git a/test/dtransform.c b/test/dtransform.c
index ebe90bb..6dc5eb2 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -98,22 +98,22 @@ const int transformData[ROWS][COLS] =
if(SIGNED) \
{ \
if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \
- if((err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c))<0) TEST_ERROR; \
- if((err = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; \
- if((err = H5Pclose(dxpl_id_f_to_c))<0) TEST_ERROR; \
+ if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c)<0) TEST_ERROR; \
+ if(H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; \
+ if(H5Pclose(dxpl_id_f_to_c)<0) TEST_ERROR; \
} \
else \
{ \
if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \
- if((err= H5Pset_data_transform(dxpl_id_utrans, utrans))<0) TEST_ERROR; \
- if((err = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData))<0) TEST_ERROR; \
- if((err = H5Pclose(dxpl_id_utrans))<0) TEST_ERROR; \
+ if(H5Pset_data_transform(dxpl_id_utrans, utrans)<0) TEST_ERROR; \
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData)<0) TEST_ERROR; \
+ if(H5Pclose(dxpl_id_utrans)<0) TEST_ERROR; \
} \
\
\
TESTING("contiguous, no data type conversion ("TEST_STR"->"TEST_STR")") \
\
- if((err = H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array))<0) TEST_ERROR; \
+ if(H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array)<0) TEST_ERROR; \
if(SIGNED) \
COMPARE(TYPE, array, COMPARE_DATA, 2) \
else \
@@ -123,15 +123,15 @@ const int transformData[ROWS][COLS] =
{ \
TESTING("contiguous, with type conversion (float->"TEST_STR")") \
\
- if((err = H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array))<0) TEST_ERROR; \
+ if(H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array)<0) TEST_ERROR; \
if(SIGNED) \
COMPARE(TYPE, array, COMPARE_DATA, 2) \
else \
UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
} \
\
- if((err = H5Dclose(dset))<0) TEST_ERROR; \
- if((err = H5Sclose(dataspace))<0) TEST_ERROR; \
+ if(H5Dclose(dset)<0) TEST_ERROR; \
+ if(H5Sclose(dataspace)<0) TEST_ERROR; \
}
#define TEST_TYPE_CHUNK(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \
@@ -143,38 +143,38 @@ const int transformData[ROWS][COLS] =
\
hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \
hsize_t dim[2] = {ROWS, COLS}; \
- hssize_t offset[2] = {0, 0}; \
+ hsize_t offset[2] = {0, 0}; \
\
\
if((dataspace = H5Screate_simple(2, dim, NULL))<0) TEST_ERROR; \
\
cparms = H5Pcreate(H5P_DATASET_CREATE); \
- if( (err = H5Pset_chunk(cparms, 2, dim)) < 0) TEST_ERROR; \
+ if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR; \
\
if((dset_chunk = H5Dcreate(file_id, "/transformtest_chunk_"TEST_STR, HDF_TYPE, dataspace, cparms))<0) TEST_ERROR; \
filespace = H5Dget_space (dset_chunk); \
memspace = H5Screate_simple(2, dim, NULL); \
- if((err = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL)) < 0) TEST_ERROR; \
+ if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR; \
\
if(SIGNED) \
{ \
if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \
- if((err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c))<0) TEST_ERROR; \
- if((err = H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; \
- if((err = H5Pclose(dxpl_id_f_to_c))<0) TEST_ERROR; \
+ if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c)<0) TEST_ERROR; \
+ if(H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; \
+ if(H5Pclose(dxpl_id_f_to_c)<0) TEST_ERROR; \
} \
else \
{ \
if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \
- if((err= H5Pset_data_transform(dxpl_id_utrans, utrans))<0) TEST_ERROR; \
- if((err = H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData))<0) TEST_ERROR; \
- if((err = H5Pclose(dxpl_id_utrans))<0) TEST_ERROR; \
+ if(H5Pset_data_transform(dxpl_id_utrans, utrans)<0) TEST_ERROR; \
+ if(H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData)<0) TEST_ERROR; \
+ if(H5Pclose(dxpl_id_utrans)<0) TEST_ERROR; \
} \
\
\
TESTING("chunked, no data type conversion ("TEST_STR"->"TEST_STR")") \
\
- if((err = H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array))<0) TEST_ERROR; \
+ if(H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array)<0) TEST_ERROR; \
if(SIGNED) \
COMPARE(TYPE, array, COMPARE_DATA, 2) \
else \
@@ -184,7 +184,7 @@ const int transformData[ROWS][COLS] =
{ \
TESTING("chunked, with type conversion (float->"TEST_STR")") \
\
- if((err = H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array))<0) TEST_ERROR; \
+ if(H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array)<0) TEST_ERROR; \
if(SIGNED) \
COMPARE(TYPE, array, COMPARE_DATA, 2) \
else \
@@ -193,13 +193,13 @@ const int transformData[ROWS][COLS] =
\
\
\
- if((err = H5Dclose(dset_chunk))<0) TEST_ERROR; \
- if((err = H5Sclose(dataspace))<0) TEST_ERROR; \
+ if(H5Dclose(dset_chunk)<0) TEST_ERROR; \
+ if(H5Sclose(dataspace)<0) TEST_ERROR; \
}
#define INVALID_SET_TEST(TRANSFORM) \
{ \
- if((err = H5Pset_data_transform(dxpl_id, TRANSFORM))<0) \
+ if(H5Pset_data_transform(dxpl_id, TRANSFORM)<0) \
{ \
PASSED(); \
} \
@@ -221,23 +221,21 @@ int main(void)
/* inverses the utrans transform in init_test to get back original array */
const char* utrans_inv = "(x/3)*4 - 100";
- herr_t err;
-
if((dxpl_id_c_to_f = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR;
if((dxpl_id_simple = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR;
if((dxpl_id_utrans_inv = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR;
if((dxpl_id_polynomial = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR;
- if((err = H5Pset_data_transform(dxpl_id_c_to_f, c_to_f))<0) TEST_ERROR;
- if((err = H5Pset_data_transform(dxpl_id_polynomial, polynomial))<0) TEST_ERROR;
- if((err = H5Pset_data_transform(dxpl_id_simple, simple))<0) TEST_ERROR;
- if((err = H5Pset_data_transform(dxpl_id_utrans_inv, utrans_inv))<0) TEST_ERROR;
+ if(H5Pset_data_transform(dxpl_id_c_to_f, c_to_f)<0) TEST_ERROR;
+ if(H5Pset_data_transform(dxpl_id_polynomial, polynomial)<0) TEST_ERROR;
+ if(H5Pset_data_transform(dxpl_id_simple, simple)<0) TEST_ERROR;
+ if(H5Pset_data_transform(dxpl_id_utrans_inv, utrans_inv)<0) TEST_ERROR;
if((dxpl_id_polynomial_copy = H5Pcopy(dxpl_id_polynomial)) < 0) TEST_ERROR;
if((dxpl_id_c_to_f_copy = H5Pcopy(dxpl_id_c_to_f)) < 0) TEST_ERROR;
/* Run all the tests */
- if((err = init_test(&file_id)) < 0) TEST_ERROR;
- if((err = test_set()) < 0) TEST_ERROR;
+ if(init_test(&file_id) < 0) TEST_ERROR;
+ if(test_set() < 0) TEST_ERROR;
TEST_TYPE_CONTIG(dxpl_id_utrans_inv, char, H5T_NATIVE_CHAR, "char", transformData, 0);
TEST_TYPE_CONTIG(dxpl_id_utrans_inv, unsigned char, H5T_NATIVE_UCHAR, "uchar", transformData, 0);
@@ -273,23 +271,23 @@ int main(void)
TEST_TYPE_CHUNK(dxpl_id_c_to_f, double, H5T_NATIVE_DOUBLE, "double", windchillFfloat, 1);
TEST_TYPE_CHUNK(dxpl_id_c_to_f, long double, H5T_NATIVE_LDOUBLE, "ldouble", windchillFfloat, 1);
- if((err = test_copy(dxpl_id_c_to_f_copy, dxpl_id_polynomial_copy)) < 0) TEST_ERROR;
- if((err = test_trivial(dxpl_id_simple)) < 0) TEST_ERROR;
- if((err = test_poly(dxpl_id_polynomial)) < 0) TEST_ERROR;
- if((err = test_getset(dxpl_id_c_to_f)) < 0) TEST_ERROR;
+ if(test_copy(dxpl_id_c_to_f_copy, dxpl_id_polynomial_copy) < 0) TEST_ERROR;
+ if(test_trivial(dxpl_id_simple) < 0) TEST_ERROR;
+ if(test_poly(dxpl_id_polynomial) < 0) TEST_ERROR;
+ if(test_getset(dxpl_id_c_to_f) < 0) TEST_ERROR;
/* Close the objects we opened/created */
- if((err = H5Dclose(dset_id_int))<0) TEST_ERROR;
- if((err = H5Dclose(dset_id_int_chunk))<0) TEST_ERROR;
- if((err = H5Dclose(dset_id_float))<0) TEST_ERROR;
- if((err = H5Dclose(dset_id_float_chunk))<0) TEST_ERROR;
- if((err = H5Fclose(file_id))<0) TEST_ERROR;
- if((err = H5Pclose(dxpl_id_c_to_f))<0) TEST_ERROR;
- if((err = H5Pclose(dxpl_id_c_to_f_copy))<0) TEST_ERROR;
- if((err = H5Pclose(dxpl_id_polynomial))<0) TEST_ERROR;
- if((err = H5Pclose(dxpl_id_polynomial_copy))<0) TEST_ERROR;
- if((err = H5Pclose(dxpl_id_simple))<0) TEST_ERROR;
- if((err = H5Pclose(dxpl_id_utrans_inv))<0) TEST_ERROR;
+ if(H5Dclose(dset_id_int)<0) TEST_ERROR;
+ if(H5Dclose(dset_id_int_chunk)<0) TEST_ERROR;
+ if(H5Dclose(dset_id_float)<0) TEST_ERROR;
+ if(H5Dclose(dset_id_float_chunk)<0) TEST_ERROR;
+ if(H5Fclose(file_id)<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_c_to_f)<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_c_to_f_copy)<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_polynomial)<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_polynomial_copy)<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_simple)<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_utrans_inv)<0) TEST_ERROR;
return 0;
@@ -304,50 +302,47 @@ int init_test(hid_t* file_id)
/* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */
const char* utrans = "((x+100)/4)*3";
- herr_t err;
- hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, filespace, memspace;
+ hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, filespace;
hsize_t dim[2] = {ROWS, COLS};
- hssize_t offset[2] = {0, 0};
+ hsize_t offset[2] = {0, 0};
if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR;
if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR;
- if((err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c))<0) TEST_ERROR;
- if((err= H5Pset_data_transform(dxpl_id_utrans, utrans))<0) TEST_ERROR;
+ if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c)<0) TEST_ERROR;
+ if(H5Pset_data_transform(dxpl_id_utrans, utrans)<0) TEST_ERROR;
if((*file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) TEST_ERROR;
cparms = H5Pcreate(H5P_DATASET_CREATE);
- err = H5Pset_chunk(cparms, 2, dim);
+ if(H5Pset_chunk(cparms, 2, dim)<0) TEST_ERROR;
- memspace = H5Screate_simple(2, dim, NULL);
-
if((dataspace = H5Screate_simple(2, dim, NULL))<0) TEST_ERROR;
TESTING("Intializing test...")
if((dset_id_int = H5Dcreate(*file_id, "/default_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT))<0) TEST_ERROR;
- if((err = H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR;
+ if(H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR;
if((dset_id_float = H5Dcreate(*file_id, "/default_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT))<0) TEST_ERROR;
- if((err = H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR;
+ if(H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR;
if((dset_id_int_chunk = H5Dcreate(*file_id, "/default_chunk_int", H5T_NATIVE_INT, dataspace, cparms))<0) TEST_ERROR;
filespace = H5Dget_space (dset_id_int_chunk);
- if((err = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL)) < 0) TEST_ERROR;
- if((err = H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR;
+ if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR;
+ if(H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR;
if((dset_id_float_chunk = H5Dcreate(*file_id, "/default_chunk_float", H5T_NATIVE_FLOAT, dataspace, cparms))<0) TEST_ERROR;
- if((err = H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR;
+ if(H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR;
PASSED();
- if((err = H5Pclose(dxpl_id_f_to_c))<0) TEST_ERROR;
- if((err = H5Pclose(dxpl_id_utrans))<0) TEST_ERROR;
- if((err = H5Sclose(dataspace))<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_f_to_c)<0) TEST_ERROR;
+ if(H5Pclose(dxpl_id_utrans)<0) TEST_ERROR;
+ if(H5Sclose(dataspace)<0) TEST_ERROR;
return 0;
error:
@@ -360,8 +355,6 @@ int test_poly(const hid_t dxpl_id_polynomial)
int polyintread[ROWS][COLS];
float polyflread[ROWS][COLS];
int windchillC;
-
- herr_t err;
int row, col;
for(row = 0; row<ROWS; row++)
@@ -374,7 +367,7 @@ int test_poly(const hid_t dxpl_id_polynomial)
}
TESTING("data transform, polynomial transform (int->float)")
- if((err = H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread))<0) TEST_ERROR;
+ if(H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread)<0) TEST_ERROR;
COMPARE(float, polyflread, polyflres, 2.0)
@@ -388,7 +381,7 @@ int test_poly(const hid_t dxpl_id_polynomial)
}
TESTING("data transform, polynomial transform (float->int)")
- if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread))<0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread)<0) TEST_ERROR;
COMPARE(int, polyintread, polyflres, 4)
return 0;
@@ -403,9 +396,6 @@ int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_co
float polyflres[ROWS][COLS];
int polyintread[ROWS][COLS];
int windchillFintread[ROWS][COLS];
-
- herr_t err;
-
int row, col;
for(row = 0; row<ROWS; row++)
@@ -419,11 +409,11 @@ int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_co
TESTING("data transform, linear transform w/ copied property")
- if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread))<0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread)<0) TEST_ERROR;
COMPARE(int, windchillFintread, windchillFfloat, 2)
TESTING("data transform, polynomial transform w/ copied property")
- if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread))<0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread)<0) TEST_ERROR;
COMPARE(int, polyintread, polyflres, 2)
return 0;
@@ -436,12 +426,10 @@ int test_trivial(const hid_t dxpl_id_simple)
{
float windchillFfloatread[ROWS][COLS];
int windchillFintread[ROWS][COLS];
-
- herr_t err;
int row, col;
TESTING("data transform, trivial transform, without type conversion")
- if((err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread))<0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread)<0) TEST_ERROR;
for(row = 0; row<ROWS; row++)
{
for(col = 0; col<COLS; col++)
@@ -457,7 +445,7 @@ int test_trivial(const hid_t dxpl_id_simple)
PASSED();
TESTING("data transform, trivial transform, with type conversion")
- if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread))<0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread)<0) TEST_ERROR;
for(row = 0; row<ROWS; row++)
{
for(col = 0; col<COLS; col++)
@@ -479,10 +467,8 @@ error:
int test_getset(const hid_t dxpl_id_c_to_f)
{
- herr_t err;
int row, col;
float windchillFfloatread[ROWS][COLS];
-
const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
const char* c_to_f = "(9/5.0)*x + 32";
char* ptrgetTest = HDmalloc(HDstrlen(simple)+1);
@@ -498,10 +484,10 @@ int test_getset(const hid_t dxpl_id_c_to_f)
else
PASSED();
- if((err = H5Pset_data_transform(dxpl_id_c_to_f, simple))<0) TEST_ERROR;
+ if(H5Pset_data_transform(dxpl_id_c_to_f, simple)<0) TEST_ERROR;
TESTING("data transform, read after reseting of transform property")
- if((err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread))<0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread)<0) TEST_ERROR;
for(row = 0; row<ROWS; row++)
{
for(col = 0; col<COLS; col++)
@@ -544,7 +530,6 @@ error:
int test_set(void)
{
hid_t dxpl_id;
- herr_t err;
H5E_auto_stack_t func;
const char* str = "(9/5.0)*x + 32";
char* ptrgetTest = malloc(strlen(str)+1);
diff --git a/test/dtypes.c b/test/dtypes.c
index b27de1d..e21cd23 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1609,8 +1609,8 @@ test_compound_9(void)
goto error;
if(H5Tclose(cmpd_tid)<0)
goto error;
- /*if(H5Tclose(dup_tid)<0)
- goto error;*/
+ if(H5Tclose(dup_tid)<0)
+ goto error;
if(H5Tclose(str_id)<0)
goto error;
if(H5Sclose(space_id)<0)
@@ -1644,7 +1644,7 @@ test_compound_9(void)
} /* end if */
rdata.i1 = rdata.i2 = 0;
- free(rdata.str);
+ if(rdata.str) free(rdata.str);
if(H5Dread(dset_id,dup_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) {
H5_FAILED(); AT();
@@ -1658,6 +1658,8 @@ test_compound_9(void)
goto error;
} /* end if */
+ if(rdata.str) free(rdata.str);
+
if(H5Dclose(dset_id)<0)
goto error;
if(H5Tclose(cmpd_tid)<0)
@@ -2092,7 +2094,7 @@ 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");
@@ -2101,31 +2103,35 @@ test_compound_12(void)
if ((complex_id = H5Tcreate(H5T_COMPOUND, 1))<0) goto error;
/* Verify the size */
- if((new_size=H5Tget_size(complex_id))<0) goto error;
+ if((new_size=H5Tget_size(complex_id))==0) goto error;
if(new_size!=1) goto error;
/* Add a couple fields and adjust the size */
offset = size;
- if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error;
+ 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;
- if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error;
+ 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. */
- if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error;
+ if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
+ size+=tmp_size;
if (H5Tset_size(complex_id, size)<0) goto error;
- if((size-=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error;
+ 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 */
- if((new_size=H5Tget_size(complex_id))<0) goto error;
+ if((new_size=H5Tget_size(complex_id))==0) goto error;
if(new_size!=size) goto error;
/* Tries to cut last member. Supposed to fail. */
@@ -2149,23 +2155,23 @@ test_compound_12(void)
/*-------------------------------------------------------------------------
- * Function: test_encode
+ * Function: test_query
*
- * Purpose: Tests functions of encoding and decoding data type.
+ * Purpose: Tests query functions of compound and enumeration types.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Raymond Lu
- * July 14, 2004
+ * Thursday, April 4, 2002
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
-test_encode(void)
+test_query(void)
{
struct s1 {
int a;
@@ -2174,26 +2180,17 @@ test_encode(void)
double d;
};
hid_t file=-1, tid1=-1, tid2=-1;
- hid_t decoded_tid1=-1, decoded_tid2=-1;
char filename[1024];
char compnd_type[]="Compound_type", enum_type[]="Enum_type";
short enum_val;
- size_t cmpd_buf_size = 0;
- size_t enum_buf_size = 0;
- unsigned char *cmpd_buf=NULL, *enum_buf=NULL;
- herr_t ret;
- TESTING("functions of encoding and decoding data types");
+ TESTING("query functions of compound and enumeration types");
/* Create File */
- h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename);
+ h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
goto error;
- /*-----------------------------------------------------------------------
- * Create compound and enumerate data types
- *-----------------------------------------------------------------------
- */
/* Create a compound datatype */
if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) {
H5_FAILED();
@@ -2252,110 +2249,31 @@ test_encode(void)
printf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
-
- /*-----------------------------------------------------------------------
- * Test encoding and decoding compound and enumerate data types
- *-----------------------------------------------------------------------
- */
- /* Encode compound type in a buffer */
- if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode compound type\n");
- goto error;
- } /* end if */
-
- if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
-
- /* Try decoding bogus buffer */
- H5E_BEGIN_TRY {
- ret = H5Tdecode(cmpd_buf);
- } H5E_END_TRY;
- if(ret!=FAIL) {
- H5_FAILED();
- printf("Decoded bogus buffer!\n");
- goto error;
- }
-
- if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode compound type\n");
- goto error;
- } /* end if */
-
- /* Decode from the compound buffer and return an object handle */
- if((decoded_tid1=H5Tdecode(cmpd_buf))<0) {
- H5_FAILED();
- printf("Can't decode compound type\n");
- goto error;
- } /* end if */
-
- /* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid1, tid1)<=0) {
- H5_FAILED();
- printf("Datatype wasn't encoded & decoded identically\n");
- goto error;
- } /* end if */
/* Query member number and member index by name, for compound type. */
- if(H5Tget_nmembers(decoded_tid1)!=4) {
+ if(H5Tget_nmembers(tid1)!=4) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid1, "c")!=2) {
+ if(H5Tget_member_index(tid1, "c")!=2) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
-
- /* Encode enumerate type in a buffer */
- if(H5Tencode(tid2, NULL, &enum_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode enumerate type\n");
- goto error;
- } /* end if */
-
- if(enum_buf_size>0)
- enum_buf = (unsigned char*)calloc(1, enum_buf_size);
-
- if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode enumerate type\n");
- goto error;
- } /* end if */
-
- /* Decode from the enumerate buffer and return an object handle */
- if((decoded_tid2=H5Tdecode(enum_buf))<0) {
- H5_FAILED();
- printf("Can't decode enumerate type\n");
- goto error;
- } /* end if */
-
- /* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid2, tid2)<=0) {
- H5_FAILED();
- printf("Datatype wasn't encoded & decoded identically\n");
- goto error;
- } /* end if */
-
/* Query member number and member index by name, for enumeration type. */
- if(H5Tget_nmembers(decoded_tid2)!=5) {
+ if(H5Tget_nmembers(tid2)!=5) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
+ if(H5Tget_member_index(tid2, "ORANGE")!=3) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
- /*-----------------------------------------------------------------------
- * Commit and reopen the compound and enumerate data types
- *-----------------------------------------------------------------------
- */
/* Commit compound datatype and close it */
if(H5Tcommit(file, compnd_type, tid1)<0) {
H5_FAILED();
@@ -2367,13 +2285,6 @@ test_encode(void)
printf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid1)<0) {
- H5_FAILED();
- printf("Can't close datatype\n");
- goto error;
- } /* end if */
- free(cmpd_buf);
- cmpd_buf_size = 0;
/* Commit enumeration datatype and close it */
if(H5Tcommit(file, enum_type, tid2)<0) {
@@ -2386,13 +2297,6 @@ test_encode(void)
printf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid2)<0) {
- H5_FAILED();
- printf("Can't close datatype\n");
- goto error;
- } /* end if */
- free(enum_buf);
- enum_buf_size = 0;
/* Open the dataytpe for query */
if((tid1=H5Topen(file, compnd_type))<0) {
@@ -2406,99 +2310,30 @@ test_encode(void)
goto error;
} /* end if */
-
- /* Encode compound type in a buffer */
- if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode compound type\n");
- goto error;
- } /* end if */
-
- if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
-
- if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode compound type\n");
- goto error;
- } /* end if */
-
- /* Decode from the compound buffer and return an object handle */
- if((decoded_tid1=H5Tdecode(cmpd_buf))<0) {
- H5_FAILED();
- printf("Can't decode compound type\n");
- goto error;
- } /* end if */
-
- /* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid1, tid1)<=0) {
- H5_FAILED();
- printf("Datatype wasn't encoded & decoded identically\n");
- goto error;
- } /* end if */
-
- /* Query member number and member index by name, for compound type. */
- if(H5Tget_nmembers(decoded_tid1)!=4) {
+ /* Query member number and member index by name, for compound type */
+ if(H5Tget_nmembers(tid1)!=4) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid1, "c")!=2) {
+ if(H5Tget_member_index(tid1, "c")!=2) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
- /*-----------------------------------------------------------------------
- * Test encoding and decoding compound and enumerate data types
- *-----------------------------------------------------------------------
- */
- /* Encode enumerate type in a buffer */
- if(H5Tencode(tid2, NULL, &enum_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode enumerate type\n");
- goto error;
- } /* end if */
-
- if(enum_buf_size>0)
- enum_buf = (unsigned char*)calloc(1, enum_buf_size);
-
- if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) {
- H5_FAILED();
- printf("Can't encode enumerate type\n");
- goto error;
- } /* end if */
-
- /* Decode from the enumerate buffer and return an object handle */
- if((decoded_tid2=H5Tdecode(enum_buf))<0) {
- H5_FAILED();
- printf("Can't decode enumerate type\n");
- goto error;
- } /* end if */
-
- /* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid2, tid2)<=0) {
- H5_FAILED();
- printf("Datatype wasn't encoded & decoded identically\n");
- goto error;
- } /* end if */
-
- /* Query member number and member index by name, for enumeration type. */
- if(H5Tget_nmembers(decoded_tid2)!=5) {
+ /* Query member number and member index by name, for enumeration type */
+ if(H5Tget_nmembers(tid2)!=5) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
+ if(H5Tget_member_index(tid2, "ORANGE")!=3) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
- /*-----------------------------------------------------------------------
- * Close and release
- *-----------------------------------------------------------------------
- */
/* Close data type and file */
if(H5Tclose(tid1)<0) {
H5_FAILED();
@@ -2511,26 +2346,12 @@ test_encode(void)
goto error;
} /* end if */
- if(H5Tclose(decoded_tid1)<0) {
- H5_FAILED();
- printf("Can't close datatype\n");
- goto error;
- } /* end if */
- if(H5Tclose(decoded_tid2)<0) {
- H5_FAILED();
- printf("Can't close datatype\n");
- goto error;
- } /* end if */
-
if(H5Fclose(file)<0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
} /* end if */
- free(cmpd_buf);
- free(enum_buf);
-
PASSED();
return 0;
@@ -2538,8 +2359,6 @@ test_encode(void)
H5E_BEGIN_TRY {
H5Tclose (tid1);
H5Tclose (tid2);
- H5Tclose (decoded_tid1);
- H5Tclose (decoded_tid2);
H5Fclose (file);
} H5E_END_TRY;
return 1;
@@ -3868,8 +3687,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); /* not 8*src_size, esp on J90 - QAK */
- dst_sign = H5Tget_sign(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));
@@ -4474,8 +4293,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
}
} else {
if (src_nbits>dst_nbits &&
- H5T_bit_find(src_bits, dst_nbits, src_nbits-dst_nbits,
- H5T_BIT_LSB, 1)>=0) {
+ H5T_bit_find(src_bits, dst_nbits, src_nbits-dst_nbits,
+ H5T_BIT_LSB, 1)>=0) {
/*
* The unsigned source has a value which is too large for
* the unsigned destination. The destination should be
@@ -4714,6 +4533,578 @@ test_conv_int_2(void)
/*-------------------------------------------------------------------------
+ * Function: my_isnan
+ *
+ * Purpose: Determines whether VAL points to NaN.
+ *
+ * Return: TRUE or FALSE
+ *
+ * Programmer: Robb Matzke
+ * Monday, July 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+my_isnan(dtype_t type, void *val)
+{
+ int retval;
+ char s[256];
+
+ if (FLT_FLOAT==type) {
+ float x;
+ HDmemcpy(&x, val, sizeof(float));
+ retval = (x!=x);
+ } else if (FLT_DOUBLE==type) {
+ double x;
+ HDmemcpy(&x, val, sizeof(double));
+ retval = (x!=x);
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else if (FLT_LDOUBLE==type) {
+ long double x;
+ HDmemcpy(&x, val, sizeof(long double));
+ retval = (x!=x);
+#endif
+ } else {
+ return 0;
+ }
+
+ /*
+ * Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if
+ * the result contains a NaN string.
+ */
+ if (!retval) {
+ if (FLT_FLOAT==type) {
+ float x;
+ HDmemcpy(&x, val, sizeof(float));
+ sprintf(s, "%g", x);
+ } else if (FLT_DOUBLE==type) {
+ double x;
+ HDmemcpy(&x, val, sizeof(double));
+ sprintf(s, "%g", x);
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else if (FLT_LDOUBLE==type) {
+ long double x;
+ HDmemcpy(&x, val, sizeof(long double));
+ sprintf(s, "%Lg", x);
+#endif
+ } else {
+ return 0;
+ }
+ if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
+ retval = 1;
+ }
+
+ return retval;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_conv_flt_1
+ *
+ * Purpose: Test conversion of random floating point values from SRC to
+ * DST. These types should be H5T_NATIVE_FLOAT,
+ * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE.
+ *
+ * Return: Success: 0
+ *
+ * Failure: number of errors
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, June 23, 1998
+ *
+ * Modifications:
+ * Albert Cheng, Apr 16, 2004
+ * Check for underflow condition. If the src number is
+ * smaller than the dst MIN float number, consider it okay
+ * if the converted sw and hw dst are both less than or
+ * equal to the dst MIN float number.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
+{
+ dtype_t src_type, dst_type; /*data types */
+ const size_t ntests=NTESTS; /*number of tests */
+ const size_t nelmts=NTESTELEM; /*num values per test */
+ const size_t max_fails=8; /*max number of failures*/
+ size_t fails_all_tests=0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ const char *src_type_name = NULL; /*source type name */
+ const char *dst_type_name = NULL; /*destination type name */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf = NULL; /*buffer for conversion */
+ unsigned char *saved = NULL; /*original values */
+ char str[256]; /*hello string */
+ float hw_f; /*hardware-converted */
+ double hw_d; /*hardware-converted */
+ void *aligned=NULL; /*aligned buffer */
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ long double hw_ld; /*hardware-converted */
+#endif
+ unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
+ int underflow; /*underflow occurred */
+ int uflow=0; /*underflow debug counters*/
+ size_t i, j, k; /*counters */
+ int endian; /*machine endianess */
+ size_t dst_ebias; /* Destination type's exponent bias */
+ size_t src_epos; /* Source type's exponent position */
+ size_t src_esize; /* Source type's exponent size */
+ size_t dst_epos; /* Destination type's exponent position */
+ size_t dst_esize; /* Destination type's exponent size */
+ size_t dst_msize; /* Destination type's mantissa size */
+
+#ifdef HANDLE_SIGFPE
+ pid_t child_pid; /*process ID of child */
+ int status; /*child exit status */
+
+ /*
+ * Some systems generage SIGFPE during floating point overflow and we
+ * cannot assume that we can continue from such a signal. Therefore, we
+ * fork here and let the child run the test and return the number of
+ * failures with the exit status.
+ */
+ HDfflush(stdout);
+ HDfflush(stderr);
+ if ((child_pid=fork())<0) {
+ HDperror("fork");
+ return 1;
+ } else if (child_pid>0) {
+ while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/;
+ if (WIFEXITED(status) && 255==WEXITSTATUS(status)) {
+ return 0; /*child exit after catching SIGFPE*/
+ } else if (WIFEXITED(status)) {
+ return WEXITSTATUS(status);
+ } else {
+ HDputs(" Child didn't exit normally.");
+ return 1;
+ }
+ }
+#endif
+
+ /*
+ * The remainder of this function is executed only by the child if
+ * HANDLE_SIGFPE is defined.
+ */
+#ifndef __WATCOMC__
+ signal(SIGFPE,fpe_handler);
+#endif
+
+ /* What are the names of the source and destination types */
+ if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
+ src_type_name = "float";
+ src_type = FLT_FLOAT;
+ } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
+ src_type_name = "double";
+ src_type = FLT_DOUBLE;
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
+ src_type_name = "long double";
+ src_type = FLT_LDOUBLE;
+#endif
+ } else {
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
+ }
+
+ if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
+ dst_type_name = "float";
+ dst_type = FLT_FLOAT;
+ } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
+ dst_type_name = "double";
+ dst_type = FLT_DOUBLE;
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
+ dst_type_name = "long double";
+ dst_type = FLT_LDOUBLE;
+#endif
+ } else {
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
+ }
+
+ /* Sanity checks */
+ if(sizeof(float)==sizeof(double))
+ HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible.");
+ if (OTHER==src_type || OTHER==dst_type) {
+ sprintf(str, "Testing random %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ printf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
+ }
+
+ /* 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 = HDmalloc(32); /*should be big enough for any type*/
+#ifdef SHOW_OVERFLOWS
+ noverflows_g = 0;
+#endif
+
+ for (i=0; i<ntests; i++) {
+
+ /*
+ * If it looks like it might take a long time then print a progress
+ * report between each test.
+ */
+ if (ntests>1) {
+ sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)",
+ name, src_type_name, dst_type_name, (int)i+1, (int)ntests);
+ } else {
+ sprintf(str, "Testing random %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ }
+ printf("%-70s", str);
+ HDfflush(stdout);
+ fails_this_test = 0;
+
+ /*
+ * Initialize the source buffers to random bits. The `buf' buffer
+ * will be used for the conversion while the `saved' buffer will be
+ * used for the comparison later.
+ */
+ if (!skip_overflow_tests_g) {
+ for (j=0; j<nelmts*src_size; j++)
+ buf[j] = saved[j] = HDrand();
+ } else {
+ for (j=0; j<nelmts; j++) {
+ /* Do it this way for alignment reasons */
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ long double temp[1];
+#else
+ double temp[1];
+#endif
+ if (src_size<=dst_size) {
+ for (k=0; k<dst_size; k++) buf[j*src_size+k] = HDrand();
+ } else {
+ for (k=0; k<dst_size; k++)
+ ((unsigned char*)temp)[k] = HDrand();
+ if (FLT_DOUBLE==src_type && FLT_FLOAT==dst_type) {
+ hw_d = *((float*)temp);
+ HDmemcpy(buf+j*src_size, &hw_d, src_size);
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else if (FLT_LDOUBLE==src_type && FLT_FLOAT==dst_type) {
+ hw_ld = *((float*)temp);
+ HDmemcpy(buf+j*src_size, &hw_ld, src_size);
+ } else if (FLT_LDOUBLE==src_type && FLT_DOUBLE==dst_type) {
+ hw_ld = *((double*)temp);
+ HDmemcpy(buf+j*src_size, &hw_ld, src_size);
+#endif
+ }
+ }
+ HDmemcpy(saved+j*src_size, buf+j*src_size, src_size);
+ }
+ }
+
+ /* Perform the conversion in software */
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
+ goto error;
+
+ /* Check the software results against the hardware */
+ for (j=0; j<nelmts; j++) {
+ underflow = 0;
+ hw_f = 911.0;
+ hw_d = 911.0;
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ hw_ld = 911.0;
+#endif
+
+ /* The hardware conversion */
+ /* Check for underflow when src is a "larger" float than dst.*/
+ if (FLT_FLOAT==src_type) {
+ HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
+ if (FLT_FLOAT==dst_type) {
+ hw_f = *((float*)aligned);
+ hw = (unsigned char*)&hw_f;
+ } else if (FLT_DOUBLE==dst_type) {
+ hw_d = *((float*)aligned);
+ hw = (unsigned char*)&hw_d;
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else {
+ hw_ld = *((float*)aligned);
+ hw = (unsigned char*)&hw_ld;
+#endif
+ }
+ } else if (FLT_DOUBLE==src_type) {
+ HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
+ if (FLT_FLOAT==dst_type) {
+ hw_f = (float)(*((double*)aligned));
+ hw = (unsigned char*)&hw_f;
+ underflow = HDfabs(*((double*)aligned)) < FLT_MIN;
+ } else if (FLT_DOUBLE==dst_type) {
+ hw_d = *((double*)aligned);
+ hw = (unsigned char*)&hw_d;
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else {
+ hw_ld = *((double*)aligned);
+ hw = (unsigned char*)&hw_ld;
+#endif
+ }
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else {
+ HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
+ if (FLT_FLOAT==dst_type) {
+ hw_f = *((long double*)aligned);
+ hw = (unsigned char*)&hw_f;
+ underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN;
+ } else if (FLT_DOUBLE==dst_type) {
+ hw_d = *((long double*)aligned);
+ hw = (unsigned char*)&hw_d;
+ underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN;
+ } else {
+ hw_ld = *((long double*)aligned);
+ hw = (unsigned char*)&hw_ld;
+ }
+#endif
+ }
+ if (underflow){
+ uflow++;
+ }
+
+ /* Are the two results the same? */
+ for (k=0; k<dst_size; k++)
+ if (buf[j*dst_size+k]!=hw[k])
+ break;
+ if (k==dst_size)
+ continue; /*no error*/
+
+ /*
+ * Assume same if both results are NaN. There are many NaN bit
+ * patterns and the software doesn't attemt to emulate the
+ * hardware in this regard. Instead, software uses a single bit
+ * pattern for NaN by setting the significand to all ones.
+ */
+ if (FLT_FLOAT==dst_type &&
+ my_isnan(dst_type, buf+j*sizeof(float)) &&
+ my_isnan(dst_type, hw)) {
+ continue;
+ } else if (FLT_DOUBLE==dst_type &&
+ my_isnan(dst_type, buf+j*sizeof(double)) &&
+ my_isnan(dst_type, hw)) {
+ continue;
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else if (FLT_LDOUBLE==dst_type &&
+ my_isnan(dst_type, buf+j*sizeof(long double)) &&
+ my_isnan(dst_type, hw)) {
+ continue;
+#endif
+ }
+
+ /*
+ * Assume same if hardware result is NaN. This is because the
+ * hardware conversions on some machines return NaN instead of
+ * overflowing to +Inf or -Inf or underflowing to +0 or -0.
+ */
+ if (my_isnan(dst_type, hw))
+ continue;
+
+ /*
+ * Instead of matching down to the bit, just make sure the
+ * exponents are the same and the mantissa is the same to a
+ * certain precision. This is needed on machines that don't
+ * round as expected.
+ * If the src number is smaller than the dst MIN float number,
+ * consider it okay if the converted sw and hw dst are both
+ * less than or equal to the dst MIN float number.
+ */
+ {
+ double check_mant[2];
+ int check_expo[2];
+
+ if (FLT_FLOAT==dst_type) {
+ float x;
+ HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
+ if (underflow &&
+ HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
+ continue; /* all underflowed, no error */
+ check_mant[0] = HDfrexpf(x, check_expo+0);
+ check_mant[1] = HDfrexpf(hw_f, check_expo+1);
+ } else if (FLT_DOUBLE==dst_type) {
+ double x;
+ HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
+ if (underflow &&
+ HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
+ continue; /* all underflowed, no error */
+ check_mant[0] = HDfrexp(x, check_expo+0);
+ check_mant[1] = HDfrexp(hw_d, check_expo+1);
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else {
+ long double x;
+ HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
+ /* dst is largest float, no need to check underflow. */
+ check_mant[0] = HDfrexpl(x, check_expo+0);
+ check_mant[1] = HDfrexpl(hw_ld, check_expo+1);
+#endif
+ }
+#ifdef H5_CONVERT_DENORMAL_FLOAT
+ /* 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;
+ double epsilon=1.0;
+
+ /* Re-scale the mantissas based on any exponent difference */
+ if(expo_diff!=0)
+ check_mant[0] = HDldexp(check_mant[0],expo_diff);
+
+ /* Compute the proper epsilon */
+ epsilon=HDldexp(epsilon,-valid_bits);
+
+ /* Check for "close enough" fit with scaled epsilon value */
+ if (HDfabs(check_mant[0]-check_mant[1])<=epsilon)
+ continue;
+ } /* end if */
+ else {
+ if (check_expo[0]==check_expo[1] &&
+ HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON)
+ continue;
+ } /* end else */
+#else /* H5_CONVERT_DENORMAL_FLOAT */
+ {
+ hssize_t expo; /*exponent */
+ uint8_t tmp[32];
+
+ assert(src_size<=sizeof(tmp));
+ if(endian==H5T_ORDER_LE)
+ HDmemcpy(tmp,&saved[j*src_size],src_size);
+ else
+ for (k=0; k<src_size; k++)
+ tmp[k]=saved[j*src_size+(src_size-(k+1))];
+ expo = H5T_bit_get_d(tmp, src_epos, src_esize);
+ if(expo==0)
+ continue; /* Denormalized floating-point value detected */
+ else {
+ assert(dst_size<=sizeof(tmp));
+ if(endian==H5T_ORDER_LE)
+ HDmemcpy(tmp,&buf[j*dst_size],dst_size);
+ else
+ for (k=0; k<dst_size; k++)
+ tmp[k]=buf[j*dst_size+(dst_size-(k+1))];
+ expo = H5T_bit_get_d(tmp, dst_epos, dst_esize);
+ if(expo==0)
+ continue; /* Denormalized floating-point value detected */
+ else {
+ if (check_expo[0]==check_expo[1] &&
+ HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON)
+ continue;
+ } /* end else */
+ } /* end else */
+ }
+#endif /* H5_CONVERT_DENORMAL_FLOAT */
+ }
+
+ if (0==fails_this_test++)
+ H5_FAILED();
+ printf(" test %u, elmt %u\n", (unsigned)i+1, (unsigned)j);
+
+ printf(" src =");
+ for (k=0; k<src_size; k++)
+ printf(" %02x", saved[j*src_size+ENDIAN(src_size,k)]);
+ printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ if (FLT_FLOAT==src_type) {
+ float x;
+ HDmemcpy(&x, &saved[j*dst_size], sizeof(float));
+ printf(" %29.20e\n", x);
+ } else if (FLT_DOUBLE==src_type) {
+ double x;
+ HDmemcpy(&x, &saved[j*dst_size], sizeof(double));
+ printf(" %29.20e\n", x);
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else {
+ long double x;
+ HDmemcpy(&x, &saved[j*src_size], sizeof(long double));
+ HDfprintf(stdout," %29.20Le\n", x);
+#endif
+ }
+
+ printf(" dst =");
+ for (k=0; k<dst_size; k++)
+ printf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k)]);
+ printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ if (FLT_FLOAT==dst_type) {
+ float x;
+ HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
+ printf(" %29.20e\n", x);
+ } else if (FLT_DOUBLE==dst_type) {
+ double x;
+ HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
+ printf(" %29.20e\n", x);
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ } else {
+ long double x;
+ HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
+ HDfprintf(stdout," %29.20Le\n", x);
+#endif
+ }
+
+ printf(" ans =");
+ for (k=0; k<dst_size; k++)
+ printf(" %02x", hw[ENDIAN(dst_size,k)]);
+ printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ if (FLT_FLOAT==dst_type)
+ printf(" %29.20e\n", hw_f);
+ else if (FLT_DOUBLE==dst_type)
+ printf(" %29.20e\n", hw_d);
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ else
+ HDfprintf(stdout," %29.20Le\n", hw_ld);
+#endif
+
+ if (++fails_all_tests>=max_fails) {
+ HDputs(" maximum failures reached, aborting test...");
+ goto done;
+ }
+ }
+ PASSED();
+ }
+#ifdef SHOW_OVERFLOWS
+ if (noverflows_g>0)
+ printf(" %d overflow%s in previous test\n",
+ noverflows_g, 1==noverflows_g?"":"s");
+#endif
+
+ done:
+#ifdef AKCDEBUG
+ printf("uflow=%d, fails_all_tests=%d\n", uflow, fails_all_tests);
+#endif
+ if (buf) aligned_free(buf);
+ if (saved) aligned_free(saved);
+ if (aligned) HDfree(aligned);
+ HDfflush(stdout);
+#ifdef HANDLE_SIGFPE
+ HDexit(MIN((int)fails_all_tests, 254));
+#else
+ reset_hdf5();
+ return (int)fails_all_tests;
+#endif
+
+ error:
+ if (buf) aligned_free(buf);
+ if (saved) aligned_free(saved);
+ if (aligned) HDfree(aligned);
+ HDfflush(stdout);
+#ifdef HANDLE_SIGFPE
+ HDexit(MIN(MAX((int)fails_all_tests, 1), 254));
+#else
+ reset_hdf5();
+ return MAX((int)fails_all_tests, 1);
+#endif
+}
+
+
+/*-------------------------------------------------------------------------
* Function: test_conv_int_float
*
* Purpose: Test conversion between random integer and float values
@@ -5723,578 +6114,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: my_isnan
- *
- * Purpose: Determines whether VAL points to NaN.
- *
- * Return: TRUE or FALSE
- *
- * Programmer: Robb Matzke
- * Monday, July 6, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-my_isnan(dtype_t type, void *val)
-{
- int retval;
- char s[256];
-
- if (FLT_FLOAT==type) {
- float x;
- HDmemcpy(&x, val, sizeof(float));
- retval = (x!=x);
- } else if (FLT_DOUBLE==type) {
- double x;
- HDmemcpy(&x, val, sizeof(double));
- retval = (x!=x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else if (FLT_LDOUBLE==type) {
- long double x;
- HDmemcpy(&x, val, sizeof(long double));
- retval = (x!=x);
-#endif
- } else {
- return 0;
- }
-
- /*
- * Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if
- * the result contains a NaN string.
- */
- if (!retval) {
- if (FLT_FLOAT==type) {
- float x;
- HDmemcpy(&x, val, sizeof(float));
- sprintf(s, "%g", x);
- } else if (FLT_DOUBLE==type) {
- double x;
- HDmemcpy(&x, val, sizeof(double));
- sprintf(s, "%g", x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else if (FLT_LDOUBLE==type) {
- long double x;
- HDmemcpy(&x, val, sizeof(long double));
- sprintf(s, "%Lg", x);
-#endif
- } else {
- return 0;
- }
- if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
- retval = 1;
- }
-
- return retval;
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: test_conv_flt_1
- *
- * Purpose: Test conversion of random floating point values from SRC to
- * DST. These types should be H5T_NATIVE_FLOAT,
- * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE.
- *
- * Return: Success: 0
- *
- * Failure: number of errors
- *
- * Programmer: Robb Matzke
- * Tuesday, June 23, 1998
- *
- * Modifications:
- * Albert Cheng, Apr 16, 2004
- * Check for underflow condition. If the src number is
- * smaller than the dst MIN float number, consider it okay
- * if the converted sw and hw dst are both less than or
- * equal to the dst MIN float number.
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
-{
- dtype_t src_type, dst_type; /*data types */
- const size_t ntests=NTESTS; /*number of tests */
- const size_t nelmts=NTESTELEM; /*num values per test */
- const size_t max_fails=8; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- const char *src_type_name = NULL; /*source type name */
- const char *dst_type_name = NULL; /*destination type name */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf = NULL; /*buffer for conversion */
- unsigned char *saved = NULL; /*original values */
- char str[256]; /*hello string */
- float hw_f; /*hardware-converted */
- double hw_d; /*hardware-converted */
- void *aligned=NULL; /*aligned buffer */
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- long double hw_ld; /*hardware-converted */
-#endif
- unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
- int underflow; /*underflow occurred */
- int uflow=0; /*underflow debug counters*/
- size_t i, j, k; /*counters */
- int endian; /*machine endianess */
- size_t dst_ebias; /* Destination type's exponent bias */
- size_t src_epos; /* Source type's exponent position */
- size_t src_esize; /* Source type's exponent size */
- size_t dst_epos; /* Destination type's exponent position */
- size_t dst_esize; /* Destination type's exponent size */
- size_t dst_msize; /* Destination type's mantissa size */
-
-#ifdef HANDLE_SIGFPE
- pid_t child_pid; /*process ID of child */
- int status; /*child exit status */
-
- /*
- * Some systems generage SIGFPE during floating point overflow and we
- * cannot assume that we can continue from such a signal. Therefore, we
- * fork here and let the child run the test and return the number of
- * failures with the exit status.
- */
- HDfflush(stdout);
- HDfflush(stderr);
- if ((child_pid=fork())<0) {
- HDperror("fork");
- return 1;
- } else if (child_pid>0) {
- while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/;
- if (WIFEXITED(status) && 255==WEXITSTATUS(status)) {
- return 0; /*child exit after catching SIGFPE*/
- } else if (WIFEXITED(status)) {
- return WEXITSTATUS(status);
- } else {
- HDputs(" Child didn't exit normally.");
- return 1;
- }
- }
-#endif
-
- /*
- * The remainder of this function is executed only by the child if
- * HANDLE_SIGFPE is defined.
- */
-#ifndef __WATCOMC__
- signal(SIGFPE,fpe_handler);
-#endif
-
- /* What are the names of the source and destination types */
- if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
- src_type_name = "float";
- src_type = FLT_FLOAT;
- } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
- src_type_name = "double";
- src_type = FLT_DOUBLE;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
- src_type_name = "long double";
- src_type = FLT_LDOUBLE;
-#endif
- } else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
- }
-
- if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
- dst_type_name = "float";
- dst_type = FLT_FLOAT;
- } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
- dst_type_name = "double";
- dst_type = FLT_DOUBLE;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
- dst_type_name = "long double";
- dst_type = FLT_LDOUBLE;
-#endif
- } else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
- }
-
- /* Sanity checks */
- if(sizeof(float)==sizeof(double))
- HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible.");
- if (OTHER==src_type || OTHER==dst_type) {
- sprintf(str, "Testing random %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
- }
-
- /* 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 = HDmalloc(32); /*should be big enough for any type*/
-#ifdef SHOW_OVERFLOWS
- noverflows_g = 0;
-#endif
-
- for (i=0; i<ntests; i++) {
-
- /*
- * If it looks like it might take a long time then print a progress
- * report between each test.
- */
- if (ntests>1) {
- sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)",
- name, src_type_name, dst_type_name, (int)i+1, (int)ntests);
- } else {
- sprintf(str, "Testing random %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- }
- printf("%-70s", str);
- HDfflush(stdout);
- fails_this_test = 0;
-
- /*
- * Initialize the source buffers to random bits. The `buf' buffer
- * will be used for the conversion while the `saved' buffer will be
- * used for the comparison later.
- */
- if (!skip_overflow_tests_g) {
- for (j=0; j<nelmts*src_size; j++)
- buf[j] = saved[j] = HDrand();
- } else {
- for (j=0; j<nelmts; j++) {
- /* Do it this way for alignment reasons */
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- long double temp[1];
-#else
- double temp[1];
-#endif
- if (src_size<=dst_size) {
- for (k=0; k<dst_size; k++) buf[j*src_size+k] = HDrand();
- } else {
- for (k=0; k<dst_size; k++)
- ((unsigned char*)temp)[k] = HDrand();
- if (FLT_DOUBLE==src_type && FLT_FLOAT==dst_type) {
- hw_d = *((float*)temp);
- HDmemcpy(buf+j*src_size, &hw_d, src_size);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else if (FLT_LDOUBLE==src_type && FLT_FLOAT==dst_type) {
- hw_ld = *((float*)temp);
- HDmemcpy(buf+j*src_size, &hw_ld, src_size);
- } else if (FLT_LDOUBLE==src_type && FLT_DOUBLE==dst_type) {
- hw_ld = *((double*)temp);
- HDmemcpy(buf+j*src_size, &hw_ld, src_size);
-#endif
- }
- }
- HDmemcpy(saved+j*src_size, buf+j*src_size, src_size);
- }
- }
-
- /* Perform the conversion in software */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
- goto error;
-
- /* Check the software results against the hardware */
- for (j=0; j<nelmts; j++) {
- underflow = 0;
- hw_f = 911.0;
- hw_d = 911.0;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- hw_ld = 911.0;
-#endif
-
- /* The hardware conversion */
- /* Check for underflow when src is a "larger" float than dst.*/
- if (FLT_FLOAT==src_type) {
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- if (FLT_FLOAT==dst_type) {
- hw_f = *((float*)aligned);
- hw = (unsigned char*)&hw_f;
- } else if (FLT_DOUBLE==dst_type) {
- hw_d = *((float*)aligned);
- hw = (unsigned char*)&hw_d;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- hw_ld = *((float*)aligned);
- hw = (unsigned char*)&hw_ld;
-#endif
- }
- } else if (FLT_DOUBLE==src_type) {
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- if (FLT_FLOAT==dst_type) {
- hw_f = (float)(*((double*)aligned));
- hw = (unsigned char*)&hw_f;
- underflow = HDfabs(*((double*)aligned)) < FLT_MIN;
- } else if (FLT_DOUBLE==dst_type) {
- hw_d = *((double*)aligned);
- hw = (unsigned char*)&hw_d;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- hw_ld = *((double*)aligned);
- hw = (unsigned char*)&hw_ld;
-#endif
- }
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- if (FLT_FLOAT==dst_type) {
- hw_f = *((long double*)aligned);
- hw = (unsigned char*)&hw_f;
- underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN;
- } else if (FLT_DOUBLE==dst_type) {
- hw_d = *((long double*)aligned);
- hw = (unsigned char*)&hw_d;
- underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN;
- } else {
- hw_ld = *((long double*)aligned);
- hw = (unsigned char*)&hw_ld;
- }
-#endif
- }
- if (underflow){
- uflow++;
- }
-
- /* Are the two results the same? */
- for (k=0; k<dst_size; k++)
- if (buf[j*dst_size+k]!=hw[k])
- break;
- if (k==dst_size)
- continue; /*no error*/
-
- /*
- * Assume same if both results are NaN. There are many NaN bit
- * patterns and the software doesn't attemt to emulate the
- * hardware in this regard. Instead, software uses a single bit
- * pattern for NaN by setting the significand to all ones.
- */
- if (FLT_FLOAT==dst_type &&
- my_isnan(dst_type, buf+j*sizeof(float)) &&
- my_isnan(dst_type, hw)) {
- continue;
- } else if (FLT_DOUBLE==dst_type &&
- my_isnan(dst_type, buf+j*sizeof(double)) &&
- my_isnan(dst_type, hw)) {
- continue;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else if (FLT_LDOUBLE==dst_type &&
- my_isnan(dst_type, buf+j*sizeof(long double)) &&
- my_isnan(dst_type, hw)) {
- continue;
-#endif
- }
-
- /*
- * Assume same if hardware result is NaN. This is because the
- * hardware conversions on some machines return NaN instead of
- * overflowing to +Inf or -Inf or underflowing to +0 or -0.
- */
- if (my_isnan(dst_type, hw))
- continue;
-
- /*
- * Instead of matching down to the bit, just make sure the
- * exponents are the same and the mantissa is the same to a
- * certain precision. This is needed on machines that don't
- * round as expected.
- * If the src number is smaller than the dst MIN float number,
- * consider it okay if the converted sw and hw dst are both
- * less than or equal to the dst MIN float number.
- */
- {
- double check_mant[2];
- int check_expo[2];
-
- if (FLT_FLOAT==dst_type) {
- float x;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
- if (underflow &&
- HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
- continue; /* all underflowed, no error */
- check_mant[0] = HDfrexpf(x, check_expo+0);
- check_mant[1] = HDfrexpf(hw_f, check_expo+1);
- } else if (FLT_DOUBLE==dst_type) {
- double x;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
- if (underflow &&
- HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
- continue; /* all underflowed, no error */
- check_mant[0] = HDfrexp(x, check_expo+0);
- check_mant[1] = HDfrexp(hw_d, check_expo+1);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- long double x;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
- /* dst is largest float, no need to check underflow. */
- check_mant[0] = HDfrexpl(x, check_expo+0);
- check_mant[1] = HDfrexpl(hw_ld, check_expo+1);
-#endif
- }
-#ifdef H5_CONVERT_DENORMAL_FLOAT
- /* 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;
- double epsilon=1.0;
-
- /* Re-scale the mantissas based on any exponent difference */
- if(expo_diff!=0)
- check_mant[0] = HDldexp(check_mant[0],expo_diff);
-
- /* Compute the proper epsilon */
- epsilon=HDldexp(epsilon,-valid_bits);
-
- /* Check for "close enough" fit with scaled epsilon value */
- if (HDfabs(check_mant[0]-check_mant[1])<=epsilon)
- continue;
- } /* end if */
- else {
- if (check_expo[0]==check_expo[1] &&
- HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON)
- continue;
- } /* end else */
-#else /* H5_CONVERT_DENORMAL_FLOAT */
- {
- hssize_t expo; /*exponent */
- uint8_t tmp[32];
-
- assert(src_size<=sizeof(tmp));
- if(endian==H5T_ORDER_LE)
- HDmemcpy(tmp,&saved[j*src_size],src_size);
- else
- for (k=0; k<src_size; k++)
- tmp[k]=saved[j*src_size+(src_size-(k+1))];
- expo = H5T_bit_get_d(tmp, src_epos, src_esize);
- if(expo==0)
- continue; /* Denormalized floating-point value detected */
- else {
- assert(dst_size<=sizeof(tmp));
- if(endian==H5T_ORDER_LE)
- HDmemcpy(tmp,&buf[j*dst_size],dst_size);
- else
- for (k=0; k<dst_size; k++)
- tmp[k]=buf[j*dst_size+(dst_size-(k+1))];
- expo = H5T_bit_get_d(tmp, dst_epos, dst_esize);
- if(expo==0)
- continue; /* Denormalized floating-point value detected */
- else {
- if (check_expo[0]==check_expo[1] &&
- HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON)
- continue;
- } /* end else */
- } /* end else */
- }
-#endif /* H5_CONVERT_DENORMAL_FLOAT */
- }
-
- if (0==fails_this_test++)
- H5_FAILED();
- printf(" test %u, elmt %u\n", (unsigned)i+1, (unsigned)j);
-
- printf(" src =");
- for (k=0; k<src_size; k++)
- printf(" %02x", saved[j*src_size+ENDIAN(src_size,k)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
- if (FLT_FLOAT==src_type) {
- float x;
- HDmemcpy(&x, &saved[j*dst_size], sizeof(float));
- printf(" %29.20e\n", x);
- } else if (FLT_DOUBLE==src_type) {
- double x;
- HDmemcpy(&x, &saved[j*dst_size], sizeof(double));
- printf(" %29.20e\n", x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- long double x;
- HDmemcpy(&x, &saved[j*src_size], sizeof(long double));
- HDfprintf(stdout," %29.20Le\n", x);
-#endif
- }
-
- printf(" dst =");
- for (k=0; k<dst_size; k++)
- printf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
- if (FLT_FLOAT==dst_type) {
- float x;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
- printf(" %29.20e\n", x);
- } else if (FLT_DOUBLE==dst_type) {
- double x;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
- printf(" %29.20e\n", x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- long double x;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
- HDfprintf(stdout," %29.20Le\n", x);
-#endif
- }
-
- printf(" ans =");
- for (k=0; k<dst_size; k++)
- printf(" %02x", hw[ENDIAN(dst_size,k)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
- if (FLT_FLOAT==dst_type)
- printf(" %29.20e\n", hw_f);
- else if (FLT_DOUBLE==dst_type)
- printf(" %29.20e\n", hw_d);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- else
- HDfprintf(stdout," %29.20Le\n", hw_ld);
-#endif
-
- if (++fails_all_tests>=max_fails) {
- HDputs(" maximum failures reached, aborting test...");
- goto done;
- }
- }
- PASSED();
- }
-#ifdef SHOW_OVERFLOWS
- if (noverflows_g>0)
- printf(" %d overflow%s in previous test\n",
- noverflows_g, 1==noverflows_g?"":"s");
-#endif
-
- done:
-#ifdef AKCDEBUG
- printf("uflow=%d, fails_all_tests=%d\n", uflow, fails_all_tests);
-#endif
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
- HDfflush(stdout);
-#ifdef HANDLE_SIGFPE
- HDexit(MIN((int)fails_all_tests, 254));
-#else
- reset_hdf5();
- return (int)fails_all_tests;
-#endif
-
- error:
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
- HDfflush(stdout);
-#ifdef HANDLE_SIGFPE
- HDexit(MIN(MAX((int)fails_all_tests, 1), 254));
-#else
- reset_hdf5();
- return MAX((int)fails_all_tests, 1);
-#endif
-}
-
-
-/*-------------------------------------------------------------------------
* Function: run_integer_tests
*
* Purpose: Runs all integer tests.
@@ -6607,6 +6426,404 @@ run_float_int_conv(const char *name)
/*-------------------------------------------------------------------------
+ * Function: test_encode
+ *
+ * Purpose: Tests functions of encoding and decoding data type.
+ *
+ * Return: Success: 0
+ *
+ * Failure: number of errors
+ *
+ * Programmer: Raymond Lu
+ * July 14, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_encode(void)
+{
+ struct s1 {
+ int a;
+ float b;
+ long c;
+ double d;
+ };
+ hid_t file=-1, tid1=-1, tid2=-1;
+ hid_t decoded_tid1=-1, decoded_tid2=-1;
+ char filename[1024];
+ char compnd_type[]="Compound_type", enum_type[]="Enum_type";
+ short enum_val;
+ size_t cmpd_buf_size = 0;
+ size_t enum_buf_size = 0;
+ unsigned char *cmpd_buf=NULL, *enum_buf=NULL;
+ herr_t ret;
+
+ TESTING("functions of encoding and decoding data types");
+
+ /* Create File */
+ h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename);
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
+ goto error;
+
+ /*-----------------------------------------------------------------------
+ * Create compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
+ /* Create a compound datatype */
+ if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) {
+ H5_FAILED();
+ printf("Can't create datatype!\n");
+ goto error;
+ } /* end if */
+ if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT)<0) {
+ H5_FAILED();
+ printf("Can't insert field 'a'\n");
+ goto error;
+ } /* end if */
+ if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT)<0) {
+ H5_FAILED();
+ printf("Can't insert field 'b'\n");
+ goto error;
+ } /* end if */
+ if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG)<0) {
+ H5_FAILED();
+ printf("Can't insert field 'c'\n");
+ goto error;
+ } /* end if */
+ if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE)<0) {
+ H5_FAILED();
+ printf("Can't insert field 'd'\n");
+ goto error;
+ } /* end if */
+
+ /* Create a enumerate datatype */
+ if((tid2=H5Tcreate(H5T_ENUM, sizeof(short)))<0) {
+ H5_FAILED();
+ printf("Can't create enumerate type\n");
+ goto error;
+ } /* end if */
+ if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val))<0) {
+ H5_FAILED();
+ printf("Can't insert field into enumeration type\n");
+ goto error;
+ } /* end if */
+ if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val))<0) {
+ H5_FAILED();
+ printf("Can't insert field into enumeration type\n");
+ goto error;
+ } /* end if */
+ if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val))<0) {
+ H5_FAILED();
+ printf("Can't insert field into enumeration type\n");
+ goto error;
+ } /* end if */
+ if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val))<0) {
+ H5_FAILED();
+ printf("Can't insert field into enumeration type\n");
+ goto error;
+ } /* end if */
+ if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val))<0) {
+ H5_FAILED();
+ printf("Can't insert field into enumeration type\n");
+ goto error;
+ } /* end if */
+
+ /*-----------------------------------------------------------------------
+ * Test encoding and decoding compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
+ /* Encode compound type in a buffer */
+ if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ if(cmpd_buf_size>0)
+ cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+
+ /* Try decoding bogus buffer */
+ H5E_BEGIN_TRY {
+ ret = H5Tdecode(cmpd_buf);
+ } H5E_END_TRY;
+ if(ret!=FAIL) {
+ H5_FAILED();
+ printf("Decoded bogus buffer!\n");
+ goto error;
+ }
+
+ if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the compound buffer and return an object handle */
+ if((decoded_tid1=H5Tdecode(cmpd_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode compound type\n");
+ goto error;
+ } /* end if */
+
+ /* Verify that the datatype was copied exactly */
+ if(H5Tequal(decoded_tid1, tid1)<=0) {
+ H5_FAILED();
+ printf("Datatype wasn't encoded & decoded identically\n");
+ goto error;
+ } /* end if */
+
+ /* Query member number and member index by name, for compound type. */
+ if(H5Tget_nmembers(decoded_tid1)!=4) {
+ H5_FAILED();
+ printf("Can't get member number\n");
+ goto error;
+ } /* end if */
+ if(H5Tget_member_index(decoded_tid1, "c")!=2) {
+ H5_FAILED();
+ printf("Can't get correct index number\n");
+ goto error;
+ } /* end if */
+
+
+ /* Encode enumerate type in a buffer */
+ if(H5Tencode(tid2, NULL, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ if(enum_buf_size>0)
+ enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+
+ if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the enumerate buffer and return an object handle */
+ if((decoded_tid2=H5Tdecode(enum_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ /* Verify that the datatype was copied exactly */
+ if(H5Tequal(decoded_tid2, tid2)<=0) {
+ H5_FAILED();
+ printf("Datatype wasn't encoded & decoded identically\n");
+ goto error;
+ } /* end if */
+
+ /* Query member number and member index by name, for enumeration type. */
+ if(H5Tget_nmembers(decoded_tid2)!=5) {
+ H5_FAILED();
+ printf("Can't get member number\n");
+ goto error;
+ } /* end if */
+ if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
+ H5_FAILED();
+ printf("Can't get correct index number\n");
+ goto error;
+ } /* end if */
+
+ /*-----------------------------------------------------------------------
+ * Commit and reopen the compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
+ /* Commit compound datatype and close it */
+ if(H5Tcommit(file, compnd_type, tid1)<0) {
+ H5_FAILED();
+ printf("Can't commit compound datatype\n");
+ goto error;
+ } /* end if */
+ if(H5Tclose(tid1)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ if(H5Tclose(decoded_tid1)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ free(cmpd_buf);
+ cmpd_buf_size = 0;
+
+ /* Commit enumeration datatype and close it */
+ if(H5Tcommit(file, enum_type, tid2)<0) {
+ H5_FAILED();
+ printf("Can't commit compound datatype\n");
+ goto error;
+ } /* end if */
+ if(H5Tclose(tid2)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ if(H5Tclose(decoded_tid2)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ free(enum_buf);
+ enum_buf_size = 0;
+
+ /* Open the dataytpe for query */
+ if((tid1=H5Topen(file, compnd_type))<0) {
+ H5_FAILED();
+ printf("Can't open datatype\n");
+ goto error;
+ } /* end if */
+ if((tid2=H5Topen(file, enum_type))<0) {
+ H5_FAILED();
+ printf("Can't open datatype\n");
+ goto error;
+ } /* end if */
+
+
+ /* Encode compound type in a buffer */
+ if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ if(cmpd_buf_size>0)
+ cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+
+ if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the compound buffer and return an object handle */
+ if((decoded_tid1=H5Tdecode(cmpd_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode compound type\n");
+ goto error;
+ } /* end if */
+
+ /* Verify that the datatype was copied exactly */
+ if(H5Tequal(decoded_tid1, tid1)<=0) {
+ H5_FAILED();
+ printf("Datatype wasn't encoded & decoded identically\n");
+ goto error;
+ } /* end if */
+
+ /* Query member number and member index by name, for compound type. */
+ if(H5Tget_nmembers(decoded_tid1)!=4) {
+ H5_FAILED();
+ printf("Can't get member number\n");
+ goto error;
+ } /* end if */
+ if(H5Tget_member_index(decoded_tid1, "c")!=2) {
+ H5_FAILED();
+ printf("Can't get correct index number\n");
+ goto error;
+ } /* end if */
+
+ /*-----------------------------------------------------------------------
+ * Test encoding and decoding compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
+ /* Encode enumerate type in a buffer */
+ if(H5Tencode(tid2, NULL, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ if(enum_buf_size>0)
+ enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+
+ if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the enumerate buffer and return an object handle */
+ if((decoded_tid2=H5Tdecode(enum_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ /* Verify that the datatype was copied exactly */
+ if(H5Tequal(decoded_tid2, tid2)<=0) {
+ H5_FAILED();
+ printf("Datatype wasn't encoded & decoded identically\n");
+ goto error;
+ } /* end if */
+
+ /* Query member number and member index by name, for enumeration type. */
+ if(H5Tget_nmembers(decoded_tid2)!=5) {
+ H5_FAILED();
+ printf("Can't get member number\n");
+ goto error;
+ } /* end if */
+ if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
+ H5_FAILED();
+ printf("Can't get correct index number\n");
+ goto error;
+ } /* end if */
+
+ /*-----------------------------------------------------------------------
+ * Close and release
+ *-----------------------------------------------------------------------
+ */
+ /* Close data type and file */
+ if(H5Tclose(tid1)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ if(H5Tclose(tid2)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+
+ if(H5Tclose(decoded_tid1)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ if(H5Tclose(decoded_tid2)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+
+ if(H5Fclose(file)<0) {
+ H5_FAILED();
+ printf("Can't close file\n");
+ goto error;
+ } /* end if */
+
+ free(cmpd_buf);
+ free(enum_buf);
+
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Tclose (tid1);
+ H5Tclose (tid2);
+ H5Tclose (decoded_tid1);
+ H5Tclose (decoded_tid2);
+ H5Fclose (file);
+ } H5E_END_TRY;
+ return 1;
+}
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Test the data type interface.
@@ -6642,6 +6859,7 @@ main(void)
nerrors += test_copy();
nerrors += test_detect();
nerrors += test_compound_1();
+ nerrors += test_query();
nerrors += test_transient (fapl);
nerrors += test_named (fapl);
nerrors += test_encode();
@@ -6670,7 +6888,6 @@ main(void)
/* Does floating point overflow generate a SIGFPE? */
generates_sigfpe();
-
/* Test degenerate cases */
nerrors += test_conv_flt_1("noop", H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT);
nerrors += test_conv_flt_1("noop", H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE);
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 a9c8155..1db5e14 100644
--- a/test/file_handle.c
+++ b/test/file_handle.c
@@ -226,7 +226,6 @@ test_family(void)
int buf[FAMILY_NUMBER][FAMILY_SIZE];
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
hsize_t file_size;
- herr_t ret;
TESTING("FAMILY file driver");
@@ -239,7 +238,7 @@ test_family(void)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
- if((ret=H5Fclose(file))<0)
+ if(H5Fclose(file)<0)
goto error;
/* Tries to reopen the file with member file size smaller than
diff --git a/test/filename.c b/test/filename.c
index 5439d14..b11e6c7 100644
--- a/test/filename.c
+++ b/test/filename.c
@@ -19,8 +19,6 @@
* Purpose: Tests the "H5Fget_name" functionality
*/
-#include "hdf5.h"
-#include "h5test.h"
#include "testhdf5.h"
#define FILENAME "get_file_name"
@@ -51,7 +49,6 @@ typedef struct s1_t {
"in %s\n", where, val, x, (int)__LINE__, __FILE__); \
H5Eprint_stack(H5E_DEFAULT, stdout); \
} \
- HDstrcmp(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/gen_nullspace.c b/test/gen_nullspace.c
new file mode 100644
index 0000000..5892443
--- /dev/null
+++ b/test/gen_nullspace.c
@@ -0,0 +1,87 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Saturday, April 17, 2004
+ *
+ * Purpose: Create a dataset with a null dataspace and an attribute
+ * with a null dataspace.
+ * This program is used to create the test file `tnullspace.h5' which
+ * has dataspaces stored in the newer (version 2) style in the object headers.
+ * To build the test file, this program MUST be compiled and linked with
+ * the hdf5-1.7+ series of libraries and the generated test file must be
+ * put into the 'test' directory in the 1.6.x branch of the library.
+ */
+
+#include "hdf5.h"
+#include <assert.h>
+
+#define NULLFILE "tnullspace.h5"
+#define NULLDATASET "null_dataset"
+#define NULLATTR "null_attribute"
+
+int
+main(void)
+{
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
+ hid_t attr; /* Attribute ID */
+ herr_t ret; /* Generic return value */
+
+ /* Create the file */
+ fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ assert(fid>0);
+
+ sid = H5Screate(H5S_NULL);
+ assert(sid>0);
+
+ /* Create dataset */
+ did = H5Dcreate(fid, NULLDATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
+ assert(did>0);
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ assert(ret>=0);
+
+ /* Open the root group */
+ gid = H5Gopen(fid,"/");
+ assert(gid>0);
+
+ /* Create an attribute for the group */
+ attr=H5Acreate(gid,NULLATTR,H5T_NATIVE_INT,sid,H5P_DEFAULT);
+ assert(attr>0);
+
+ /* Close attribute */
+ ret=H5Aclose(attr);
+ assert(ret>=0);
+
+ /* Close the group */
+ ret = H5Gclose(gid);
+ assert(ret>=0);
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ assert(ret>=0);
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ assert(ret>=0);
+
+ return 0;
+}
+
+
diff --git a/test/getname.c b/test/getname.c
index 29816f0..33b9141 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -1197,7 +1197,6 @@ int main( void )
/* Get datatype*/
if((type_id=H5Dget_type(dataset_id))<0) goto out;
-
/* Get name */
if (H5Iget_name( type_id, name, size )< 0) goto out;
@@ -1212,7 +1211,7 @@ int main( void )
PASSED();
- /*-------------------------------------------------------------------------
+/*-------------------------------------------------------------------------
* Test H5Iget_name with objects that have two names
*-------------------------------------------------------------------------
*/
@@ -1238,7 +1237,6 @@ if(H5Dclose(dataset2_id)<0) goto out;
PASSED();
-
/*-------------------------------------------------------------------------
* Test H5Iget_name with different files, test1
*-------------------------------------------------------------------------
@@ -1390,7 +1388,6 @@ PASSED();
if ( name3 )
free(name3);
-
/* Close */
H5Gclose( group_id );
@@ -1398,8 +1395,6 @@ PASSED();
PASSED();
-
-
/*-------------------------------------------------------------------------
* Test H5Iget_name with invalid IDs
*-------------------------------------------------------------------------
@@ -1464,7 +1459,7 @@ PASSED();
if (H5Iget_name( group2_id, name, size )<0) goto out;
if (check_name( name, "/g18/g2" )!=0) goto out;
- /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */
+ /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */
if (H5Iget_name( dataset_id, name, size )<0) goto out;
if (check_name( name, "/g18/d2" )!=0) goto out;
@@ -1531,9 +1526,8 @@ PASSED();
H5Gclose( group5_id );
H5Gclose( group6_id );
H5Fclose( file1_id );
-
- PASSED();
+PASSED();
/*-------------------------------------------------------------------------
diff --git a/test/h5test.c b/test/h5test.c
index 5344fe2..c9948c6 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -514,13 +514,13 @@ h5_fileaccess(void)
if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
return -1;
} else if (!HDstrcmp(name, "log")) {
- long log_flags = H5FD_LOG_LOC_IO;
+ 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;
} else {
/* Unknown driver */
diff --git a/test/hyperslab.c b/test/hyperslab.c
index f28da01..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];
@@ -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 2cb07e3..83b7c5b 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -2020,7 +2020,7 @@ test_refer_dtype2(hid_t file)
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 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 */
@@ -2286,7 +2286,7 @@ test_bitfield_dtype(hid_t file)
hid_t type=-1, space=-1, dset=-1;
hid_t dataset, dtype, native_type;
size_t i;
- unsigned char wbuf[32], rbuf[32];
+ unsigned char wbuf[32];
hsize_t nelmts;
TESTING("bitfield datatype");
@@ -2330,7 +2330,10 @@ test_bitfield_dtype(hid_t file)
error:
return -1;
-} /* test_opaque_dtype */
+} /* test_bitfield_dtype */
+
+
+
/*-------------------------------------------------------------------------
@@ -2352,21 +2355,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];
@@ -2435,7 +2435,7 @@ test_ninteger(void)
goto error;
/* get size */
- if ((nsize=H5Tget_size(nid1))==0)
+ if (H5Tget_size(nid1)==0)
goto error;
/* get rank */
@@ -2478,7 +2478,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;
}
diff --git a/test/ohdr.c b/test/ohdr.c
index 1036836..cd59a35 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -239,11 +239,7 @@ main(void)
}
if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) {
H5_FAILED();
-#ifdef H5_WANT_H5_V1_6_COMPAT
- H5Eprint(stdout);
-#else
H5Eprint_stack(H5E_DEFAULT, stdout);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
goto error;
}
}
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/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 ba44838..871ff9c 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -1959,7 +1959,7 @@ 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)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
@@ -2004,7 +2004,7 @@ 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)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
diff --git a/test/tfile.c b/test/tfile.c
index e2ad1f2..11824b9 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
@@ -87,11 +85,7 @@ test_file_create(void)
hsize_t ublock; /*sizeof userblock */
size_t parm; /*file-creation parameters */
size_t parm2; /*file-creation parameters */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- int iparm;
-#else /* H5_WANT_H5_V1_6_COMPAT */
unsigned iparm;
-#endif /* H5_WANT_H5_V1_6_COMPAT */
unsigned iparm2;
herr_t ret; /*generic return value */
@@ -326,11 +320,7 @@ test_file_open(void)
hsize_t ublock; /*sizeof user block */
size_t parm; /*file-creation parameters */
size_t parm2; /*file-creation parameters */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- int iparm;
-#else /* H5_WANT_H5_V1_6_COMPAT */
unsigned iparm;
-#endif /* H5_WANT_H5_V1_6_COMPAT */
unsigned iparm2;
herr_t ret; /*generic return value */
@@ -1264,4 +1254,5 @@ cleanup_file(void)
remove(FILE1);
remove(FILE2);
remove(FILE3);
+ remove(FILE4);
}
diff --git a/test/th5s.c b/test/th5s.c
index 5038aeb..763fc81 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -260,7 +260,7 @@ test_h5s_basic(void)
H5E_BEGIN_TRY {
ret = H5Dfill(NULL, H5T_NATIVE_INT, &n, H5T_NATIVE_INT, sid1);
} H5E_END_TRY
- VERIFY(ret, FAIL, "H5Dfill");
+ VERIFY(ret, FAIL, "H5Dfill");
/* Now use the bad dataspace as the space for an attribute */
H5E_BEGIN_TRY {
@@ -351,7 +351,7 @@ test_h5s_null(void)
/* Check to be sure we can't set a hyperslab selection on a null dataspace */
H5E_BEGIN_TRY {
- hssize_t start[1]={0};
+ hsize_t start[1]={0};
hsize_t count[1]={0};
ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL);
@@ -360,10 +360,10 @@ test_h5s_null(void)
/* Check to be sure we can't set a point selection on a null dataspace */
H5E_BEGIN_TRY {
- hssize_t coord[1][1]; /* Coordinates for point selection */
+ hsize_t coord[1][1]; /* Coordinates for point selection */
coord[0][0]=0;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, 1, (const hssize_t **)coord);
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, 1, (const hsize_t **)coord);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_elements");
@@ -532,7 +532,7 @@ test_h5s_encode(void)
unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
hsize_t tdims[4]; /* Dimension array to test with */
hssize_t n; /* Number of dataspace elements */
- hssize_t start[] = {0, 0, 0};
+ hsize_t start[] = {0, 0, 0};
hsize_t stride[] = {2, 5, 3};
hsize_t count[] = {2, 2, 2};
hsize_t block[] = {1, 3, 1};
diff --git a/test/tmeta.c b/test/tmeta.c
index a78859f..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
diff --git a/test/tmisc.c b/test/tmisc.c
index 3a9d785..1558639 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -1167,7 +1167,7 @@ test_misc8(void)
size_t rdcc_nelmts; /* Raw data number of elements */
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;
@@ -1744,25 +1744,13 @@ 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 */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- int sym_ik; /* Symbol table B-tree initial 'K' value */
- int istore_ik; /* Indexed storage B-tree initial 'K' value */
-#else /* H5_WANT_H5_V1_6_COMPAT */
- unsigned sym_ik; /* Symbol table B-tree internal 'K' value */
- unsigned istore_ik; /* Indexed storage B-tree internal 'K' value */
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ unsigned sym_ik; /* Symbol table B-tree initial 'K' value */
+ unsigned istore_ik; /* Indexed storage B-tree initial 'K' value */
unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */
-#ifdef H5_WANT_H5_V1_6_COMPAT
- int super; /* Superblock version # */
- int freelist; /* Free list version # */
- int stab; /* Symbol table entry version # */
- int shhdr; /* Shared object header version # */
-#else /* H5_WANT_H5_V1_6_COMPAT */
unsigned super; /* Superblock version # */
unsigned freelist; /* Free list version # */
unsigned stab; /* Symbol table entry version # */
unsigned shhdr; /* Shared object header version # */
-#endif /* H5_WANT_H5_V1_6_COMPAT */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1922,7 +1910,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 */
@@ -3325,7 +3313,7 @@ test_misc19(void)
VERIFY(ret, FAIL, "H5Eclose_stack");
} /* end test_misc19() */
-
+
/****************************************************************
**
** test_misc20(): Test problems with version 2 of storage layout
diff --git a/test/trefer.c b/test/trefer.c
index 21877ee..e5d6e9e 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -289,28 +289,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 */
- hssize_t low[SPACE2_RANK]; /* Selection bounds */
- hssize_t high[SPACE2_RANK]; /* Selection bounds */
- 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"));
@@ -382,7 +382,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);
@@ -486,26 +486,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");
@@ -557,14 +557,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 */
@@ -643,7 +643,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);
@@ -771,16 +771,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/tselect.c b/test/tselect.c
index c4090f8..3f2083b 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 */
@@ -2969,7 +2975,7 @@ test_select_hyper_union_3d(void)
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
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 */
@@ -3171,7 +3177,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 */
@@ -3297,7 +3303,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 */
@@ -3425,7 +3431,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 */
@@ -3552,7 +3558,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 */
@@ -3671,7 +3677,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 */
@@ -3680,9 +3686,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");
@@ -3693,7 +3699,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() */
/****************************************************************
**
@@ -3709,7 +3715,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 */
@@ -3906,9 +3912,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 */
@@ -4139,9 +4145,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 */
@@ -4204,7 +4210,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 */
@@ -4240,7 +4246,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 */
@@ -4318,7 +4324,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;
@@ -4380,9 +4386,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 */
@@ -4477,7 +4483,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 */
@@ -4828,7 +4834,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;
/****************************************************************
@@ -4837,11 +4843,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)
@@ -4877,7 +4883,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 */
@@ -4923,7 +4929,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);
@@ -4949,7 +4955,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 */
@@ -4974,7 +4980,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) {
@@ -4998,7 +5004,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;
@@ -5011,7 +5017,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++) {
@@ -5043,10 +5049,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 */
@@ -5109,7 +5115,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++)
@@ -5142,11 +5148,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},
@@ -5204,7 +5210,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;
@@ -5217,7 +5223,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++) {
@@ -5249,9 +5255,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},
@@ -5261,7 +5267,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},
@@ -5326,7 +5332,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;
@@ -5339,7 +5345,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++) {
@@ -5468,8 +5474,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 */
@@ -5512,7 +5518,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 */
@@ -5616,8 +5622,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 */
@@ -5631,7 +5637,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");
@@ -5682,9 +5688,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 */
@@ -5718,7 +5724,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 */
@@ -5736,7 +5742,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 */
@@ -6093,7 +6099,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 */
@@ -6199,7 +6205,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 */
@@ -6349,7 +6355,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 */
@@ -6531,7 +6537,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 */
@@ -6727,6 +6733,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.
**
****************************************************************/
@@ -6866,6 +7076,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 e9d7c48..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 */
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index 7a4635b..f535541 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -145,31 +145,31 @@ void tts_acreate(void)
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 30e9bfb..f9a5047 100644
--- a/test/ttsafe_cancel.c
+++ b/test/ttsafe_cancel.c
@@ -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;
@@ -149,8 +149,8 @@ void *tts_cancel_thread(void UNUSED *arg)
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;
diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c
index 22796a8..8a4b38c 100644
--- a/test/ttsafe_dcreate.c
+++ b/test/ttsafe_dcreate.c
@@ -137,7 +137,7 @@ void tts_dcreate(void)
assert(ret>=0);
if (datavalue != i) {
- TestErrPrintf(stderr, "Wrong value read %d for dataset name %s - test failed\n",
+ TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n",
datavalue, dsetname[i]);
H5Dclose(dataset);
H5Fclose(file);
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index 62d7277..4e6c516 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -166,7 +166,7 @@ void *tts_error_thread(void UNUSED *arg)
/* 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 */
diff --git a/test/ttst.c b/test/ttst.c
index 10eb017..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 */
@@ -122,7 +122,7 @@ test_tst_init(void)
/* Create randomized set of unique words */
for(u=0; u<num_uniq_words; u++)
rand_uniq_words[u]=uniq_words[u];
- curr_time=time(NULL);
+ curr_time=HDtime(NULL);
HDsrandom((unsigned long)curr_time);
for(u=0; u<num_uniq_words; u++) {
v=u+(HDrandom()%(num_uniq_words-u));
diff --git a/test/tvltypes.c b/test/tvltypes.c
index af56eef..f510230 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -175,18 +175,18 @@ 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"));
@@ -1805,8 +1805,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
continue;
} /* end if */
- for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++)
-{
+ for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) {
if(t1->len!=t2->len) {
TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
continue;
diff --git a/test/unlink.c b/test/unlink.c
index 0fa7d4f..137bc88 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -1894,7 +1894,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");