summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dtypes.c')
-rw-r--r--test/dtypes.c1307
1 files changed, 664 insertions, 643 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 9747af7..27ad8e7 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -23,7 +23,7 @@
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
/* Number of elements in each test */
-#define NTESTELEM 100000
+#define NTESTELEM 100000
/* For test_compound_8 and test_compound_10 */
#define ARRAY_DIM 4
@@ -32,7 +32,7 @@
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -118,22 +118,22 @@ 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 nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf,
- void *bkg, hid_t dset_xfer_plid);
+ void *bkg, hid_t dset_xfer_plid);
static int opaque_long(void);
static int opaque_funcs(void);
-
+
/*-------------------------------------------------------------------------
- * Function: reset_hdf5
+ * 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:
@@ -164,7 +164,7 @@ reset_hdf5(void)
}
-
+
/*-------------------------------------------------------------------------
* Function: test_classes
*
@@ -265,7 +265,7 @@ test_classes(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -286,7 +286,7 @@ static int
test_copy(void)
{
hid_t a_copy;
- herr_t status;
+ herr_t status;
TESTING("H5Tcopy()");
@@ -295,12 +295,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();
@@ -310,7 +310,7 @@ test_copy(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_detect
*
@@ -487,7 +487,7 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_1
*
@@ -651,19 +651,19 @@ error:
return retval;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_compound_2
+ * 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.
+ * Purpose: Tests a compound type conversion where the source and
+ * destination are the same except for the order of the
+ * elements.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
*
* Modifications:
@@ -674,19 +674,19 @@ 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;
+ 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;
+ int64_t nmembs;
+ int i;
TESTING("compound element reordering");
@@ -698,15 +698,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));
@@ -736,26 +736,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 */
@@ -782,19 +782,19 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_compound_3
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
*
* Modifications:
@@ -805,19 +805,19 @@ 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;
+ int a, c[4], e;
} *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;
+ 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;
+ int64_t nmembs;
+ int i;
TESTING("compound subset conversions");
@@ -866,24 +866,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 */
@@ -909,19 +909,19 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_compound_4
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
*
* Modifications:
@@ -933,22 +933,22 @@ 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;
- const hsize_t four = 4;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
+ 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;
+ int64_t nmembs;
+ int i;
TESTING("compound element shrinking & reordering");
@@ -999,26 +999,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 */
@@ -1044,20 +1044,20 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_compound_5
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
*
* Modifications:
@@ -1149,19 +1149,19 @@ test_compound_5(void)
return retval;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_compound_6
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Wednesday, December 13, 2000
*
* Modifications:
@@ -1181,11 +1181,11 @@ test_compound_6(void)
long d;
} *d_ptr;
- const size_t nelmts = NTESTELEM;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
- int64_t nmembs;
- int i;
+ const size_t nelmts = NTESTELEM;
+ unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
+ hid_t st=-1, dt=-1;
+ int64_t nmembs;
+ int i;
TESTING("compound element growing");
@@ -1226,18 +1226,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",
+ 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",
+ HDprintf(" dst={b=%ld, d=%ld\n",
d_ptr->b, d_ptr->d);
- goto error;
- }
+ goto error;
+ }
}
/* Release resources */
@@ -1264,17 +1264,17 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_compound_7
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, December 18, 2001
*
* Modifications:
@@ -1410,7 +1410,7 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_8
*
@@ -1656,7 +1656,7 @@ test_compound_8(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_9
*
@@ -1676,14 +1676,20 @@ test_compound_8(void)
static int
test_compound_9(void)
{
- typedef struct cmpd_struct {
+ typedef struct cmpd_struct_w {
int i1;
const char* str;
int i2;
- } cmpd_struct;
+ } cmpd_struct_w;
- cmpd_struct wdata = {11, "variable-length string", 22};
- cmpd_struct rdata;
+ typedef struct cmpd_struct_r {
+ int i1;
+ char* str;
+ int i2;
+ } cmpd_struct_r;
+
+ cmpd_struct_w wdata = {11, "variable-length string", 22};
+ cmpd_struct_r rdata;
hid_t file;
hid_t cmpd_tid, str_id, dup_tid;
hid_t space_id;
@@ -1702,13 +1708,13 @@ test_compound_9(void)
} /* end if */
/* Create first compound datatype */
- if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
+ if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_w))) < 0) {
H5_FAILED(); AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) {
+ if(H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct_w, i1), H5T_NATIVE_INT) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'i1'\n");
goto error;
@@ -1721,13 +1727,13 @@ test_compound_9(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, str), str_id) < 0) {
+ if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct_w, str), str_id) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'i1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) {
+ if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct_w, i2), H5T_NATIVE_INT) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'i2'\n");
goto error;
@@ -1878,7 +1884,7 @@ test_compound_9(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_10
*
@@ -2072,7 +2078,7 @@ test_compound_10(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_11
*
@@ -2315,7 +2321,7 @@ error:
return retval;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_12
*
@@ -2357,14 +2363,14 @@ test_compound_12(void)
size+=tmp_size;
if (H5Tset_size(complex_id, size) < 0) goto error;
if (H5Tinsert(complex_id, "real", offset,
- H5T_NATIVE_DOUBLE) < 0) goto error;
+ H5T_NATIVE_DOUBLE) < 0) goto error;
offset = size;
if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
size+=tmp_size;
if (H5Tset_size(complex_id, size) < 0) goto error;
if (H5Tinsert(complex_id, "imaginary", offset,
- H5T_NATIVE_DOUBLE) < 0) goto error;
+ H5T_NATIVE_DOUBLE) < 0) goto error;
/* Increase and decrease the size. */
if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
@@ -2398,7 +2404,7 @@ test_compound_12(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_13
*
@@ -2500,7 +2506,7 @@ error:
return 1;
} /* end test_compound_13() */
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_14
*
@@ -2523,27 +2529,42 @@ error:
static int
test_compound_14(void)
{
- typedef struct cmpd_struct_1 {
+ typedef struct cmpd_struct_1_w {
char c1;
char c2;
const char* str;
- } cmpd_struct_1;
+ } cmpd_struct_1_w;
- typedef struct cmpd_struct_2 {
+ typedef struct cmpd_struct_1_r {
char c1;
char c2;
char* str;
+ } cmpd_struct_1_r;
+
+ typedef struct cmpd_struct_2_w {
+ char c1;
+ char c2;
+ const char* str;
long l1;
long l2;
long l3;
long l4;
- } cmpd_struct_2;
+ } cmpd_struct_2_w;
- cmpd_struct_1 wdata1 = {'A', 'B', "variable-length string"};
+ typedef struct cmpd_struct_2_r {
+ char c1;
+ char c2;
+ char* str;
+ long l1;
+ long l2;
+ long l3;
+ long l4;
+ } cmpd_struct_2_r;
- cmpd_struct_1 rdata1;
- cmpd_struct_2 wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001};
- cmpd_struct_2 rdata2;
+ cmpd_struct_1_w wdata1 = {'A', 'B', "variable-length string"};
+ cmpd_struct_1_r rdata1;
+ cmpd_struct_2_w wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001};
+ cmpd_struct_2_r rdata2;
hid_t file;
hid_t cmpd_m1_tid, cmpd_f1_tid, cmpd_m2_tid, cmpd_f2_tid, str_id;
hid_t space_id;
@@ -2562,19 +2583,19 @@ test_compound_14(void)
} /* end if */
/* Create memory compound datatype 1 */
- if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1))) < 0) {
+ if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1_w))) < 0) {
H5_FAILED(); AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1,c1),H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1_w, c1), H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1,c2),H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1_w, c2), H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'c2'\n");
goto error;
@@ -2587,7 +2608,7 @@ test_compound_14(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1, str), str_id) < 0) {
+ if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1_w, str), str_id) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'vl_string'\n");
goto error;
@@ -2619,49 +2640,49 @@ test_compound_14(void)
} /* end if */
/* Create memory compound datatype 2 */
- if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2))) < 0) {
+ if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2_w))) < 0) {
H5_FAILED(); AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2,c1),H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2_w, c1), H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2,c2),H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2_w, c2), H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2, str), str_id) < 0) {
+ if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2_w, str), str_id) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'vl_string'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2,l1),H5T_NATIVE_LONG) < 0) {
+ if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2_w, l1), H5T_NATIVE_LONG) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'l1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2,l2),H5T_NATIVE_LONG) < 0) {
+ if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2_w, l2), H5T_NATIVE_LONG) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'l2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2,l3),H5T_NATIVE_LONG) < 0) {
+ if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2_w, l3), H5T_NATIVE_LONG) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'l3'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2,l4),H5T_NATIVE_LONG) < 0) {
+ if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2_w, l4), H5T_NATIVE_LONG) < 0) {
H5_FAILED(); AT();
HDprintf("Can't insert field 'l4'\n");
goto error;
@@ -2892,7 +2913,7 @@ test_compound_14(void)
return 1;
} /* end test_compound_14() */
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_15
*
@@ -3051,7 +3072,7 @@ test_compound_15(void)
return 1;
} /* end test_compound_15() */
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_16
*
@@ -3143,7 +3164,7 @@ error:
return 1;
} /* end test_compound_16() */
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_17
*
@@ -3266,7 +3287,7 @@ error:
return 1;
} /* end test_compound_17() */
-
+
/*-------------------------------------------------------------------------
* Function: test_compound_18
*
@@ -3332,7 +3353,7 @@ test_compound_18(void)
FAIL_PUTS_ERROR("created attribute with bad compound datatype")
} /* end if */
- /* Commit the datatype */
+ /* Commit the datatype */
H5E_BEGIN_TRY {
ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
@@ -3392,7 +3413,7 @@ error:
return 1;
} /* end test_compound_18() */
-
+
/*-------------------------------------------------------------------------
* Function: test_query
*
@@ -3638,17 +3659,17 @@ test_query(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_transient
+ * Function: test_transient
*
- * Purpose: Tests transient datatypes.
+ * Purpose: Tests transient datatypes.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 4, 1998
*
* Modifications:
@@ -3658,36 +3679,36 @@ test_query(void)
static int
test_transient (hid_t fapl)
{
- static hsize_t ds_size[2] = {10, 20};
- hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1;
- char filename[1024];
- hid_t ret_id; /* Generic hid_t return value */
- herr_t status;
+ static hsize_t ds_size[2] = {10, 20};
+ hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1;
+ char filename[1024];
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t status;
TESTING("transient datatypes");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
- goto error;
+ goto error;
}
if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error;
/* Predefined types cannot be modified or closed */
H5E_BEGIN_TRY {
- status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256);
+ status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256);
} H5E_END_TRY;
if (status>=0) {
- H5_FAILED();
- HDputs (" Predefined types should not be modifiable!");
- goto error;
+ H5_FAILED();
+ HDputs (" Predefined types should not be modifiable!");
+ goto error;
}
H5E_BEGIN_TRY {
- status = H5Tclose (H5T_NATIVE_INT);
+ status = H5Tclose (H5T_NATIVE_INT);
} H5E_END_TRY;
if (status>=0) {
- H5_FAILED();
- HDputs (" Predefined types should not be closable!");
- goto error;
+ H5_FAILED();
+ HDputs (" Predefined types should not be closable!");
+ goto error;
}
/* Copying a predefined type results in a modifiable copy */
@@ -3696,29 +3717,29 @@ test_transient (hid_t fapl)
/* It should not be possible to create an attribute for a transient type */
H5E_BEGIN_TRY {
- ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT);
+ ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
if (ret_id>=0) {
- H5_FAILED();
- HDputs (" Attributes should not be allowed for transient types!");
- goto error;
+ H5_FAILED();
+ HDputs (" Attributes should not be allowed for transient types!");
+ goto error;
}
/* Create a dataset from a transient datatype */
if(H5Tclose(type) < 0) goto error;
if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
if((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* The type returned from a dataset should not be modifiable */
if((t2 = H5Dget_type(dset)) < 0) goto error;
H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, (size_t)256);
+ status = H5Tset_precision(t2, (size_t)256);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs (" Dataset datatypes should not be modifiable!");
- goto error;
+ H5_FAILED();
+ HDputs (" Dataset datatypes should not be modifiable!");
+ goto error;
}
if(H5Tclose(t2) < 0) goto error;
@@ -3730,12 +3751,12 @@ test_transient (hid_t fapl)
if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error;
if((t2 = H5Dget_type(dset)) < 0) goto error;
H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, (size_t)256);
+ status = H5Tset_precision(t2, (size_t)256);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs (" Dataset datatypes should not be modifiable!");
- goto error;
+ H5_FAILED();
+ HDputs (" Dataset datatypes should not be modifiable!");
+ goto error;
}
if(H5Tclose(t2) < 0) goto error;
@@ -3758,26 +3779,26 @@ test_transient (hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose (t2);
- H5Tclose (type);
- H5Sclose (space);
- H5Dclose (dset);
- H5Fclose (file);
+ H5Tclose (t2);
+ H5Tclose (type);
+ H5Sclose (space);
+ H5Dclose (dset);
+ H5Fclose (file);
} H5E_END_TRY;
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_named
+ * Function: test_named
*
- * Purpose: Tests named datatypes.
+ * Purpose: Tests named datatypes.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, June 1, 1998
*
* Modifications:
@@ -3787,29 +3808,29 @@ test_transient (hid_t fapl)
static int
test_named (hid_t fapl)
{
- hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, t3=-1, attr1=-1;
- herr_t status;
- static hsize_t ds_size[2] = {10, 20};
- size_t i,j;
- unsigned attr_data[10][20];
- char filename[1024];
+ hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, t3=-1, attr1=-1;
+ herr_t status;
+ static hsize_t ds_size[2] = {10, 20};
+ size_t i,j;
+ unsigned attr_data[10][20];
+ char filename[1024];
TESTING("named datatypes");
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
- goto error;
+ goto error;
}
if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error;
/* Predefined types cannot be committed */
H5E_BEGIN_TRY {
- status = H5Tcommit2(file, "test_named_1 (should not exist)", H5T_NATIVE_INT, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Tcommit2(file, "test_named_1 (should not exist)", H5T_NATIVE_INT, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs (" Predefined types should not be committable!");
- goto error;
+ H5_FAILED();
+ HDputs (" Predefined types should not be committable!");
+ goto error;
}
/* Copy a predefined datatype and commit the copy */
@@ -3817,34 +3838,34 @@ test_named (hid_t fapl)
if(H5Tcommit2(file, "native-int", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) goto error;
if((status = H5Tcommitted(type)) < 0) goto error;
if(0 == status) {
- H5_FAILED();
- HDputs (" H5Tcommitted() returned false!");
- goto error;
+ H5_FAILED();
+ HDputs (" H5Tcommitted() returned false!");
+ goto error;
}
/* 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) {
- H5_FAILED();
- HDputs (" Committed type is not constant!");
- goto error;
+ H5_FAILED();
+ HDputs (" Committed type is not constant!");
+ goto error;
}
/* We should not be able to re-commit a committed type */
H5E_BEGIN_TRY {
- status = H5Tcommit2(file, "test_named_2 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Tcommit2(file, "test_named_2 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs (" Committed types should not be recommitted!");
- goto error;
+ H5_FAILED();
+ HDputs (" Committed types should not be recommitted!");
+ goto error;
}
/* It should be possible to define an attribute for the named type */
if((attr1 = H5Acreate2(type, "attr1", H5T_NATIVE_UCHAR, space,
- H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
for(i = 0; i < (size_t)ds_size[0]; i++)
for(j = 0; j < (size_t)ds_size[1]; j++)
attr_data[i][j] = (unsigned)(i * ds_size[1] + j);
@@ -3858,9 +3879,9 @@ test_named (hid_t fapl)
if((t2 = H5Tcopy(type)) < 0) goto error;
if((status = H5Tcommitted(t2)) < 0) goto error;
if(status) {
- H5_FAILED();
- HDputs (" Copying a named type should result in a transient type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Copying a named type should result in a transient type!");
+ goto error;
}
if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
if(H5Tclose(t2) < 0) goto error;
@@ -3873,22 +3894,22 @@ test_named (hid_t fapl)
FAIL_STACK_ERROR
if((status = H5Tcommitted(type)) < 0) goto error;
if(!status) {
- H5_FAILED();
- HDputs (" Opened named types should be named types!");
- goto error;
+ H5_FAILED();
+ HDputs (" Opened named types should be named types!");
+ goto error;
}
/* Create a dataset that uses the named type */
if((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Get the dataset's datatype and make sure it's a named type */
if((t2 = H5Dget_type(dset)) < 0) goto error;
if((status = H5Tcommitted(t2)) < 0) goto error;
if(!status) {
- H5_FAILED();
- HDputs (" Dataset type should be a named type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Dataset type should be a named type!");
+ goto error;
}
/* Close the dataset, then close its type, then reopen the dataset */
@@ -3900,9 +3921,9 @@ test_named (hid_t fapl)
if((t2 = H5Dget_type(dset)) < 0) goto error;
if((status = H5Tcommitted(t2)) < 0) goto error;
if(!status) {
- H5_FAILED();
- HDputs (" Dataset type should be a named type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Dataset type should be a named type!");
+ goto error;
}
/*
@@ -3919,9 +3940,9 @@ test_named (hid_t fapl)
if((t2 = H5Dget_type(dset)) < 0) goto error;
if((status = H5Tcommitted(t2)) < 0) goto error;
if(!status) {
- H5_FAILED();
- HDputs (" Dataset type should be a named type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Dataset type should be a named type!");
+ goto error;
}
if(H5Tclose(t2) < 0) goto error;
@@ -3940,17 +3961,17 @@ test_named (hid_t fapl)
if((t2 = H5Tcopy(type)) < 0) goto error;
if((status = H5Tcommitted(t2)) < 0) goto error;
if(status) {
- H5_FAILED();
- HDputs (" Copied type should not be a named type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Copied type should not be a named type!");
+ goto error;
}
if((dset = H5Dcreate2(file, "dset3", t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
if((t3 = H5Dget_type(dset)) < 0) goto error;
if((status = H5Tcommitted(t3)) < 0) goto error;
if(status) {
- H5_FAILED();
- HDputs (" Datatype from dataset using copied type should not be a named type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Datatype from dataset using copied type should not be a named type!");
+ goto error;
}
if(H5Tclose(t3) < 0) goto error;
if(H5Dclose(dset) < 0) goto error;
@@ -3995,26 +4016,26 @@ test_named (hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(t3);
- H5Tclose(t2);
- H5Tclose(type);
- H5Sclose(space);
- H5Dclose(dset);
- H5Fclose(file);
+ H5Tclose(t3);
+ H5Tclose(t2);
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Dclose(dset);
+ H5Fclose(file);
} H5E_END_TRY;
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: mkstr
+ * Function: mkstr
*
- * Purpose: Create a new string datatype
+ * Purpose: Create a new string datatype
*
- * Return: Success: New type
- * Failure: -1
+ * Return: Success: New type
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 10, 1998
*
*-------------------------------------------------------------------------
@@ -4022,7 +4043,7 @@ error:
static hid_t
mkstr(size_t len, H5T_str_t strpad)
{
- hid_t t;
+ hid_t t;
if((t = H5Tcopy(H5T_C_S1)) < 0)
return -1;
@@ -4034,16 +4055,16 @@ mkstr(size_t len, H5T_str_t strpad)
return t;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_str_create
+ * Function: test_str_create
*
- * Purpose: Test string type creation using H5Tcreate
+ * Purpose: Test string type creation using H5Tcreate
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 19 May 2011
*
*-------------------------------------------------------------------------
@@ -4084,10 +4105,10 @@ test_str_create(void)
if(!H5Tequal(vlen_str1, vlen_str2)) goto error;
if((is_vl_str = H5Tis_variable_str(vlen_str1)) < 0) goto error;
- if(!is_vl_str) goto error;
+ if(!is_vl_str) goto error;
if((is_vl_str = H5Tis_variable_str(vlen_str2)) < 0) goto error;
- if(!is_vl_str) goto error;
+ if(!is_vl_str) goto error;
if(H5Tclose(vlen_str1) < 0) goto error;
if(H5Tclose(vlen_str2) < 0) goto error;
@@ -4100,16 +4121,16 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_str_1
+ * Function: test_conv_str_1
*
- * Purpose: Test string conversions
+ * Purpose: Test string conversions
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 10, 1998
*
*-------------------------------------------------------------------------
@@ -4117,8 +4138,8 @@ error:
static int
test_conv_str_1(void)
{
- char *buf = NULL;
- hid_t src_type = -1;
+ char *buf = NULL;
+ hid_t src_type = -1;
hid_t dst_type = -1;
TESTING("string conversions");
@@ -4133,15 +4154,15 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Truncated C-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Truncated C-string test failed");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Extended C-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Extended C-string test failed");
+ goto error;
}
HDfree(buf);
buf = NULL;
@@ -4157,15 +4178,15 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Truncated C buffer test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Truncated C buffer test failed");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Extended C buffer test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Extended C buffer test failed");
+ goto error;
}
HDfree(buf);
buf = NULL;
@@ -4181,15 +4202,15 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Truncated Fortran-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Truncated Fortran-string test failed");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcde abcde ", (size_t)20)) {
- H5_FAILED();
- HDputs(" Extended Fortran-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Extended Fortran-string test failed");
+ goto error;
}
HDfree(buf);
buf = NULL;
@@ -4208,25 +4229,25 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Non-terminated string test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" Non-terminated string test 1");
+ goto error;
}
H5Tclose(dst_type);
if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Non-terminated string test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Non-terminated string test 2");
+ goto error;
}
HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", (size_t)20);
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Non-terminated string test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Non-terminated string test 2");
+ goto error;
}
HDfree(buf);
buf = NULL;
@@ -4242,30 +4263,30 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20)) {
- H5_FAILED();
- HDputs(" C string to Fortran test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" C string to Fortran test 1");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C string test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C string test 1");
+ goto error;
}
if (H5Tclose(dst_type) < 0) goto error;
if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" C string to Fortran test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" C string to Fortran test 2");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C string test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C string test 2");
+ goto error;
}
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
@@ -4274,15 +4295,15 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" C string to Fortran test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" C string to Fortran test 3");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C string test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C string test 3");
+ goto error;
}
HDfree(buf);
buf = NULL;
@@ -4298,30 +4319,30 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" C buffer to Fortran test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" C buffer to Fortran test 1");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C buffer test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C buffer test 1");
+ goto error;
}
if (H5Tclose(dst_type) < 0) goto error;
if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" C buffer to Fortran test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" C buffer to Fortran test 2");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C buffer test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C buffer test 2");
+ goto error;
}
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
@@ -4330,15 +4351,15 @@ test_conv_str_1(void)
HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" C buffer to Fortran test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" C buffer to Fortran test 3");
+ goto error;
}
if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C buffer test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C buffer test 3");
+ goto error;
}
if(H5Tclose(src_type) < 0) goto error;
if(H5Tclose(dst_type) < 0) goto error;
@@ -4354,7 +4375,7 @@ test_conv_str_1(void)
error:
H5E_BEGIN_TRY {
- H5Tclose(src_type);
+ H5Tclose(src_type);
H5Tclose(dst_type);
} H5E_END_TRY;
@@ -4369,16 +4390,16 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_str_2
+ * Function: test_conv_str_2
*
- * Purpose: Tests C-to-Fortran and Fortran-to-C string conversion speed.
+ * Purpose: Tests C-to-Fortran and Fortran-to-C string conversion speed.
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 10, 1998
*
*-------------------------------------------------------------------------
@@ -4386,12 +4407,12 @@ error:
static int
test_conv_str_2(void)
{
- char *buf = NULL, s[80];
- hid_t c_type = -1;
- hid_t f_type = -1;
- const size_t nelmts = NTESTELEM;
- size_t i, j, nchars;
- int ret_value = 1;
+ char *buf = NULL, s[80];
+ hid_t c_type = -1;
+ hid_t f_type = -1;
+ const size_t nelmts = NTESTELEM;
+ size_t i, j, nchars;
+ int ret_value = 1;
/*
* Initialize types and buffer.
@@ -4400,10 +4421,10 @@ test_conv_str_2(void)
if((f_type = mkstr((size_t)8, H5T_STR_SPACEPAD)) < 0) goto error;
if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8))) goto error;
for(i = 0; i < nelmts; i++) {
- nchars = (size_t)(HDrand() % 8);
- for(j = 0; j < nchars; j++)
- buf[i * 8 + j] = (char)('a' + HDrand() % 26);
- while(j < nchars)
+ nchars = (size_t)(HDrand() % 8);
+ for(j = 0; j < nchars; j++)
+ buf[i * 8 + j] = (char)('a' + HDrand() % 26);
+ while(j < nchars)
buf[i * 8 + j++] = '\0';
} /* end for */
@@ -4436,17 +4457,17 @@ error:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_str_3
+ * Function: test_conv_str_3
*
- * Purpose: Tests some functions that are or aren't supposed to work
+ * Purpose: Tests some functions that are or aren't supposed to work
* for string type.
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Tuesday, April 4, 2006
*
*-------------------------------------------------------------------------
@@ -4454,12 +4475,12 @@ error:
static int
test_conv_str_3(void)
{
- char *buf=NULL;
- hid_t type = -1;
- hid_t super = -1;
- const size_t nelmts = NTESTELEM;
- size_t i, j, nchars;
- int ret_value = 1;
+ char *buf=NULL;
+ hid_t type = -1;
+ hid_t super = -1;
+ const size_t nelmts = NTESTELEM;
+ size_t i, j, nchars;
+ int ret_value = 1;
size_t size;
H5T_pad_t inpad;
H5T_sign_t sign;
@@ -4475,10 +4496,10 @@ test_conv_str_3(void)
if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8)))
FAIL_PUTS_ERROR("Allocation failed.");
for(i = 0; i < nelmts; i++) {
- nchars = (size_t)(HDrand() % 8);
- for(j = 0; j < nchars; j++)
- buf[i * 8 + j] = (char)('a' + HDrand() % 26);
- while(j < nchars)
+ nchars = (size_t)(HDrand() % 8);
+ for(j = 0; j < nchars; j++)
+ buf[i * 8 + j] = (char)('a' + HDrand() % 26);
+ while(j < nchars)
buf[i * 8 + j++] = '\0';
} /* end for */
@@ -4541,7 +4562,7 @@ error:
H5Tclose(super);
} H5E_END_TRY;
- if(buf)
+ if(buf)
HDfree(buf);
if(tag)
H5free_memory(tag); /* Technically allocated by API call */
@@ -4554,17 +4575,17 @@ error:
return ret_value; /* Number of errors */
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_enum_1
+ * Function: test_conv_enum_1
*
- * Purpose: Test conversion speed for enum datatypes
+ * Purpose: Test conversion speed for enum datatypes
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, January 5, 1999
*
* Modifications:
@@ -4575,11 +4596,11 @@ static int
test_conv_enum_1(void)
{
const size_t nelmts=NTESTELEM;
- int i, val, *buf=NULL;
- hid_t t1 = -1;
- hid_t t2 = -1;
- char s[80];
- int ret_value = 1;
+ int i, val, *buf=NULL;
+ hid_t t1 = -1;
+ hid_t t2 = -1;
+ char s[80];
+ int ret_value = 1;
size_t u;
/* Build the datatypes */
@@ -4587,9 +4608,9 @@ test_conv_enum_1(void)
if((t2 = H5Tenum_create(H5T_NATIVE_INT)) < 0) goto error;
s[1] = '\0';
for(i = 0; i < 26; i++) {
- s[0] = (char)('A' + i);
- H5Tenum_insert(t1, s, &i);
- H5Tenum_insert(t2, s, (val = i * 1000 + i, &val));
+ s[0] = (char)('A' + i);
+ H5Tenum_insert(t1, s, &i);
+ H5Tenum_insert(t2, s, (val = i * 1000 + i, &val));
} /* end for */
/* Initialize the buffer */
@@ -4630,7 +4651,7 @@ error:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_conv_enum_2
*
@@ -4656,7 +4677,7 @@ test_conv_enum_2(void)
"PURPLE",
"ORANGE",
"WHITE" };
-
+
TESTING("non-native enumeration type conversion");
/* Source enum type */
@@ -4715,17 +4736,17 @@ test_conv_enum_2(void)
return 0;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_bitfield
+ * Function: test_conv_bitfield
*
- * Purpose: Test bitfield conversions.
+ * Purpose: Test bitfield conversions.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 20, 1999
*
* Modifications:
@@ -4735,8 +4756,8 @@ test_conv_enum_2(void)
static int
test_conv_bitfield(void)
{
- unsigned char buf[4];
- hid_t st=-1, dt=-1;
+ unsigned char buf[4];
+ hid_t st=-1, dt=-1;
TESTING("bitfield conversions");
@@ -4751,10 +4772,10 @@ 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();
- HDprintf(" 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;
}
/*
@@ -4770,10 +4791,10 @@ 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();
- HDprintf(" 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;
}
/*
@@ -4784,10 +4805,10 @@ 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();
- HDprintf(" 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);
@@ -4812,18 +4833,18 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_bitfield_funcs
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Wednesday, April 5, 2006
*
* Modifications:
@@ -4833,7 +4854,7 @@ error:
static int
test_bitfield_funcs(void)
{
- hid_t type=-1, ntype=-1, super=-1;
+ hid_t type=-1, ntype=-1, super=-1;
size_t size;
char* tag=0;
H5T_pad_t inpad;
@@ -4941,17 +4962,17 @@ error:
return retval;
}
-
+
/*-------------------------------------------------------------------------
- * Function: convert_opaque
+ * Function: convert_opaque
*
- * Purpose: A fake opaque conversion functions
+ * Purpose: A fake opaque conversion functions
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, June 4, 1999
*
* Modifications:
@@ -4960,25 +4981,25 @@ error:
*/
static herr_t
convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cdata,
- size_t H5_ATTR_UNUSED nelmts, size_t H5_ATTR_UNUSED buf_stride,
+ size_t H5_ATTR_UNUSED nelmts, size_t H5_ATTR_UNUSED buf_stride,
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)
+ void H5_ATTR_UNUSED *bkg, hid_t H5_ATTR_UNUSED dset_xfer_plid)
{
if (H5T_CONV_CONV==cdata->command) num_opaque_conversions_g++;
return 0;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_opaque
+ * Function: test_opaque
*
- * Purpose: Driver function to test opaque datatypes
+ * Purpose: Driver function to test opaque datatypes
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* June 2, 2004
*
* Modifications:
@@ -5011,17 +5032,17 @@ test_opaque(void)
return num_errors;
}
-
+
/*-------------------------------------------------------------------------
- * Function: opaque_check
+ * Function: opaque_check
*
- * Purpose: Test opaque datatypes
+ * Purpose: Test opaque datatypes
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 20, 1999
*
*-------------------------------------------------------------------------
@@ -5030,10 +5051,10 @@ static int
opaque_check(int tag_it)
{
#define OPAQUE_NELMTS 1000
- hid_t st=-1, dt=-1;
- herr_t status;
- char buf[1]; /*not really used*/
- int saved;
+ hid_t st=-1, dt=-1;
+ herr_t status;
+ char buf[1]; /*not really used*/
+ int saved;
saved = num_opaque_conversions_g = 0;
@@ -5049,29 +5070,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();
- HDprintf(" 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();
- HDprintf(" 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);
@@ -5084,16 +5105,16 @@ opaque_check(int tag_it)
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: opaque_long
+ * 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
*
*-------------------------------------------------------------------------
@@ -5101,8 +5122,8 @@ opaque_check(int tag_it)
static int
opaque_long(void)
{
- char *long_tag = NULL;
- hid_t dt = -1;
+ char *long_tag = NULL;
+ hid_t dt = -1;
herr_t ret;
/* Build opaque type */
@@ -5115,7 +5136,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
@@ -5136,18 +5157,18 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: opaque_funcs
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Wednesday, April 5, 2006
*
* Modifications:
@@ -5157,7 +5178,7 @@ error:
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;
@@ -5252,7 +5273,7 @@ opaque_funcs(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_encode
*
@@ -5293,7 +5314,7 @@ test_encode(void)
size_t enum_buf_size = 0;
size_t vlstr_buf_size = 0;
unsigned char *cmpd_buf=NULL, *enum_buf=NULL, *vlstr_buf=NULL;
- hid_t ret_id;
+ hid_t ret_id;
herr_t ret;
TESTING("functions of encoding and decoding datatypes");
@@ -5394,7 +5415,7 @@ test_encode(void)
/* Try decoding bogus buffer */
H5E_BEGIN_TRY {
- ret_id = H5Tdecode(cmpd_buf);
+ ret_id = H5Tdecode(cmpd_buf);
} H5E_END_TRY;
if(ret_id!=FAIL) {
H5_FAILED();
@@ -5706,39 +5727,39 @@ test_encode(void)
*/
/* Make sure the reference counts for the decoded datatypes are one. */
- if(H5Iget_ref(decoded_tid1) != 1) {
+ if(H5Iget_ref(decoded_tid1) != 1) {
H5_FAILED();
HDprintf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- if(H5Iget_ref(decoded_tid2) != 1) {
+ if(H5Iget_ref(decoded_tid2) != 1) {
H5_FAILED();
HDprintf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- if(H5Iget_ref(decoded_tid3) != 1) {
+ if(H5Iget_ref(decoded_tid3) != 1) {
H5_FAILED();
HDprintf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- /* Make sure the reference counts for the decoded datatypes can be
+ /* Make sure the reference counts for the decoded datatypes can be
* decremented and the datatypes are closed. */
- if(H5Idec_ref(decoded_tid1) != 0) {
+ if(H5Idec_ref(decoded_tid1) != 0) {
H5_FAILED();
HDprintf("Decoded datatype can't close\n");
goto error;
} /* end if */
- if(H5Idec_ref(decoded_tid2) != 0) {
+ if(H5Idec_ref(decoded_tid2) != 0) {
H5_FAILED();
HDprintf("Decoded datatype can't close\n");
goto error;
} /* end if */
- if(H5Idec_ref(decoded_tid3) != 0) {
+ if(H5Idec_ref(decoded_tid3) != 0) {
H5_FAILED();
HDprintf("Decoded datatype can't close\n");
goto error;
@@ -5746,7 +5767,7 @@ test_encode(void)
/* Make sure the decoded datatypes are already closed. */
H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid1);
+ ret = H5Tclose(decoded_tid1);
} H5E_END_TRY;
if(ret!=FAIL) {
H5_FAILED();
@@ -5755,7 +5776,7 @@ test_encode(void)
}
H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid2);
+ ret = H5Tclose(decoded_tid2);
} H5E_END_TRY;
if(ret!=FAIL) {
H5_FAILED();
@@ -5764,7 +5785,7 @@ test_encode(void)
}
H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid3);
+ ret = H5Tclose(decoded_tid3);
} H5E_END_TRY;
if(ret!=FAIL) {
H5_FAILED();
@@ -5818,7 +5839,7 @@ test_encode(void)
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_latest
*
@@ -5845,7 +5866,7 @@ test_latest(void)
hid_t file = (-1); /* File ID */
hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */
hid_t fapl = (-1); /* File access property list */
- H5O_info_t oi; /* Stat buffer for committed datatype */
+ H5O_info_t oi; /* Stat buffer for committed datatype */
hsize_t old_dtype_oh_size; /* Size of object header with "old" format */
hsize_t new_dtype_oh_size; /* Size of object header with "new" format */
char filename[1024]; /* Buffer for filename */
@@ -6036,7 +6057,7 @@ conv_except(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
return(H5T_CONV_UNHANDLED);
}
-
+
/*-------------------------------------------------------------------------
* Function: test_int_float_except
*
@@ -6179,7 +6200,7 @@ error:
#endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
} /* end test_int_float_except() */
-
+
/*-------------------------------------------------------------------------
* Function: test_set_order
*
@@ -6340,11 +6361,11 @@ error:
return 1;
} /* end test_set_order() */
-
+
/*-------------------------------------------------------------------------
* Function: test_set_order_compound
*
- * Purpose: Tests H5Tset_order/H5Tget_order for complicated compound
+ * Purpose: Tests H5Tset_order/H5Tget_order for complicated compound
* type.
*
* Return: Success: 0
@@ -6376,13 +6397,13 @@ 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");
if((memb_cmpd = H5Tcreate(H5T_COMPOUND, sizeof(atomic_cmpd))) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR
if(H5Tinsert(memb_cmpd, "c", HOFFSET(atomic_cmpd, c), H5T_NATIVE_CHAR) < 0) FAIL_STACK_ERROR
if(H5Tinsert(memb_cmpd, "s", HOFFSET(atomic_cmpd, s), H5T_NATIVE_SHORT) < 0) FAIL_STACK_ERROR
if(H5Tinsert(memb_cmpd, "f", HOFFSET(atomic_cmpd, f), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
@@ -6402,19 +6423,19 @@ test_set_order_compound(hid_t fapl)
/* Create a compound type using the types above. */
if((cmpd = H5Tcreate(H5T_COMPOUND, sizeof(complex_cmpd))) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0) FAIL_STACK_ERROR
/* The order should be mixed now. */
- if(H5Tget_order(cmpd) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+ if(H5Tget_order(cmpd) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
/* Create an array of the compound type above */
cmpd_array = H5Tarray_create2(cmpd, 2, dims);
/* The order of the array type should be the same as the compound type */
- if(H5Tget_order(cmpd_array) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+ if(H5Tget_order(cmpd_array) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
/* Verify that the order can't be 'none'. */
H5E_BEGIN_TRY
@@ -6432,13 +6453,13 @@ test_set_order_compound(hid_t fapl)
if(H5Tset_order(cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR
/* Verify that the order of the compound type is big-endian */
- if(H5Tget_order(cmpd) != H5T_ORDER_BE) FAIL_STACK_ERROR
+ if(H5Tget_order(cmpd) != H5T_ORDER_BE) FAIL_STACK_ERROR
/* Change the order of the array type to little-endian*/
if(H5Tset_order(cmpd_array, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR
/* Verify that the order of the array type is little-endian */
- if(H5Tget_order(cmpd_array) != H5T_ORDER_LE) FAIL_STACK_ERROR
+ if(H5Tget_order(cmpd_array) != H5T_ORDER_LE) FAIL_STACK_ERROR
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
@@ -6473,23 +6494,23 @@ error:
H5Tclose(vl_id);
H5Tclose(cmpd);
H5Tclose(cmpd_array);
- H5Fclose(file);
+ H5Fclose(file);
H5E_END_TRY;
return 1;
} /* end test_set_order_compound() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_named_indirect_reopen
+ * 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
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Neil Fortner
+ * Programmer: Neil Fortner
* Thursday, June 4, 2009
*
* Modifications:
@@ -6499,13 +6520,13 @@ error:
static int
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};
+ 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];
+ char filename[1024];
TESTING("indirectly reopening committed datatypes");
@@ -6669,12 +6690,12 @@ test_named_indirect_reopen(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(type);
- H5Tclose(strtype);
- H5Tclose(reopened_type);
- H5Sclose(space);
- H5Dclose(dset);
- H5Fclose(file);
+ H5Tclose(type);
+ H5Tclose(strtype);
+ H5Tclose(reopened_type);
+ H5Sclose(space);
+ H5Dclose(dset);
+ H5Fclose(file);
} H5E_END_TRY;
if(tag_ret)
H5free_memory(tag_ret);
@@ -6682,18 +6703,18 @@ error:
} /* end test_named_indirect_reopen() */
/*-------------------------------------------------------------------------
- * Function: test_named_indirect_reopen_file
+ * Function: test_named_indirect_reopen_file
*
- * Purpose: Tests that a named compound datatype that refers to a named
+ * Purpose: Tests that a named compound datatype that refers to a named
* string datatype can be reopened indirectly through H5Dget_type,
* and shows the correct H5Tcommitted() state, including after the
* file has been closed and reopened.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Mark Hodson
+ * Programmer: Mark Hodson
* Tuesday, March 17, 2015
*
* Modifications:
@@ -6756,7 +6777,7 @@ test_named_indirect_reopen_file(hid_t fapl)
/* Indirectly reopen string type, verify that they report as committed, and the size doesn't change */
if((reopened_strtype = H5Tget_member_type(reopened_cmptype, 0)) < 0) TEST_ERROR
if(strtype_size != H5Tget_size(reopened_strtype)) TEST_ERROR
- if(H5Tcommitted(reopened_strtype) != 1) TEST_ERROR
+ if(H5Tcommitted(reopened_strtype) != 1) TEST_ERROR
/* Close types and dataset */
if(H5Tclose(reopened_strtype) < 0) TEST_ERROR
@@ -6799,13 +6820,13 @@ test_named_indirect_reopen_file(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(cmptype);
- H5Tclose(strtype);
- H5Tclose(reopened_cmptype);
+ H5Tclose(cmptype);
+ H5Tclose(strtype);
+ H5Tclose(reopened_cmptype);
H5Tclose(reopened_strtype);
- H5Sclose(space);
- H5Dclose(dset);
- H5Fclose(file);
+ H5Sclose(space);
+ H5Dclose(dset);
+ H5Fclose(file);
} H5E_END_TRY;
return 1;
} /* end test_named_indirect_reopen() */
@@ -6910,17 +6931,17 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
HDassert(status >= 0);
} /* end create_del_obj_named_test_file() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_delete_obj_named
+ * Function: test_delete_obj_named
*
- * Purpose: Tests that delete objects that use named datatypes through
+ * Purpose: Tests that delete objects that use named datatypes through
* different file IDs
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, July 18, 2011
*
*-------------------------------------------------------------------------
@@ -6991,27 +7012,27 @@ 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() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_delete_obj_named_fileid
+ * Function: test_delete_obj_named_fileid
*
- * Purpose: Tests that objects that use named datatypes through
+ * Purpose: Tests that objects that use named datatypes through
* different file IDs get the correct file IDs
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, July 28, 2011
*
*-------------------------------------------------------------------------
@@ -7147,26 +7168,26 @@ test_delete_obj_named_fileid(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_fileid() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_deprec
+ * 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
*
*-------------------------------------------------------------------------
@@ -7175,17 +7196,17 @@ error:
static int
test_deprec(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t type = -1; /* Datatype ID */
+ hid_t file = -1; /* File ID */
+ hid_t type = -1; /* Datatype ID */
unsigned rank = 2; /* Rank for array datatype */
hsize_t dims[2] = {3, 3}; /* Dimensions for array datatype */
int perm[2] = {0, 1}; /* Dimensions permutations for array datatype */
hsize_t rdims[2]= {0, 0}; /* Dimensions for querying array datatype */
int rperm[2] = {-2, -2}; /* Dimensions permutations for array datatype */
hbool_t dim_mismatch; /* Whether any dimensions didn't match */
- char filename[1024];
+ char filename[1024];
unsigned u; /* Local index variable */
- herr_t status; /* Generic routine value */
+ herr_t status; /* Generic routine value */
TESTING("deprected API routines for datatypes");
@@ -7213,7 +7234,7 @@ test_deprec(hid_t fapl)
dim_mismatch = TRUE;
} /* end if */
if(dim_mismatch)
- FAIL_PUTS_ERROR(" Dimensions didn't match!")
+ FAIL_PUTS_ERROR(" Dimensions didn't match!")
/* Check the array dimension permutations */
dim_mismatch = FALSE;
@@ -7223,7 +7244,7 @@ test_deprec(hid_t fapl)
dim_mismatch = TRUE;
} /* end if */
if(dim_mismatch)
- FAIL_PUTS_ERROR(" Dimension permutations modified!")
+ FAIL_PUTS_ERROR(" Dimension permutations modified!")
/* Close the datatype */
if(H5Tclose(type) < 0)
@@ -7236,31 +7257,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.
@@ -7269,7 +7290,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
@@ -7299,24 +7320,24 @@ 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() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
+
/*-------------------------------------------------------------------------
- * Function: test_utf_ascii_conv
+ * 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
*-------------------------------------------------------------------------
*/
@@ -7334,12 +7355,12 @@ test_utf_ascii_conv(void)
char *ascii_r = NULL;
const char *ascii_w = "bar!";
char *utf8_r = NULL;
- char filename[1024];
+ char filename[1024];
char ascii2[4], utf8_2[4];
herr_t status;
TESTING("string conversion between ASCII and UTF");
-
+
/************************************************
* Test VL string conversion from UTF8 to ASCII
************************************************/
@@ -7506,20 +7527,20 @@ 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;
}
-
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -7539,8 +7560,8 @@ error:
int
main(void)
{
- long nerrors = 0;
- hid_t fapl = -1;
+ long nerrors = 0;
+ hid_t fapl = -1;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -7549,7 +7570,7 @@ main(void)
fapl = h5_fileaccess();
if(ALIGNMENT)
- HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
+ HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
/* Do the tests */
nerrors += test_classes();