summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/big.c2
-rw-r--r--test/bittests.c8
-rw-r--r--test/dtypes.c984
-rw-r--r--test/gheap.c12
-rw-r--r--test/hyperslab.c40
-rw-r--r--test/istore.c10
-rw-r--r--test/tmeta.c34
-rw-r--r--test/trefer.c16
-rw-r--r--test/tselect.c96
9 files changed, 1068 insertions, 134 deletions
diff --git a/test/big.c b/test/big.c
index 58e7fbc..9de9f3d 100644
--- a/test/big.c
+++ b/test/big.c
@@ -36,7 +36,7 @@
#elif SIZEOF_LONG >= 8
#define GB8LL ((unsigned long)8*1024*1024*1024)
#else
-#define GB8LL ((unsigned long)0) /* can not do the test */
+#define GB8LL ((unsigned long)0) /* cannot do the test */
#endif
static hsize_t
diff --git a/test/bittests.c b/test/bittests.c
index e0e47b5..6b1f1d9 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -34,7 +34,7 @@
static herr_t
test_find (void)
{
- uint8 v1[8];
+ uint8_t v1[8];
intn i;
ssize_t n;
@@ -154,7 +154,7 @@ test_find (void)
static herr_t
test_copy (void)
{
- uint8 v1[8], v2[8];
+ uint8_t v1[8], v2[8];
size_t s_offset, d_offset, size;
intn i, j;
ssize_t n;
@@ -277,7 +277,7 @@ test_copy (void)
static herr_t
test_set (void)
{
- uint8 v2[8];
+ uint8_t v2[8];
size_t d_offset, size;
intn i, j;
ssize_t n;
@@ -395,7 +395,7 @@ test_set (void)
static herr_t
test_clear (void)
{
- uint8 v2[8];
+ uint8_t v2[8];
size_t d_offset, size;
intn i, j;
ssize_t n;
diff --git a/test/dtypes.c b/test/dtypes.c
index 865cf2b..5611c16 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -61,15 +61,20 @@ typedef struct complex_t {
/*
* Count up or down depending on whether the machine is big endian or little
- * endian. If `E' is H5T_ORDER_BE then the result will be I, otherwise the
- * result will be Z-(I+1).
+ * endian. If local variable `endian' is H5T_ORDER_BE then the result will
+ * be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(E,Z,I) (H5T_ORDER_BE==(E)?(I):(Z)-((I)+1))
+#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1))
typedef enum flt_t {
FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER
} flt_t;
+typedef enum int_t {
+ INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
+ INT_LONG, INT_ULONG, INT_OTHER
+} int_t;
+
/* Count the number of overflows */
static int noverflows_g = 0;
@@ -77,6 +82,12 @@ static int noverflows_g = 0;
static int skip_overflow_tests_g = 0;
/*
+ * If set then all known hardware conversion functions are unregistered when
+ * the library is reset.
+ */
+static int without_hardware_g = 0;
+
+/*
* Although we check whether a floating point overflow generates a SIGFPE and
* turn off overflow tests in that case, it might still be possible for an
* overflow condition to occur. Once a SIGFPE is raised the program cannot
@@ -274,6 +285,101 @@ display_error_cb (void __unused__ *client_data)
/*-------------------------------------------------------------------------
+ * Function: reset_hdf5
+ *
+ * Purpose: Reset the hdf5 library. This causes statistics to be printed
+ * and counters to be reset.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+reset_hdf5(void)
+{
+ fflush(stdout);
+ fflush(stderr);
+ H5close();
+ H5Eset_auto (display_error_cb, NULL);
+ H5Tset_overflow(overflow_handler);
+
+ if (without_hardware_g) {
+ H5Tunregister(H5T_conv_char_uchar);
+ H5Tunregister(H5T_conv_char_short);
+ H5Tunregister(H5T_conv_char_ushort);
+ H5Tunregister(H5T_conv_char_int);
+ H5Tunregister(H5T_conv_char_uint);
+ H5Tunregister(H5T_conv_char_long);
+ H5Tunregister(H5T_conv_char_ulong);
+
+ H5Tunregister(H5T_conv_uchar_char);
+ H5Tunregister(H5T_conv_uchar_short);
+ H5Tunregister(H5T_conv_uchar_ushort);
+ H5Tunregister(H5T_conv_uchar_int);
+ H5Tunregister(H5T_conv_uchar_uint);
+ H5Tunregister(H5T_conv_uchar_long);
+ H5Tunregister(H5T_conv_uchar_ulong);
+
+ H5Tunregister(H5T_conv_short_char);
+ H5Tunregister(H5T_conv_short_uchar);
+ H5Tunregister(H5T_conv_short_ushort);
+ H5Tunregister(H5T_conv_short_int);
+ H5Tunregister(H5T_conv_short_uint);
+ H5Tunregister(H5T_conv_short_long);
+ H5Tunregister(H5T_conv_short_ulong);
+
+ H5Tunregister(H5T_conv_ushort_char);
+ H5Tunregister(H5T_conv_ushort_uchar);
+ H5Tunregister(H5T_conv_ushort_short);
+ H5Tunregister(H5T_conv_ushort_int);
+ H5Tunregister(H5T_conv_ushort_uint);
+ H5Tunregister(H5T_conv_ushort_long);
+ H5Tunregister(H5T_conv_ushort_ulong);
+
+ H5Tunregister(H5T_conv_int_char);
+ H5Tunregister(H5T_conv_int_uchar);
+ H5Tunregister(H5T_conv_int_short);
+ H5Tunregister(H5T_conv_int_ushort);
+ H5Tunregister(H5T_conv_int_uint);
+ H5Tunregister(H5T_conv_int_long);
+ H5Tunregister(H5T_conv_int_ulong);
+
+ H5Tunregister(H5T_conv_uint_char);
+ H5Tunregister(H5T_conv_uint_uchar);
+ H5Tunregister(H5T_conv_uint_short);
+ H5Tunregister(H5T_conv_uint_ushort);
+ H5Tunregister(H5T_conv_uint_int);
+ H5Tunregister(H5T_conv_uint_long);
+ H5Tunregister(H5T_conv_uint_ulong);
+
+ H5Tunregister(H5T_conv_long_char);
+ H5Tunregister(H5T_conv_long_uchar);
+ H5Tunregister(H5T_conv_long_short);
+ H5Tunregister(H5T_conv_long_ushort);
+ H5Tunregister(H5T_conv_long_int);
+ H5Tunregister(H5T_conv_long_uint);
+ H5Tunregister(H5T_conv_long_ulong);
+
+ H5Tunregister(H5T_conv_ulong_char);
+ H5Tunregister(H5T_conv_ulong_uchar);
+ H5Tunregister(H5T_conv_ulong_short);
+ H5Tunregister(H5T_conv_ulong_ushort);
+ H5Tunregister(H5T_conv_ulong_int);
+ H5Tunregister(H5T_conv_ulong_uint);
+ H5Tunregister(H5T_conv_ulong_long);
+
+ H5Tunregister(H5T_conv_float_double);
+ H5Tunregister(H5T_conv_double_float);
+ }
+}
+
+
+/*-------------------------------------------------------------------------
* Function: test_classes
*
* Purpose: Test type classes
@@ -962,9 +1068,11 @@ test_conv_str_1(void)
H5Tclose(dst_type);
puts(" PASSED");
+ reset_hdf5();
return 0;
error:
+ reset_hdf5();
return -1;
}
@@ -1023,6 +1131,7 @@ test_conv_str_2(void)
error:
if (buf) free(buf);
+ reset_hdf5();
return ret_value;
}
@@ -1070,7 +1179,9 @@ test_conv_int (void)
}
if (byte[0]!=0xff || byte[1]!=0xff) {
puts ("*FAILED*");
- puts (" (unsigned)0x80000000 -> (unsigned)0xffff");
+ printf(" src: 0x80000000 unsigned\n");
+ printf(" dst: 0x%02x%02x unsigned\n", byte[1], byte[0]);
+ printf(" ans: 0xffff unsigned\n");
goto error;
}
@@ -1081,7 +1192,9 @@ test_conv_int (void)
}
if (byte[0]!=0xff || byte[1]!=0x7f) {
puts ("*FAILED*");
- puts (" (unsigned)0xffffffff -> (signed)0x7f");
+ printf(" src: 0xffffffff unsigned\n");
+ printf(" dst: 0x%02x%02x signed\n", byte[1], byte[0]);
+ printf(" ans: 0x7fff signed\n");
goto error;
}
@@ -1092,7 +1205,9 @@ test_conv_int (void)
}
if (byte[0]!=0x00 || byte[1]!=0x00) {
puts ("*FAILED*");
- puts (" (signed)0xffffffff -> (unsigned)0x00");
+ printf(" src: 0xffffffff signed\n");
+ printf(" dst: 0x%02x%02x unsigned\n", byte[1], byte[0]);
+ printf(" ans: 0x0000 unsigned\n");
goto error;
}
@@ -1104,7 +1219,9 @@ test_conv_int (void)
}
if (byte[0]!=0xff || byte[1]!=0xff) {
puts ("*FAILED*");
- puts (" (signed)0x7fffffff -> (unsigned)0xffff");
+ printf(" src: 0x7fffffff signed\n");
+ printf(" dst: 0x%02x%02x unsigned\n", byte[1], byte[0]);
+ printf(" ans: 0xffff unsigned\n");
goto error;
}
@@ -1116,7 +1233,9 @@ test_conv_int (void)
}
if (byte[0]!=0xff || byte[1]!=0x7f) {
puts ("*FAILED*");
- puts (" (signed)0x7fffffff -> (signed)0x7fff");
+ printf(" src: 0x7fffffff signed\n");
+ printf(" dst: 0x%02x%02x signed\n", byte[1], byte[0]);
+ printf(" ans: 0x7fff signed\n");
goto error;
}
@@ -1128,7 +1247,9 @@ test_conv_int (void)
}
if (byte[0]!=0x00 || byte[1]!=0x80) {
puts ("*FAILED*");
- puts (" (signed)0xbfffffff -> (signed)0x8000");
+ printf(" src: 0xbfffffff signed\n");
+ printf(" dst: 0x%02x%02x signed\n", byte[1], byte[0]);
+ printf(" ans: 0x8000 signed\n");
goto error;
}
@@ -1173,16 +1294,664 @@ test_conv_int (void)
puts (" PASSED");
free (buf);
free (saved);
+ reset_hdf5();
return 0;
error:
if (buf) free (buf);
if (saved) free (saved);
+ reset_hdf5();
return -1;
}
/*-------------------------------------------------------------------------
+ * Function: test_conv_int_1
+ *
+ * Purpose: Test conversion of random integer values from SRC to DST.
+ * These types should be any combination of:
+ *
+ * H5T_NATIVE_CHAR H5T_NATIVE_UCHAR
+ * H5T_NATIVE_SHORT H5T_NATIVE_USHORT
+ * H5T_NATIVE_INT H5T_NATIVE_UINT
+ * H5T_NATIVE_LONG H5T_NATIVE_ULONG
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_conv_int_1(const char *name, hid_t src, hid_t dst)
+{
+ const size_t ntests=5; /*number of tests */
+ const size_t nelmts=200000; /*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 */
+ char str[256]; /*hello string */
+ int_t src_type, dst_type; /*data types */
+ const char *src_type_name=NULL; /*source type name */
+ const char *dst_type_name=NULL; /*destination type name */
+ int endian; /*machine endianess */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf=NULL; /*buffer for conversion */
+ unsigned char *saved=NULL; /*original values */
+ size_t i, j, k; /*counters */
+ unsigned char *hw=NULL; /*hardware conv result */
+ unsigned char src_bits[32]; /*src value in LE order */
+ unsigned char dst_bits[32]; /*dest value in LE order*/
+ size_t src_nbits; /*source length in bits */
+ size_t dst_nbits; /*dst length in bits */
+ signed char hw_char;
+ unsigned char hw_uchar;
+ short hw_short;
+ unsigned short hw_ushort;
+ int hw_int;
+ unsigned hw_uint;
+ long hw_long;
+ unsigned long hw_ulong;
+
+
+ /* What are the names of the source and destination types */
+ if (H5Tequal(src, H5T_NATIVE_CHAR)) {
+ src_type_name = "signed char";
+ src_type = INT_CHAR;
+ } else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
+ src_type_name = "unsigned char";
+ src_type = INT_UCHAR;
+ } else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
+ src_type_name = "short";
+ src_type = INT_SHORT;
+ } else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
+ src_type_name = "unsigned short";
+ src_type = INT_USHORT;
+ } else if (H5Tequal(src, H5T_NATIVE_INT)) {
+ src_type_name = "int";
+ src_type = INT_INT;
+ } else if (H5Tequal(src, H5T_NATIVE_UINT)) {
+ src_type_name = "unsigned int";
+ src_type = INT_UINT;
+ } else if (H5Tequal(src, H5T_NATIVE_LONG)) {
+ src_type_name = "long";
+ src_type = INT_LONG;
+ } else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
+ src_type_name = "unsigned long";
+ src_type = INT_ULONG;
+ } else {
+ src_type_name = "UNKNOWN";
+ src_type = INT_OTHER;
+ }
+
+ if (H5Tequal(dst, H5T_NATIVE_CHAR)) {
+ dst_type_name = "signed char";
+ dst_type = INT_CHAR;
+ } else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
+ dst_type_name = "unsigned char";
+ dst_type = INT_UCHAR;
+ } else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
+ dst_type_name = "short";
+ dst_type = INT_SHORT;
+ } else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
+ dst_type_name = "unsigned short";
+ dst_type = INT_USHORT;
+ } else if (H5Tequal(dst, H5T_NATIVE_INT)) {
+ dst_type_name = "int";
+ dst_type = INT_INT;
+ } else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
+ dst_type_name = "unsigned int";
+ dst_type = INT_UINT;
+ } else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
+ dst_type_name = "long";
+ dst_type = INT_LONG;
+ } else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
+ dst_type_name = "unsigned long";
+ dst_type = INT_ULONG;
+ } else {
+ dst_type_name = "UNKNOWN";
+ dst_type = INT_OTHER;
+ }
+
+ /* Sanity checks */
+ if (INT_OTHER==src_type || INT_OTHER==dst_type) {
+ sprintf(str, "Testing random %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ printf("%-70s", str);
+ puts("*FAILED*");
+ puts(" Unknown data type.");
+ goto error;
+ }
+
+ /* Allocate buffers */
+ endian = H5Tget_order(H5T_NATIVE_INT);
+ src_size = H5Tget_size(src);
+ dst_size = H5Tget_size(dst);
+ buf = malloc(nelmts*MAX(src_size, dst_size));
+ saved = malloc(nelmts*MAX(src_size, dst_size));
+ noverflows_g = 0;
+
+ /* The tests */
+ for (i=0; i<ntests; i++) {
+ sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)",
+ name, src_type_name, dst_type_name, (int)i+1, (int)ntests);
+ printf("%-70s", str);
+ fflush(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
+ * sed for the comparison later.
+ */
+ for (j=0; j<nelmts*src_size; j++) buf[j] = saved[j] = rand();
+
+ /* Perform the conversion */
+ if (H5Tconvert(src, dst, nelmts, buf, NULL)<0) goto error;
+
+ /* Check the results from the library against hardware */
+ for (j=0; j<nelmts; j++) {
+ if (INT_CHAR==dst_type) {
+ hw = (unsigned char*)&hw_char;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_char = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_char = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_char = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_char = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_char = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_char = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_char = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_char = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ } else if (INT_UCHAR==dst_type) {
+ hw = (unsigned char*)&hw_uchar;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_uchar = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_uchar = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_uchar = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_uchar = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_uchar = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_uchar = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_uchar = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_uchar = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ } else if (INT_SHORT==dst_type) {
+ hw = (unsigned char*)&hw_short;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_short = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_short = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_short = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_short = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_short = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_short = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_short = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_short = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ } else if (INT_USHORT==dst_type) {
+ hw = (unsigned char*)&hw_ushort;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_ushort = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_ushort = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_ushort = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_ushort = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_ushort = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_ushort = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_ushort = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_ushort = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ } else if (INT_INT==dst_type) {
+ hw = (unsigned char*)&hw_int;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_int = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_int = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_int = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_int = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_int = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_int = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_int = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_int = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ } else if (INT_UINT==dst_type) {
+ hw = (unsigned char*)&hw_uint;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_uint = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_uint = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_uint = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_uint = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_uint = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_uint = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_uint = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_uint = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ } else if (INT_LONG==dst_type) {
+ hw = (unsigned char*)&hw_long;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_long = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_long = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_long = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_long = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_long = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_long = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_long = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_long = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ } else if (INT_ULONG==dst_type) {
+ hw = (unsigned char*)&hw_ulong;
+ switch (src_type) {
+ case INT_CHAR:
+ hw_ulong = ((signed char*)saved)[j];
+ break;
+ case INT_UCHAR:
+ hw_ulong = ((unsigned char*)saved)[j];
+ break;
+ case INT_SHORT:
+ hw_ulong = ((short*)saved)[j];
+ break;
+ case INT_USHORT:
+ hw_ulong = ((unsigned short*)saved)[j];
+ break;
+ case INT_INT:
+ hw_ulong = ((int*)saved)[j];
+ break;
+ case INT_UINT:
+ hw_ulong = ((unsigned*)saved)[j];
+ break;
+ case INT_LONG:
+ hw_ulong = ((long*)saved)[j];
+ break;
+ case INT_ULONG:
+ hw_ulong = ((unsigned long*)saved)[j];
+ break;
+ case INT_OTHER:
+ break;
+ }
+ }
+
+ /* 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*/
+
+ /*
+ * Convert the source and destination values to little endian
+ * order so we can use the HDF5 bit vector operations to test
+ * certain things. These routines have already been tested by
+ * the `bittests' program.
+ */
+ src_nbits = 8*src_size;
+ for (k=0; k<src_size; k++) {
+ src_bits[src_size-(k+1)] = saved[j*src_size+
+ ENDIAN(src_size, k)];
+ }
+
+ dst_nbits = 8*dst_size;
+ for (k=0; k<dst_size; k++) {
+ dst_bits[dst_size-(k+1)] = buf[j*dst_size+
+ ENDIAN(dst_size, k)];
+ }
+
+
+ /*
+ * Hardware usually doesn't handle overflows too gracefully. The
+ * hardware conversion result during overflows is usually garbage
+ * so we must handle those cases differetly when checking results.
+ */
+ if (H5T_SGN_2==H5Tget_sign(src) &&
+ H5T_SGN_2==H5Tget_sign(dst)) {
+ if (src_size>dst_size &&
+ 0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
+ H5T_BIT_MSB, 1)>=0) {
+ /*
+ * Source is positive and the magnitude is too large for
+ * the destination. The destination should be set to the
+ * maximum possible value: 0x7f...f
+ */
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
+ H5T_bit_find(dst_bits, 0, dst_nbits-1,
+ H5T_BIT_LSB, 0)<0) {
+ continue; /*no error*/
+ }
+ } else if (src_size>dst_size &&
+ 1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ H5T_bit_find(src_bits, 0, src_nbits-1, H5T_BIT_MSB,
+ 0)+1>=(ssize_t)dst_nbits) {
+ /*
+ * Source is negative but the magnitude is too large for
+ * the destination. The destination should be set to the
+ * smallest possible value: 0x80...0
+ */
+ if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
+ H5T_bit_find(dst_bits, 0, dst_nbits-1,
+ H5T_BIT_LSB, 1)<0) {
+ continue; /*no error*/
+ }
+ }
+
+ } else if (H5T_SGN_2==H5Tget_sign(src) &&
+ H5T_SGN_NONE==H5Tget_sign(dst)) {
+ if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ /*
+ * The source is negative so the result should be zero.
+ * The source is negative if the most significant bit is
+ * set. The destination is zero if all bits are zero.
+ */
+ if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
+ continue; /*no error*/
+ } else if (src_size>dst_size &&
+ H5T_bit_find(src_bits, dst_nbits-1,
+ src_nbits-dst_nbits, H5T_BIT_LSB,
+ 1)>=0) {
+ /*
+ * The source is a value with a magnitude too large for
+ * the destination. The destination should be the
+ * largest possible value: 0xff...f
+ */
+ if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB,
+ 0)<0) {
+ continue; /*no error*/
+ }
+ }
+
+ } else if (H5T_SGN_NONE==H5Tget_sign(src) &&
+ H5T_SGN_2==H5Tget_sign(dst)) {
+ if (src_size>=dst_size &&
+ H5T_bit_find(src_bits, dst_nbits-1,
+ (src_nbits-dst_nbits)+1, H5T_BIT_LSB, 1)>=0) {
+ /*
+ * The source value has a magnitude that is larger than
+ * the destination can handle. The destination should be
+ * set to the largest possible positive value: 0x7f...f
+ */
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
+ H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB,
+ 0)<0) {
+ continue; /*no error*/
+ }
+ }
+
+ } else {
+ if (src_size>dst_size &&
+ 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
+ * set to the largest possible value: 0xff...f
+ */
+ if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB,
+ 0)<0) {
+ continue; /*no error*/
+ }
+ }
+ }
+
+ /* Print errors */
+ if (0==fails_this_test++) puts("*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", 3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size), "");
+ switch (src_type) {
+ case INT_CHAR:
+ printf(" %29d\n", ((signed char*)saved)[j]);
+ break;
+ case INT_UCHAR:
+ printf(" %29u\n", ((unsigned char*)saved)[j]);
+ break;
+ case INT_SHORT:
+ printf(" %29d\n", ((short*)saved)[j]);
+ break;
+ case INT_USHORT:
+ printf(" %29u\n", ((unsigned short*)saved)[j]);
+ break;
+ case INT_INT:
+ printf(" %29d\n", ((int*)saved)[j]);
+ break;
+ case INT_UINT:
+ printf(" %29u\n", ((unsigned*)saved)[j]);
+ break;
+ case INT_LONG:
+ printf(" %29ld\n", ((long*)saved)[j]);
+ break;
+ case INT_ULONG:
+ printf(" %29lu\n", ((unsigned long*)saved)[j]);
+ break;
+ case INT_OTHER:
+ break;
+ }
+
+ printf(" dst = ");
+ for (k=0; k<dst_size; k++) {
+ printf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k)]);
+ }
+ printf("%*s", 3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size), "");
+ switch (dst_type) {
+ case INT_CHAR:
+ printf(" %29d\n", ((signed char*)buf)[j]);
+ break;
+ case INT_UCHAR:
+ printf(" %29u\n", ((unsigned char*)buf)[j]);
+ break;
+ case INT_SHORT:
+ printf(" %29d\n", ((short*)buf)[j]);
+ break;
+ case INT_USHORT:
+ printf(" %29u\n", ((unsigned short*)buf)[j]);
+ break;
+ case INT_INT:
+ printf(" %29d\n", ((int*)buf)[j]);
+ break;
+ case INT_UINT:
+ printf(" %29u\n", ((unsigned*)buf)[j]);
+ break;
+ case INT_LONG:
+ printf(" %29ld\n", ((long*)buf)[j]);
+ break;
+ case INT_ULONG:
+ printf(" %29lu\n", ((unsigned long*)buf)[j]);
+ break;
+ case INT_OTHER:
+ break;
+ }
+
+ printf(" ans = ");
+ for (k=0; k<dst_size; k++) {
+ printf(" %02x", hw[ENDIAN(dst_size, k)]);
+ }
+ printf("%*s", 3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size), "");
+ switch (dst_type) {
+ case INT_CHAR:
+ printf(" %29d\n", *((signed char*)hw));
+ break;
+ case INT_UCHAR:
+ printf(" %29u\n", *((unsigned char*)hw));
+ break;
+ case INT_SHORT:
+ printf(" %29d\n", *((short*)hw));
+ break;
+ case INT_USHORT:
+ printf(" %29u\n", *((unsigned short*)hw));
+ break;
+ case INT_INT:
+ printf(" %29d\n", *((int*)hw));
+ break;
+ case INT_UINT:
+ printf(" %29u\n", *((unsigned*)hw));
+ break;
+ case INT_LONG:
+ printf(" %29ld\n", *((long*)hw));
+ break;
+ case INT_ULONG:
+ printf(" %29lu\n", *((unsigned long*)hw));
+ break;
+ case INT_OTHER:
+ break;
+ }
+
+ if (++fails_all_tests>=max_fails) {
+ puts(" maximum failures reached, aborting test...");
+ goto done;
+ }
+ }
+ puts(" PASSED");
+ }
+ if (noverflows_g>0) {
+ printf(" %d overflow%s\n", noverflows_g, 1==noverflows_g?"":"s");
+ }
+
+ done:
+ if (buf) free(buf);
+ if (saved) free(saved);
+ fflush(stdout);
+ reset_hdf5(); /*print statistics*/
+ return (int)fails_all_tests;
+
+ error:
+ if (buf) free(buf);
+ if (saved) free(saved);
+ fflush(stdout);
+ reset_hdf5(); /*print statistics*/
+ return MAX((int)fails_all_tests, 1);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: my_isnan
*
* Purpose: Determines whether VAL points to NaN.
@@ -1403,16 +2172,12 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
for (j=0; j<nelmts*src_size; j++) buf[j] = saved[j] = rand();
} else {
for (j=0; j<nelmts; j++) {
-#if 0
- unsigned char temp[32];
-#else
/* Do it this way for alignment reasons */
#ifdef USE_LDOUBLE
long double temp[1];
#else
double temp[1];
#endif
-#endif
if (src_size<=dst_size) {
for (k=0; k<dst_size; k++) buf[j*src_size+k] = rand();
} else {
@@ -1563,7 +2328,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
printf(" src =");
for (k=0; k<src_size; k++) {
- printf(" %02x", saved[j*src_size+ENDIAN(endian,src_size,k)]);
+ printf(" %02x", saved[j*src_size+ENDIAN(src_size,k)]);
}
printf("%*s", 3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size), "");
if (FLT_FLOAT==src_type) {
@@ -1578,7 +2343,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
printf(" dst =");
for (k=0; k<dst_size; k++) {
- printf(" %02x", buf[j*dst_size+ENDIAN(endian,dst_size,k)]);
+ printf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k)]);
}
printf("%*s", 3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size), "");
if (FLT_FLOAT==dst_type) {
@@ -1593,7 +2358,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
printf(" ans =");
for (k=0; k<dst_size; k++) {
- printf(" %02x", hw[ENDIAN(endian,dst_size,k)]);
+ printf(" %02x", hw[ENDIAN(dst_size,k)]);
}
printf("%*s", 3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size), "");
if (FLT_FLOAT==dst_type) {
@@ -1620,18 +2385,22 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
done:
if (buf) free (buf);
if (saved) free (saved);
+ fflush(stdout);
#ifdef HANDLE_SIGFPE
exit(MIN((int)fails_all_tests, 254));
#else
+ reset_hdf5();
return (int)fails_all_tests;
#endif
error:
if (buf) free (buf);
+ fflush(stdout);
if (saved) free (saved);
#ifdef HANDLE_SIGFPE
exit(MIN(MAX((int)fails_all_tests, 1), 254));
#else
+ reset_hdf5();
return MAX((int)fails_all_tests, 1);
#endif
}
@@ -1658,11 +2427,7 @@ main(void)
{
unsigned long nerrors = 0;
- /* Set the error handler */
- H5Eset_auto (display_error_cb, NULL);
-
- /* Set the overflow handler */
- H5Tset_overflow(overflow_handler);
+ reset_hdf5();
/* Do the tests */
nerrors += test_classes()<0 ? 1 : 0;
@@ -1670,6 +2435,8 @@ main(void)
nerrors += test_compound()<0 ? 1 : 0;
nerrors += test_transient ()<0 ? 1 : 0;
nerrors += test_named ()<0 ? 1 : 0;
+ reset_hdf5();
+
nerrors += test_conv_str_1()<0 ? 1 : 0;
nerrors += test_conv_str_2()<0 ? 1 : 0;
nerrors += test_conv_int ()<0 ? 1 : 0;
@@ -1681,13 +2448,180 @@ main(void)
nerrors += test_conv_flt_1("noop", H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT);
nerrors += test_conv_flt_1("noop", H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE);
- /* Test hardware conversion functions */
+ /* Test hardware integer conversion functions */
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_INT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_ULONG);
+#endif
+
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_UINT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_ULONG);
+#endif
+
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_UINT);
+ nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_LONG);
+#endif
+
+ /* Test hardware floating-point conversion functions */
nerrors += test_conv_flt_1("hw", H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1("hw", H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT);
- /* Test software conversion functions */
- H5Tunregister(H5T_conv_float_double);
- H5Tunregister(H5T_conv_double_float);
+ /*----------------------------------------------------------------------
+ * Software tests follow
+ *----------------------------------------------------------------------
+ */
+ without_hardware_g = TRUE;
+ reset_hdf5();
+
+ /* Test software integer conversion functions */
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_UINT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_ULONG);
+#endif
+
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_INT);
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_ULONG);
+#endif
+
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_UINT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_ULONG);
+#endif
+
+#if SIZEOF_INT != SIZEOF_LONG
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_CHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_INT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_UINT);
+ nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_LONG);
+#endif
+
+ /* Test software floating-point conversion functions */
nerrors += test_conv_flt_1("sw", H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1("sw", H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT);
#ifdef USE_LDOUBLE
diff --git a/test/gheap.c b/test/gheap.c
index d4d4633..9218c3a 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -86,8 +86,8 @@ test_1 (void)
{
H5F_t *f;
H5HG_t obj[1024];
- uint8 out[1024];
- uint8 in[1024];
+ uint8_t out[1024];
+ uint8_t in[1024];
int i;
size_t size;
herr_t status;
@@ -169,8 +169,8 @@ test_2 (void)
{
H5F_t *f;
H5HG_t obj[1024];
- uint8 out[1024];
- uint8 in[1024];
+ uint8_t out[1024];
+ uint8_t in[1024];
int i;
size_t size;
herr_t status;
@@ -247,7 +247,7 @@ test_3 (void)
{
H5F_t *f;
H5HG_t obj[1024];
- uint8 out[1024];
+ uint8_t out[1024];
int i;
size_t size;
herr_t status;
@@ -316,7 +316,7 @@ test_4 (void)
{
H5F_t *f;
H5HG_t obj[1024];
- uint8 out[1024];
+ uint8_t out[1024];
int i;
size_t size;
herr_t status;
diff --git a/test/hyperslab.c b/test/hyperslab.c
index b645dfd..6fdfaa5 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -43,10 +43,10 @@
*-------------------------------------------------------------------------
*/
static uintn
-init_full(uint8 *array, size_t nx, size_t ny, size_t nz)
+init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
size_t i, j, k;
- uint8 acc = 128;
+ uint8_t acc = 128;
uintn total = 0;
for (i=0; i<nx; i++) {
@@ -75,7 +75,7 @@ init_full(uint8 *array, size_t nx, size_t ny, size_t nz)
*-------------------------------------------------------------------------
*/
static void
-print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
+print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
size_t i, j, k;
@@ -118,9 +118,9 @@ print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
static void
print_ref(size_t nx, size_t ny, size_t nz)
{
- uint8 *array;
+ uint8_t *array;
- array = H5MM_calloc(nx*ny*nz*sizeof(uint8));
+ array = H5MM_calloc(nx*ny*nz*sizeof(uint8_t));
printf("Reference array:\n");
init_full(array, nx, ny, nz);
@@ -148,7 +148,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
size_t di, size_t dj, size_t dk,
size_t ddx, size_t ddy, size_t ddz)
{
- uint8 *dst = NULL; /*destination array */
+ 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 */
@@ -312,8 +312,8 @@ test_copy(int mode,
size_t di, size_t dj, size_t dk,
size_t ddx, size_t ddy, size_t ddz)
{
- uint8 *src = NULL; /*source array */
- uint8 *dst = NULL; /*destination array */
+ uint8_t *src = NULL; /*source array */
+ uint8_t *dst = NULL; /*destination array */
hsize_t hs_size[3]; /*hyperslab size */
hsize_t dst_size[3]; /*destination total size */
hsize_t src_size[3]; /*source total size */
@@ -650,13 +650,13 @@ test_multifill(size_t nx)
printf(" fill={%d,%g,%d}\n ",
fill.left, fill.mid, fill.right);
for (j = 0; j < sizeof(fill); j++) {
- printf(" %02x", ((uint8 *) &fill)[j]);
+ printf(" %02x", ((uint8_t *) &fill)[j]);
}
printf("\n dst[%lu]={%d,%g,%d}\n ",
(unsigned long)i,
dst[i].left, dst[i].mid, dst[i].right);
for (j = 0; j < sizeof(dst[i]); j++) {
- printf(" %02x", ((uint8 *) (dst + i))[j]);
+ printf(" %02x", ((uint8_t *) (dst + i))[j]);
}
printf("\n");
}
@@ -696,8 +696,8 @@ test_multifill(size_t nx)
static herr_t
test_endian(size_t nx)
{
- uint8 *src = NULL; /*source array */
- uint8 *dst = NULL; /*destination array */
+ uint8_t *src = NULL; /*source array */
+ uint8_t *dst = NULL; /*destination array */
hssize_t src_stride[2]; /*source strides */
hssize_t dst_stride[2]; /*destination strides */
hsize_t size[2]; /*size vector */
@@ -880,9 +880,9 @@ test_transpose(size_t nx, size_t ny)
static herr_t
test_sub_super(size_t nx, size_t ny)
{
- uint8 *full = NULL; /*original image */
- uint8 *half = NULL; /*image at 1/2 resolution */
- uint8 *twice = NULL; /*2x2 pixels */
+ 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 size[4]; /*number of sample points */
@@ -910,7 +910,7 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[1] = 1;
/* Copy */
- H5V_stride_copy(2, (hsize_t)sizeof(uint8), size,
+ H5V_stride_copy(2, (hsize_t)sizeof(uint8_t), size,
dst_stride, half, src_stride, full);
/* Check */
@@ -956,12 +956,12 @@ test_sub_super(size_t nx, size_t ny)
src_stride[2] = 0;
src_stride[3] = 0;
dst_stride[0] = (ssize_t)(2 * ny);
- dst_stride[1] = (ssize_t)(2 * sizeof(uint8) - 4 * ny);
- dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8));
- dst_stride[3] = sizeof(uint8);
+ dst_stride[1] = (ssize_t)(2 * sizeof(uint8_t) - 4 * ny);
+ dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8_t));
+ dst_stride[3] = sizeof(uint8_t);
/* Copy */
- H5V_stride_copy(4, (hsize_t)sizeof(uint8), size,
+ H5V_stride_copy(4, (hsize_t)sizeof(uint8_t), size,
dst_stride, twice, src_stride, half);
/* Check */
diff --git a/test/istore.c b/test/istore.c
index 6f73d82..da458a4 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -59,7 +59,7 @@ hssize_t zero[H5O_LAYOUT_NDIMS];
*-------------------------------------------------------------------------
*/
static void
-print_array(uint8 *array, size_t nx, size_t ny, size_t nz)
+print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
size_t i, j, k;
@@ -210,7 +210,7 @@ test_extend(H5F_t *f, const char *prefix,
H5G_entry_t handle;
hsize_t i, j, k, ctr;
int ndims;
- uint8 *buf = NULL, *check = NULL, *whole = NULL;
+ uint8_t *buf = NULL, *check = NULL, *whole = NULL;
char dims[64], s[256], name[256];
hssize_t offset[3];
hssize_t max_corner[3];
@@ -441,7 +441,7 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
hsize_t size[3], total = 0;
H5G_entry_t handle;
H5O_layout_t layout;
- uint8 *buf = NULL;
+ uint8_t *buf = NULL;
if (!nz) {
if (!ny) {
@@ -617,8 +617,8 @@ main(int argc, char *argv[])
/* Create the test file */
if (NULL == (f = H5F_open(FILENAME,
- (H5F_ACC_CREAT | H5F_ACC_RDWR | H5F_ACC_TRUNC |
- H5F_ACC_DEBUG),
+ (H5F_ACC_CREAT | H5F_ACC_RDWR | H5F_ACC_TRUNC |
+ H5F_ACC_DEBUG),
creation_template, NULL))) {
printf("Cannot create file %s; test aborted\n", FILENAME);
exit(1);
diff --git a/test/tmeta.c b/test/tmeta.c
index 601964e..ade015a 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -34,21 +34,21 @@ static char RcsId[] = "$Revision$";
#define TEST_INT32_VALUE -981236
#define TEST_UINT32_VALUE 3476589
-uint8 compar_buffer[] =
+uint8_t compar_buffer[] =
{
/* Little-endian encoded version of the 16-bit signed integer */
- (uint8) ((TEST_INT16_VALUE) & 0xff), (uint8) ((TEST_INT16_VALUE >> 8) & 0xff),
+ (uint8_t) ((TEST_INT16_VALUE) & 0xff), (uint8_t) ((TEST_INT16_VALUE >> 8) & 0xff),
/* Little-endian encoded version of the 16-bit unsigned integer */
- (uint8) ((TEST_UINT16_VALUE) & 0xff), (uint8) ((TEST_UINT16_VALUE >> 8) & 0xff),
+ (uint8_t) ((TEST_UINT16_VALUE) & 0xff), (uint8_t) ((TEST_UINT16_VALUE >> 8) & 0xff),
/* Little-endian encoded version of the 32-bit signed integer */
- (uint8) ((TEST_INT32_VALUE) & 0xff), (uint8) ((TEST_INT32_VALUE >> 8) & 0xff),
- (uint8) ((TEST_INT32_VALUE >> 16) & 0xff), (uint8) ((TEST_INT32_VALUE >> 24) & 0xff),
+ (uint8_t) ((TEST_INT32_VALUE) & 0xff), (uint8_t) ((TEST_INT32_VALUE >> 8) & 0xff),
+ (uint8_t) ((TEST_INT32_VALUE >> 16) & 0xff), (uint8_t) ((TEST_INT32_VALUE >> 24) & 0xff),
/* Little-endian encoded version of the 32-bit unsigned integer */
- (uint8) ((TEST_UINT32_VALUE) & 0xff), (uint8) ((TEST_UINT32_VALUE >> 8) & 0xff),
- (uint8) ((TEST_UINT32_VALUE >> 16) & 0xff), (uint8) ((TEST_UINT32_VALUE >> 24) & 0xff),
+ (uint8_t) ((TEST_UINT32_VALUE) & 0xff), (uint8_t) ((TEST_UINT32_VALUE >> 8) & 0xff),
+ (uint8_t) ((TEST_UINT32_VALUE >> 16) & 0xff), (uint8_t) ((TEST_UINT32_VALUE >> 24) & 0xff),
};
-uint8 encode_buffer[sizeof(compar_buffer)];
+uint8_t encode_buffer[sizeof(compar_buffer)];
/****************************************************************
**
@@ -58,15 +58,15 @@ uint8 encode_buffer[sizeof(compar_buffer)];
void
test_metadata(void)
{
- int16 ei16 = TEST_INT16_VALUE; /* variables to hold the values to encode */
- uint16 eu16 = TEST_UINT16_VALUE;
- int32 ei32 = TEST_INT32_VALUE;
- uint32 eu32 = TEST_UINT32_VALUE;
- int16 di16; /* variables to hold the decoded values */
- uint16 du16;
- int32 di32;
- uint32 du32;
- uint8 *p; /* pointer into the buffer being en/de-coded */
+ int16_t ei16 = TEST_INT16_VALUE; /* variables to hold the values to encode */
+ uint16_t eu16 = TEST_UINT16_VALUE;
+ int32_t ei32 = TEST_INT32_VALUE;
+ uint32_t eu32 = TEST_UINT32_VALUE;
+ int16_t di16; /* variables to hold the decoded values */
+ uint16_t du16;
+ int32_t di32;
+ uint32_t du32;
+ uint8_t *p; /* pointer into the buffer being en/de-coded */
/* Output message about test being performed */
MESSAGE(5, ("Testing Metadata encode/decode code\n"));
diff --git a/test/trefer.c b/test/trefer.c
index c72b5d8..dd7618b 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -62,7 +62,7 @@ test_reference_obj(void)
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
- uint32 *tu32; /* Temporary pointer to uint32 data */
+ uint32_t *tu32; /* Temporary pointer to uint32 data */
intn i; /* counting variables */
herr_t ret; /* Generic return value */
@@ -94,7 +94,7 @@ test_reference_obj(void)
dataset=H5Dcreate(fid1,"Dataset1",H5T_STD_U32LE,sid1,H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
- for(tu32=(uint32 *)wbuf,i=0; i<SPACE1_DIM1; i++)
+ for(tu32=(uint32_t *)wbuf,i=0; i<SPACE1_DIM1; i++)
*tu32++=i*3;
/* Write selection to disk */
@@ -170,8 +170,8 @@ test_reference_obj(void)
ret=H5Dread(dset2,H5T_STD_U32LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,tbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu32=(uint32 *)tbuf,i=0; i<SPACE1_DIM1; i++,tu32++)
- VERIFY(*tu32, (uint32)(i*3), "Data");
+ for(tu32=(uint32_t *)tbuf,i=0; i<SPACE1_DIM1; i++,tu32++)
+ VERIFY(*tu32, (uint32_t)(i*3), "Data");
/* Close dereferenced Dataset */
ret = H5Dclose(dset2);
@@ -215,9 +215,9 @@ test_reference_region(void)
hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
- uint8 *dwbuf, /* Buffer for writing numeric data to disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
- uint8 *tu8; /* Temporary pointer to uint8 data */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
intn i; /* counting variables */
herr_t ret; /* Generic return value */
@@ -227,8 +227,8 @@ test_reference_region(void)
/* Allocate write & read buffers */
wbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
rbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
- dwbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- drbuf=calloc(sizeof(uint8),SPACE2_DIM1*SPACE2_DIM2);
+ dwbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ drbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
/* Create file */
fid1 = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/test/tselect.c b/test/tselect.c
index 651cb41..a538518 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -81,7 +81,7 @@ test_select_hyper(void)
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 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -93,13 +93,13 @@ test_select_hyper(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -211,7 +211,7 @@ test_select_point(void)
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 */
- uint8 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -222,13 +222,13 @@ test_select_point(void)
MESSAGE(5, ("Testing Element Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -352,7 +352,7 @@ test_select_all(void)
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 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -364,13 +364,13 @@ test_select_all(void)
MESSAGE(5, ("Testing 'All' Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -492,7 +492,7 @@ test_select_combo(void)
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 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -503,13 +503,13 @@ test_select_combo(void)
MESSAGE(5, ("Testing Combination of Hyperslab & Element Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -633,7 +633,7 @@ test_select_hyper_stride(void)
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 */
- uint16 *wbuf, /* buffer to write to disk */
+ uint16_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -668,13 +668,13 @@ test_select_hyper_stride(void)
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint16)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint16),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint16)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint16_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -787,7 +787,7 @@ test_select_hyper_copy(void)
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 */
- uint16 *wbuf, /* buffer to write to disk */
+ uint16_t *wbuf, /* buffer to write to disk */
*rbuf, /* 1st buffer read from disk */
*rbuf2, /* 2nd buffer read from disk */
*tbuf; /* temporary buffer pointer */
@@ -798,14 +798,14 @@ test_select_hyper_copy(void)
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint16)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint16),SPACE3_DIM1*SPACE3_DIM2);
- rbuf2=calloc(sizeof(uint16),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2);
+ rbuf2=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint16)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint16_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -886,7 +886,7 @@ test_select_hyper_copy(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- if(HDmemcmp(rbuf,rbuf2,sizeof(uint16)*SPACE3_DIM1*SPACE3_DIM2)) {
+ if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) {
printf("hyperslab values don't match!\n");
} /* end if */
@@ -938,7 +938,7 @@ test_select_point_copy(void)
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 */
- uint16 *wbuf, /* buffer to write to disk */
+ uint16_t *wbuf, /* buffer to write to disk */
*rbuf, /* 1st buffer read from disk */
*rbuf2, /* 2nd buffer read from disk */
*tbuf; /* temporary buffer pointer */
@@ -949,14 +949,14 @@ test_select_point_copy(void)
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint16)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint16),SPACE3_DIM1*SPACE3_DIM2);
- rbuf2=calloc(sizeof(uint16),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2);
+ rbuf2=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint16)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint16_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1055,7 +1055,7 @@ test_select_point_copy(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- if(HDmemcmp(rbuf,rbuf2,sizeof(uint16)*SPACE3_DIM1*SPACE3_DIM2)) {
+ if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) {
printf("hyperslab values don't match!\n");
} /* end if */
@@ -1110,7 +1110,7 @@ test_select_hyper_offset(void)
hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
hssize_t offset[SPACE1_RANK]; /* Offset of selection */
- uint8 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -1123,13 +1123,13 @@ test_select_hyper_offset(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with Offsets\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1270,7 +1270,7 @@ test_select_point_offset(void)
hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
hssize_t offset[SPACE1_RANK]; /* Offset of selection */
- uint8 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -1282,13 +1282,13 @@ test_select_point_offset(void)
MESSAGE(5, ("Testing Element Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1448,7 +1448,7 @@ test_select_hyper_union(void)
{10,10,10,10,10,10,10,10, /* First eight rows are 10 long */
20,20, /* Next two rows are 20 long */
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15}; /* Next eighteen rows are 15 long */
- uint8 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -1460,13 +1460,13 @@ test_select_hyper_union(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2011,7 +2011,7 @@ test_select_hyper_union_3d(void)
{7,4,2,8},
{7,5,2,8},
{7,6,2,8}};
- uint8 *wbuf, /* buffer to write to disk */
+ uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf, /* temporary buffer pointer */
*tbuf2; /* temporary buffer pointer */
@@ -2023,14 +2023,14 @@ test_select_hyper_union_3d(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8)*SPACE4_DIM1*SPACE4_DIM2*SPACE4_DIM3);
- rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf=malloc(sizeof(uint8_t)*SPACE4_DIM1*SPACE4_DIM2*SPACE4_DIM3);
+ rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
for(j=0; j<SPACE4_DIM2; j++)
for(k=0; k<SPACE4_DIM3; k++)
- *tbuf++=(uint8)((((i*SPACE4_DIM2)+j)*SPACE4_DIM3)+k);
+ *tbuf++=(uint8_t)((((i*SPACE4_DIM2)+j)*SPACE4_DIM3)+k);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);