summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-07-31 18:40:29 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-07-31 18:40:29 (GMT)
commit08dca47475f41e93348cf0c2ea708e787c232014 (patch)
treee50f08ecd29b8363082c6ef9134b8e1987b02822 /test/dtypes.c
parent50f404c887118577034c6412aeaaa1f6db2fe475 (diff)
downloadhdf5-08dca47475f41e93348cf0c2ea708e787c232014.zip
hdf5-08dca47475f41e93348cf0c2ea708e787c232014.tar.gz
hdf5-08dca47475f41e93348cf0c2ea708e787c232014.tar.bz2
Minor normalizations with hdf5_1_10
Diffstat (limited to 'test/dtypes.c')
-rw-r--r--test/dtypes.c598
1 files changed, 262 insertions, 336 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 0f95830..6dfc47d 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -134,10 +134,8 @@ typedef enum {
static int num_opaque_conversions_g = 0;
static int opaque_check(int tag_it);
-static herr_t convert_opaque(hid_t st, hid_t dt,
- H5T_cdata_t *cdata,
- size_t nelmts, size_t buf_stride,
- size_t bkg_stride, void *_buf,
+static herr_t convert_opaque(hid_t st, hid_t dt, H5T_cdata_t *cdata,
+ size_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf,
void *bkg, hid_t dset_xfer_plid);
static int opaque_long(void);
static int opaque_funcs(void);
@@ -146,16 +144,13 @@ static int opaque_funcs(void);
/*-------------------------------------------------------------------------
* Function: reset_hdf5
*
- * Purpose: Reset the hdf5 library. This causes statistics to be printed
- * and counters to be reset.
+ * Purpose: Reset the hdf5 library. This causes statistics to be printed
+ * and counters to be reset.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, November 16, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -189,14 +184,10 @@ reset_hdf5(void)
* Purpose: Test type classes
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -290,20 +281,16 @@ test_classes(void)
* Purpose: Are we able to copy a datatype?
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_copy(void)
{
- hid_t a_copy;
+ hid_t a_copy;
herr_t status;
TESTING("H5Tcopy()");
@@ -313,12 +300,12 @@ test_copy(void)
/* We should not be able to close a built-in byte */
H5E_BEGIN_TRY {
- status = H5Tclose (H5T_NATIVE_SCHAR);
+ status = H5Tclose (H5T_NATIVE_SCHAR);
} H5E_END_TRY;
if (status>=0) {
- H5_FAILED();
- HDputs (" Should not be able to close a predefined type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Should not be able to close a predefined type!");
+ goto error;
}
PASSED();
@@ -336,7 +323,6 @@ test_copy(void)
* in nested types)
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Quincey Koziol
@@ -512,14 +498,10 @@ error:
* Purpose: Tests various things about compound datatypes.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -673,38 +655,34 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_2
*
- * Purpose: Tests a compound type conversion where the source and
- * destination are the same except for the order of the
- * elements.
- *
- * Return: Success: 0
+ * Purpose: Tests a compound type conversion where the source and
+ * destination are the same except for the order of the
+ * elements.
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_compound_2(void)
{
struct st {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} *s_ptr;
struct dt {
- int e, d, c[4], b, a;
+ int e, d, c[4], b, a;
} *d_ptr;
const size_t nelmts = NTESTELEM;
- const hsize_t four = 4;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
- hid_t array_dt;
- int64_t nmembs;
- int i;
+ const hsize_t four = 4;
+ unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
+ hid_t st=-1, dt=-1;
+ hid_t array_dt;
+ int64_t nmembs;
+ int i;
TESTING("compound element reordering");
@@ -716,15 +694,15 @@ test_compound_2(void)
bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ s_ptr->a = i*8+0;
+ s_ptr->b = i*8+1;
+ s_ptr->c[0] = i*8+2;
+ s_ptr->c[1] = i*8+3;
+ s_ptr->c[2] = i*8+4;
+ s_ptr->c[3] = i*8+5;
+ s_ptr->d = i*8+6;
+ s_ptr->e = i*8+7;
}
HDmemcpy(buf, orig, nelmts*sizeof(struct st));
@@ -754,26 +732,26 @@ test_compound_2(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->d, d_ptr->e);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->b != d_ptr->b ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
+ s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
+ d_ptr->c[3], d_ptr->d, d_ptr->e);
+ goto error;
+ }
}
/* Release resources */
@@ -804,29 +782,25 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_3
*
- * Purpose: Tests compound conversions where the source and destination
- * are the same except the destination is missing a couple
- * members which appear in the source.
+ * Purpose: Tests compound conversions where the source and destination
+ * are the same except the destination is missing a couple
+ * members which appear in the source.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_compound_3(void)
{
struct st {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} *s_ptr;
- struct dt {
- int a, c[4], e;
+ struct dt {
+ int a, c[4], e;
} *d_ptr;
const size_t nelmts = NTESTELEM;
@@ -884,24 +858,24 @@ test_compound_3(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
- d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->e);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
+ s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
+ d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
+ d_ptr->c[3], d_ptr->e);
+ goto error;
+ }
}
/* Release resources */
@@ -931,19 +905,15 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_4
*
- * Purpose: Tests compound conversions when the destination has the same
- * fields as the source but one or more of the fields are
- * smaller.
+ * Purpose: Tests compound conversions when the destination has the same
+ * fields as the source but one or more of the fields are
+ * smaller.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -951,13 +921,13 @@ test_compound_4(void)
{
struct st {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} *s_ptr;
struct dt {
- short b;
- int a, c[4];
- short d;
- int e;
+ short b;
+ int a, c[4];
+ short d;
+ int e;
} *d_ptr;
const size_t nelmts = NTESTELEM;
@@ -1017,26 +987,26 @@ test_compound_4(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->d, d_ptr->e);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->b != d_ptr->b ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
+ s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
+ d_ptr->c[3], d_ptr->d, d_ptr->e);
+ goto error;
+ }
}
/* Release resources */
@@ -1066,20 +1036,16 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_5
*
- * Purpose: Many versions of HDF5 have a bug in the optimized compound
+ * Purpose: Many versions of HDF5 have a bug in the optimized compound
* datatype conversion function, H5T_conv_struct_opt(), which
* is triggered when the top-level type contains a struct
* which must undergo a conversion.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1156,7 +1122,8 @@ test_compound_5(void)
src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
src[1].coll_ids[3]!=dst[1].coll_ids[3]) {
H5_FAILED();
- } else {
+ }
+ else {
PASSED();
retval = 0;
}
@@ -1171,19 +1138,15 @@ test_compound_5(void)
/*-------------------------------------------------------------------------
* Function: test_compound_6
*
- * Purpose: Tests compound conversions when the destination has the same
- * fields as the source but one or more of the fields are
- * larger.
+ * Purpose: Tests compound conversions when the destination has the same
+ * fields as the source but one or more of the fields are
+ * larger.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Wednesday, December 13, 2000
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1244,18 +1207,18 @@ test_compound_6(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->b != d_ptr->b ||
- s_ptr->d != d_ptr->d) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={b=%d, d=%d\n",
- (int)s_ptr->b, (int)s_ptr->d);
- HDprintf(" dst={b=%ld, d=%ld\n",
- d_ptr->b, d_ptr->d);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->b != d_ptr->b ||
+ s_ptr->d != d_ptr->d) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={b=%d, d=%d\n",
+ (int)s_ptr->b, (int)s_ptr->d);
+ HDprintf(" dst={b=%ld, d=%ld\n",
+ d_ptr->b, d_ptr->d);
+ goto error;
+ }
}
/* Release resources */
@@ -1284,15 +1247,14 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_7
*
- * Purpose: Tests inserting fields into compound datatypes when the field
+ * Purpose: Tests inserting fields into compound datatypes when the field
* overlaps the end of the compound datatype. Also, tests
* increasing compound type size.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, December 18, 2001
*
* Modifications:
@@ -1686,9 +1648,6 @@ test_compound_8(void)
*
* Programmer: Raymond Lu
* Wednesday, June 9, 2004
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4758,17 +4717,13 @@ test_conv_enum_2(void)
/*-------------------------------------------------------------------------
* Function: test_conv_bitfield
*
- * Purpose: Test bitfield conversions.
- *
- * Return: Success: 0
+ * Purpose: Test bitfield conversions.
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 20, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4790,10 +4745,9 @@ test_conv_bitfield(void)
buf[2] = buf[3] = 0x55; /*irrelevant*/
if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) {
- H5_FAILED();
- printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n",
- buf[3], buf[2], buf[1], buf[0]);
- goto error;
+ H5_FAILED();
+ HDprintf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]);
+ goto error;
}
/*
@@ -4809,10 +4763,9 @@ test_conv_bitfield(void)
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) {
- H5_FAILED();
- printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n",
- buf[3], buf[2], buf[1], buf[0]);
- goto error;
+ H5_FAILED();
+ HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]);
+ goto error;
}
/*
@@ -4823,10 +4776,9 @@ test_conv_bitfield(void)
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) {
- H5_FAILED();
- printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n",
- buf[3], buf[2], buf[1], buf[0]);
- goto error;
+ H5_FAILED();
+ HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]);
+ goto error;
}
H5Tclose(st);
@@ -4855,18 +4807,14 @@ error:
/*-------------------------------------------------------------------------
* Function: test_bitfield_funcs
*
- * Purpose: Test some datatype functions that are and aren't supposed
+ * Purpose: Test some datatype functions that are and aren't supposed
* work for bitfield type.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Wednesday, April 5, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4984,17 +4932,13 @@ error:
/*-------------------------------------------------------------------------
* Function: convert_opaque
*
- * Purpose: A fake opaque conversion functions
- *
- * Return: Success: 0
+ * Purpose: A fake opaque conversion functions
*
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, June 4, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -5003,7 +4947,8 @@ convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cd
size_t H5_ATTR_UNUSED bkg_stride, void H5_ATTR_UNUSED *_buf,
void H5_ATTR_UNUSED *bkg, hid_t H5_ATTR_UNUSED dset_xfer_plid)
{
- if (H5T_CONV_CONV==cdata->command) num_opaque_conversions_g++;
+ if (H5T_CONV_CONV==cdata->command)
+ num_opaque_conversions_g++;
return 0;
}
@@ -5011,17 +4956,13 @@ convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cd
/*-------------------------------------------------------------------------
* Function: test_opaque
*
- * Purpose: Driver function to test opaque datatypes
- *
- * Return: Success: 0
+ * Purpose: Driver function to test opaque datatypes
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* June 2, 2004
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -5054,25 +4995,23 @@ test_opaque(void)
/*-------------------------------------------------------------------------
* Function: opaque_check
*
- * Purpose: Test opaque datatypes
- *
- * Return: Success: 0
+ * Purpose: Test opaque datatypes
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 20, 1999
- *
*-------------------------------------------------------------------------
*/
static int
opaque_check(int tag_it)
{
#define OPAQUE_NELMTS 1000
- hid_t st=-1, dt=-1;
+ hid_t st=-1, dt=-1;
herr_t status;
- char buf[1]; /*not really used*/
- int saved;
+ char buf[1]; /*not really used*/
+ int saved;
saved = num_opaque_conversions_g = 0;
@@ -5088,29 +5027,29 @@ opaque_check(int tag_it)
/* Make sure that we can't convert between the types yet */
H5E_BEGIN_TRY {
- status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
+ status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
- H5_FAILED();
- printf(" opaque conversion should have failed but succeeded\n");
- goto error;
+ H5_FAILED();
+ HDprintf(" opaque conversion should have failed but succeeded\n");
+ goto error;
}
/* Register a conversion function */
if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0)
- goto error;
+ goto error;
/* Try the conversion again, this time it should work */
if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (saved+1 != num_opaque_conversions_g) {
- H5_FAILED();
- printf(" unexpected number of opaque conversions\n");
- goto error;
+ H5_FAILED();
+ HDprintf(" unexpected number of opaque conversions\n");
+ goto error;
}
/* Unregister conversion function */
if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0)
- goto error;
+ goto error;
H5Tclose(st);
H5Tclose(dt);
@@ -5127,12 +5066,12 @@ opaque_check(int tag_it)
/*-------------------------------------------------------------------------
* Function: opaque_long
*
- * Purpose: Test named (committed) opaque datatypes w/very long tags
+ * Purpose: Test named (committed) opaque datatypes w/very long tags
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 14, 2005
*
*-------------------------------------------------------------------------
@@ -5142,7 +5081,7 @@ opaque_long(void)
{
char *long_tag = NULL;
hid_t dt = -1;
- herr_t ret;
+ herr_t ret;
/* Build opaque type */
if((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
@@ -5154,7 +5093,7 @@ opaque_long(void)
/* Set opaque type's tag */
H5E_BEGIN_TRY {
- ret = H5Tset_tag(dt, long_tag);
+ ret = H5Tset_tag(dt, long_tag);
} H5E_END_TRY;
if(ret != FAIL) TEST_ERROR
@@ -5179,24 +5118,20 @@ error:
/*-------------------------------------------------------------------------
* Function: opaque_funcs
*
- * Purpose: Test some type functions that are and aren't supposed to
+ * Purpose: Test some type functions that are and aren't supposed to
* work with opaque type.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Wednesday, April 5, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
opaque_funcs(void)
{
- hid_t type = -1, super=-1;
+ hid_t type = -1, super=-1;
size_t size;
H5T_pad_t inpad;
H5T_cset_t cset;
@@ -5803,7 +5738,7 @@ test_encode(void)
}
H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid3);
+ ret = H5Tclose(decoded_tid3);
} H5E_END_TRY;
if(ret!=FAIL) {
H5_FAILED();
@@ -6102,14 +6037,13 @@ static int
test_int_float_except(void)
{
#if H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4
- float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f,
- (float)INT_MAX - 68.0f, (float)4.5f};
- int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4};
+ float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f, (float)4.5f};
+ int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4};
float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
- int *intp; /* Pointer to buffer, as integers */
- int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
+ int *intp; /* Pointer to buffer, as integers */
+ int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
- int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
+ int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
float *floatp; /* Pointer to buffer #2, as floats */
hid_t dxpl; /* Dataset transfer property list */
except_info_t e; /* Exception information */
@@ -6165,8 +6099,8 @@ test_int_float_except(void)
/* Convert second buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE,
- buf2, NULL, dxpl) < 0) TEST_ERROR
+ if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
+ TEST_ERROR
/* Check the buffer after conversion, as floats */
for(u = 0; u < CONVERT_SIZE; u++) {
@@ -6183,8 +6117,8 @@ test_int_float_except(void)
/* Convert buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE,
- buf2, NULL, dxpl) < 0) TEST_ERROR
+ if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
+ TEST_ERROR
/* Check the buffer after conversion, as integers */
for(u = 0; u < CONVERT_SIZE; u++) {
@@ -6415,7 +6349,7 @@ test_set_order_compound(hid_t fapl)
hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1;
hid_t vl_id = -1;
hsize_t dims[2] = {3, 4}; /* Array dimenstions */
- char filename[1024];
+ char filename[1024];
herr_t ret; /* Generic return value */
TESTING("H5Tset/get_order for compound type");
@@ -6521,18 +6455,14 @@ error:
/*-------------------------------------------------------------------------
* Function: test_named_indirect_reopen
*
- * Purpose: Tests that open named datatypes can be reopened indirectly
+ * Purpose: Tests that open named datatypes can be reopened indirectly
* through H5Dget_type without causing problems.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Neil Fortner
+ * Programmer: Neil Fortner
* Thursday, June 4, 2009
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -6540,11 +6470,11 @@ test_named_indirect_reopen(hid_t fapl)
{
hid_t file=-1, type=-1, reopened_type=-1, strtype=-1, dset=-1, space=-1;
static hsize_t dims[1] = {3};
- size_t dt_size;
- int enum_value;
- const char *tag = "opaque_tag";
- char *tag_ret = NULL;
- char filename[1024];
+ size_t dt_size;
+ int enum_value;
+ const char *tag = "opaque_tag";
+ char *tag_ret = NULL;
+ char filename[1024];
TESTING("indirectly reopening committed datatypes");
@@ -6708,11 +6638,11 @@ test_named_indirect_reopen(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(type);
- H5Tclose(strtype);
- H5Tclose(reopened_type);
- H5Sclose(space);
- H5Dclose(dset);
+ H5Tclose(type);
+ H5Tclose(strtype);
+ H5Tclose(reopened_type);
+ H5Sclose(space);
+ H5Dclose(dset);
H5Fclose(file);
} H5E_END_TRY;
if(tag_ret)
@@ -6912,12 +6842,12 @@ test_delete_obj_named(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(attr);
- H5Dclose(dset);
- H5Pclose(fapl2);
- H5Fclose(filea1);
- H5Fclose(filea2);
- H5Fclose(fileb);
+ H5Tclose(attr);
+ H5Dclose(dset);
+ H5Pclose(fapl2);
+ H5Fclose(filea1);
+ H5Fclose(filea2);
+ H5Fclose(fileb);
} H5E_END_TRY;
return 1;
} /* end test_delete_obj_named() */
@@ -7075,15 +7005,15 @@ test_delete_obj_named_fileid(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Aclose(attr);
- H5Tclose(type);
- H5Dclose(dset);
- H5Pclose(fapl2);
- H5Fclose(filea1);
- H5Fclose(filea2);
- H5Fclose(fileb);
- H5Fclose(attr_fid);
- H5Fclose(type_fid);
+ H5Aclose(attr);
+ H5Tclose(type);
+ H5Dclose(dset);
+ H5Pclose(fapl2);
+ H5Fclose(filea1);
+ H5Fclose(filea2);
+ H5Fclose(fileb);
+ H5Fclose(attr_fid);
+ H5Fclose(type_fid);
} H5E_END_TRY;
return 1;
} /* end test_delete_obj_named_fileid() */
@@ -7092,12 +7022,12 @@ error:
/*-------------------------------------------------------------------------
* Function: test_deprec
*
- * Purpose: Tests deprecated API routines for datatypes.
+ * Purpose: Tests deprecated API routines for datatypes.
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, September 27, 2007
*
*-------------------------------------------------------------------------
@@ -7167,31 +7097,31 @@ test_deprec(hid_t fapl)
/* Predefined types cannot be committed */
H5E_BEGIN_TRY {
- status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT);
+ status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT);
} H5E_END_TRY;
if(status >= 0)
- FAIL_PUTS_ERROR(" Predefined types should not be committable!")
+ FAIL_PUTS_ERROR(" Predefined types should not be committable!")
/* Copy a predefined datatype and commit the copy */
if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
if(H5Tcommit1(file, "native-int", type) < 0) FAIL_STACK_ERROR
if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR
if(0 == status)
- FAIL_PUTS_ERROR(" H5Tcommitted() returned false!")
+ FAIL_PUTS_ERROR(" H5Tcommitted() returned false!")
/* We should not be able to modify a type after it has been committed. */
H5E_BEGIN_TRY {
- status = H5Tset_precision(type, (size_t)256);
+ status = H5Tset_precision(type, (size_t)256);
} H5E_END_TRY;
if(status >= 0)
- FAIL_PUTS_ERROR(" Committed type is not constant!")
+ FAIL_PUTS_ERROR(" Committed type is not constant!")
/* We should not be able to re-commit a committed type */
H5E_BEGIN_TRY {
- status = H5Tcommit1(file, "test_named_2 (should not exist)", type);
+ status = H5Tcommit1(file, "test_named_2 (should not exist)", type);
} H5E_END_TRY;
if(status >= 0)
- FAIL_PUTS_ERROR(" Committed types should not be recommitted!")
+ FAIL_PUTS_ERROR(" Committed types should not be recommitted!")
/*
* Close the committed type and reopen it. It should return a named type.
@@ -7200,7 +7130,7 @@ test_deprec(hid_t fapl)
if((type = H5Topen1(file, "native-int")) < 0) FAIL_STACK_ERROR
if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR
if(!status)
- FAIL_PUTS_ERROR(" Opened named types should be named types!")
+ FAIL_PUTS_ERROR(" Opened named types should be named types!")
/* Close */
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
@@ -7230,8 +7160,8 @@ test_deprec(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(type);
- H5Fclose(file);
+ H5Tclose(type);
+ H5Fclose(file);
} H5E_END_TRY;
return 1;
} /* end test_deprec() */
@@ -7241,13 +7171,13 @@ error:
/*-------------------------------------------------------------------------
* Function: test_utf_ascii_conv
*
- * Purpose: Make sure the library doesn't conversion strings between
+ * Purpose: Make sure the library doesn't conversion strings between
* ASCII and UTF8.
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 10 November 2011
*-------------------------------------------------------------------------
*/
@@ -7437,13 +7367,13 @@ test_utf_ascii_conv(void)
error:
H5E_BEGIN_TRY {
- H5Tclose(utf8_vtid);
- H5Tclose(ascii_vtid);
- H5Tclose(utf8_tid);
- H5Tclose(ascii_tid);
- H5Dclose(did);
- H5Sclose(sid);
- H5Fclose(fid);
+ H5Tclose(utf8_vtid);
+ H5Tclose(ascii_vtid);
+ H5Tclose(utf8_tid);
+ H5Tclose(ascii_tid);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
}
@@ -7827,16 +7757,13 @@ error:
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
main(void)
{
long nerrors = 0;
- hid_t fapl = -1;
+ hid_t fapl = H5I_INVALID_HID;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -7845,7 +7772,7 @@ main(void)
fapl = h5_fileaccess();
if(ALIGNMENT)
- printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
+ HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
/* Do the tests */
nerrors += test_classes();
@@ -7900,8 +7827,7 @@ main(void)
nerrors += test_versionbounds();
if(nerrors) {
- HDprintf("***** %lu FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
+ HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S");
HDexit(EXIT_FAILURE);
}