summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5HP.c3
-rw-r--r--src/H5MFaggr.c2
-rw-r--r--src/H5SL.c16
-rw-r--r--src/H5Tbit.c67
-rw-r--r--src/H5Tconv.c8
-rw-r--r--src/H5Tpkg.h4
-rw-r--r--src/H5private.h16
-rw-r--r--test/cross_read.c324
-rw-r--r--test/gen_cross.c4
-rw-r--r--test/gen_deflate.c112
-rw-r--r--test/gen_file_image.c71
-rw-r--r--test/h5test.c2
-rw-r--r--test/istore.c6
-rw-r--r--test/pool.c2
-rw-r--r--test/tattr.c40
-rw-r--r--test/tconfig.c4
17 files changed, 363 insertions, 320 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index f95b607..c33b85f 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -183,7 +183,7 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
* which was always at least H5HG_ALIGNMENT aligned then we could just
* align the pointer, but this might not be the case.
*/
- n = H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk);
+ n = (size_t)H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk);
#ifdef OLD_WAY
/* Don't bother zeroing out the rest of the info in the heap -QAK */
HDmemset(p, 0, n);
diff --git a/src/H5HP.c b/src/H5HP.c
index f6fb20c..78e9e5b 100644
--- a/src/H5HP.c
+++ b/src/H5HP.c
@@ -848,7 +848,8 @@ H5HP_decr(H5HP_t *heap, unsigned amt, void *_obj)
HDassert(obj_loc>0 && obj_loc<=heap->nobjs);
/* Change the heap object's priority */
- heap->heap[obj_loc].val-=amt;
+ H5_CHECK_OVERFLOW(amt, unsigned, int);
+ heap->heap[obj_loc].val-=(int)amt;
/* Restore heap condition */
if(heap->type==H5HP_MAX_HEAP) {
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 40f3ac0..f2c5936 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -414,7 +414,7 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type,
/* If the aggregator is at the end of file: */
if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) {
/* If extra_requested is below percentage threshold, extend block into the aggregator. */
- if(extra_requested <= (EXTEND_THRESHOLD * aggr->size)) {
+ if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) {
aggr->size -= extra_requested;
aggr->addr += extra_requested;
diff --git a/src/H5SL.c b/src/H5SL.c
index 1cd64ec..f9d7654 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -1286,12 +1286,12 @@ done:
void *
H5SL_remove_first(H5SL_t *slist)
{
- void *ret_value = NULL; /* Return value */
- H5SL_node_t *head = slist->header; /* Skip list header */
- H5SL_node_t *tmp = slist->header->forward[0]; /* Temporary node pointer */
- H5SL_node_t *next; /* Next node to search for */
- size_t level = slist->curr_level; /* Skip list level */
- size_t i; /* Index */
+ void *ret_value = NULL; /* Return value */
+ H5SL_node_t *head = slist->header; /* Skip list header */
+ H5SL_node_t *tmp = slist->header->forward[0]; /* Temporary node pointer */
+ H5SL_node_t *next; /* Next node to search for */
+ size_t level; /* Skip list level */
+ size_t i; /* Index */
FUNC_ENTER_NOAPI_NOINIT
@@ -1301,6 +1301,10 @@ H5SL_remove_first(H5SL_t *slist)
/* Not currently supported */
HDassert(!slist->safe_iterating);
+ /* Assign level */
+ H5_CHECK_OVERFLOW(slist->curr_level, int, size_t);
+ level = (size_t)slist->curr_level;
+
/* Check internal consistency */
/* (Pre-condition) */
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index 8c53066..a6b917f 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -514,22 +514,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T__bit_inc
+ * Function: H5T__bit_inc
*
- * Purpose: Increment part of a bit field by adding 1. The bit field
+ * Purpose: Increment part of a bit field by adding 1. The bit field
* starts with bit position START and is SIZE bits long.
*
- * Return: Success: The carry-out value. One if overflows,
- * zero otherwise.
- *
- * Failure: Negative
+ * Return: The carry-out value. TRUE if overflows, FALSE otherwise.
*
* Programmer: Robb Matzke
* Friday, June 26, 1998
*
*-------------------------------------------------------------------------
*/
-htri_t
+hbool_t
H5T__bit_inc(uint8_t *buf, size_t start, size_t size)
{
size_t idx = start / 8;
@@ -545,38 +542,38 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size)
/* The first partial byte */
if(start) {
- if(size + start < 8)
+ if(size + start < 8)
mask = ((unsigned)1 << size) - 1;
- else
+ else
mask = ((unsigned)1 << (8 - start)) - 1;
- acc = ((unsigned)buf[idx] >> start) & mask;
- acc++;
- carry = acc & ((unsigned)1 << MIN(size, 8 - start));
- buf[idx] &= (uint8_t)(~(mask << start));
- buf[idx] = (uint8_t)(buf[idx] | ((acc & mask) << start));
- size -= MIN(size, 8 - start);
- start = 0;
- idx++;
+ acc = ((unsigned)buf[idx] >> start) & mask;
+ acc++;
+ carry = acc & ((unsigned)1 << MIN(size, 8 - start));
+ buf[idx] &= (uint8_t)(~(mask << start));
+ buf[idx] = (uint8_t)(buf[idx] | ((acc & mask) << start));
+ size -= MIN(size, 8 - start);
+ start = 0;
+ idx++;
} /* end if */
/* The middle */
while(carry && size >= 8) {
- acc = buf[idx];
- acc++;
- carry = acc & 0x100;
- buf[idx] = acc & 0xff;
- idx++;
- size -= 8;
+ acc = buf[idx];
+ acc++;
+ carry = acc & 0x100;
+ buf[idx] = acc & 0xff;
+ idx++;
+ size -= 8;
} /* end while */
/* The last bits */
if(carry && size > 0) {
- mask = ((unsigned)1 << size) - 1;
- acc = buf[idx] & mask;
- acc++;
- carry = acc & ((unsigned)1 << size);
- buf[idx] &= (uint8_t)(~mask);
- buf[idx] |= (uint8_t)(acc & mask);
+ mask = ((unsigned)1 << size) - 1;
+ acc = buf[idx] & mask;
+ acc++;
+ carry = acc & ((unsigned)1 << size);
+ buf[idx] &= (uint8_t)(~mask);
+ buf[idx] |= (uint8_t)(acc & mask);
} /* end if */
FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE)
@@ -586,20 +583,18 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size)
/*-------------------------------------------------------------------------
* Function: H5T__bit_dec
*
- * Purpose: decrement part of a bit field by substracting 1. The bit
+ * Purpose: Decrement part of a bit field by substracting 1. The bit
* field starts with bit position START and is SIZE bits long.
*
- * Return: Success: The "borrow-in" value. It's one if underflows,
- * zero otherwise.
+ * Return: The "borrow-in" value. It's TRUE if underflows, FALSE
+ * otherwise.
*
- * Failure: Negative
- *
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* March 17, 2004
*
*-------------------------------------------------------------------------
*/
-htri_t
+hbool_t
H5T__bit_dec(uint8_t *buf, size_t start, size_t size)
{
size_t idx = start / 8;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 8b96d22..23ccd98 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -4032,7 +4032,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t mpos; /*offset to useful mant is src */
uint64_t sign; /*source sign bit value */
size_t mrsh; /*amount to right shift mantissa*/
- hbool_t carry = 0; /*carry after rounding mantissa */
+ hbool_t carry = FALSE; /*carry after rounding mantissa */
size_t i; /*miscellaneous counters */
size_t implied; /*destination implied bits */
hbool_t denormalized = FALSE; /*is either source or destination denormalized?*/
@@ -4408,7 +4408,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Don't do rounding if exponent is 111...110 and mantissa is 111...11.
* To do rounding and increment exponent in this case will create an infinity value.*/
if((H5T__bit_find(s, mpos + (size_t)bitno, msize - (size_t)bitno, H5T_BIT_LSB, FALSE) >= 0 || expo < expo_max - 1)) {
- carry = (hbool_t)H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
+ carry = H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
if(carry)
implied = 2;
}
@@ -4417,7 +4417,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
}
else
- carry=0;
+ carry = FALSE;
/*
* Write the mantissa to the destination
@@ -4480,7 +4480,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
}
/*reset CARRY*/
- carry = 0;
+ carry = FALSE;
H5_CHECK_OVERFLOW(expo,hssize_t,hsize_t);
H5T__bit_set_d(d, dst.u.f.epos, dst.u.f.esize, (hsize_t)expo);
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 0bd1e06..49b0ea0 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -1288,8 +1288,8 @@ H5_DLL void H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size,
uint64_t val);
H5_DLL ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size,
H5T_sdir_t direction, hbool_t value);
-H5_DLL htri_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size);
-H5_DLL htri_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size);
+H5_DLL hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size);
+H5_DLL hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size);
H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size);
/* VL functions */
diff --git a/src/H5private.h b/src/H5private.h
index e0ed6ef..d400469 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1515,7 +1515,7 @@ extern char *strdup(const char *s);
#define H5_CHECK_OVERFLOW(var, vartype, casttype) \
{ \
casttype _tmp_overflow = (casttype)(var); \
- assert((var) == (vartype)_tmp_overflow); \
+ HDassert((var) == (vartype)_tmp_overflow); \
}
#else /* NDEBUG */
#define H5_CHECK_OVERFLOW(var, vartype, casttype)
@@ -1529,7 +1529,7 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_src == (srctype)_tmp_dst); \
+ HDassert(_tmp_src == (srctype)_tmp_dst); \
(dst) = _tmp_dst; \
}
@@ -1540,8 +1540,8 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_src >= 0); \
- assert(_tmp_src == _tmp_dst); \
+ HDassert(_tmp_src >= 0); \
+ HDassert(_tmp_src == _tmp_dst); \
(dst) = _tmp_dst; \
}
@@ -1552,8 +1552,8 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_dst >= 0); \
- assert(_tmp_src == (srctype)_tmp_dst); \
+ HDassert(_tmp_dst >= 0); \
+ HDassert(_tmp_src == (srctype)_tmp_dst); \
(dst) = _tmp_dst; \
}
@@ -1561,8 +1561,8 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_src >= 0); \
- assert(_tmp_src == (srctype)_tmp_dst); \
+ HDassert(_tmp_src >= 0); \
+ HDassert(_tmp_src == (srctype)_tmp_dst); \
(dst) = _tmp_dst; \
}
diff --git a/test/cross_read.c b/test/cross_read.c
index b2fae89..8df81f0 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -64,9 +64,9 @@ const char *FILENAME[] = {
/*-------------------------------------------------------------------------
- * Function: open_dataset
+ * Function: check_data_i
*
- * Purpose: Read and compare the data from a dataset.
+ * Purpose: Read and compare the integer data from a dataset.
*
* Return: Success: 0
* Failure: 1
@@ -74,112 +74,143 @@ const char *FILENAME[] = {
* Programmer: Raymond Lu
* 17 May 2011
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number)
+static int
+check_data_i(const char *dsetname, hid_t fid)
{
- hid_t dataset; /* handles */
- double data_in[NX+1][NY]; /* input buffer */
- double data_out[NX+1][NY]; /* output buffer */
- long long int_data_in[NX+1][NY]; /* input buffer */
- long long int_data_out[NX+1][NY]; /* output buffer */
- int i, j;
- unsigned nerrors = 0;
-
- /*
- * Open the regular dataset.
+ hid_t did = -1; /* dataset ID */
+ long long data_in[NX+1][NY]; /* input buffer */
+ long long data_out[NX+1][NY]; /* output buffer */
+ int i, j; /* iterators */
+ int nerrors = 0; /* # errors in dataset values */
+
+ /* Open the dataset. */
+ if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Initialization. */
+ /* Input (last row is different) */
+ for(i = 0; i < NX; i++)
+ for(j = 0; j < NY; j++)
+ data_in[i][j] = i + j;
+ for(i = 0; i < NY; i++)
+ data_in[NX][i] = -2;
+ /* Output */
+ HDmemset(data_out, 0, (NX+1) * NY * sizeof(long long));
+
+ /* Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
*/
- if((dataset = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ if(H5Dread(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Check results */
+ for(i = 0; i < (NX + 1); i++)
+ for(j = 0; j < NY; j++)
+ if(data_out[i][j] != data_in[i][j])
+ if(!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %lld but should have been %lld\n",
+ (int)i, (int)j, data_out[i][j], data_in[i][j]);
+ } /* end if */
+
+ /* Close/release resources. */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
- /*
- * Data and output buffer initialization.
- */
- for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++) {
- data_in[j][i] = ((double)(i + j + 1))/3;
- data_out[j][i] = 0.0F;
-
- int_data_in[j][i] = i + j;
- int_data_out[j][i] = 0;
- }
- }
- for (i = 0; i < NY; i++) {
- data_in[NX][i] = -2.2F;
- data_out[NX][i] = 0.0F;
+ /* Failure */
+ if(nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY));
+ return 1;
+ } /* end if */
+
+ PASSED();
+ return 0;
- int_data_in[NX][i] = -2;
- int_data_out[NX][i] = 0;
- }
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ } H5E_END_TRY;
+ return 1;
+} /* end check_data_i() */
- /*
- * Read data from hyperslab in the file into the hyperslab in
+
+/*-------------------------------------------------------------------------
+ * Function: check_data_f
+ *
+ * Purpose: Read and compare the floating-point data from a dataset.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Raymond Lu
+ * 17 May 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+check_data_f(const char *dsetname, hid_t fid)
+{
+ hid_t did = -1; /* dataset ID */
+ double data_in[NX+1][NY]; /* input buffer */
+ double data_out[NX+1][NY]; /* output buffer */
+ int i, j; /* iterators */
+ int nerrors = 0; /* # of errors in dataset values */
+
+ /* Open the dataset. */
+ if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Initialization. */
+ /* Input (last row is different) */
+ for(i = 0; i < NX; i++)
+ for(j = 0; j < NY; j++)
+ data_in[i][j] = ((double)(i + j + 1)) / (double)3.0F;
+ for(i = 0; i < NY; i++)
+ data_in[NX][i] = -2.2F;
+ /* Output */
+ HDmemset(data_out, 0, (NX+1) * NY * sizeof(double));
+
+ /* Read data from hyperslab in the file into the hyperslab in
* memory and display.
*/
- if(floating_number) {
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- data_out) < 0)
- TEST_ERROR;
-
- /* Check results */
- for (j=0; j<(NX+1); j++) {
- for (i=0; i<NY; i++) {
- if (!H5_DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001F)) {
- if (!nerrors++) {
- H5_FAILED();
- printf("element [%d][%d] is %g but should have been %g\n",
- j, i, data_out[j][i], data_in[j][i]);
- }
- }
- }
- }
- } else {
- if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- int_data_out) < 0)
- TEST_ERROR;
-
- /* Check results */
- for (j=0; j<(NX+1); j++) {
- for (i=0; i<NY; i++) {
- if (int_data_out[j][i] != int_data_in[j][i]) {
- if (!nerrors++) {
- H5_FAILED();
- printf("element [%d][%d] is %d but should have been %d\n",
- j, i, (int)int_data_out[j][i],
- (int)int_data_in[j][i]);
- }
- }
- }
- }
- }
-
- /*
- * Close/release resources.
- */
- if(H5Dclose(dataset) < 0)
- TEST_ERROR
+ if(H5Dread(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Check results */
+ for(i = 0; i < (NX + 1); i++)
+ for(j = 0; j < NY; j++)
+ if(!H5_DBL_REL_EQUAL(data_out[i][j], data_in[i][j], (double)0.001F))
+ if(!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %g but should have been %g\n",
+ (int)i, (int)j, data_out[i][j], data_in[i][j]);
+ } /* end if */
+
+ /* Close/release resources. */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Failure */
- if (nerrors) {
- printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ if(nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY));
return 1;
- }
+ } /* end if */
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Dclose(dataset);
+ H5Dclose(did);
} H5E_END_TRY;
return 1;
-}
+} /* end check_data_f() */
/*-------------------------------------------------------------------------
- * Function: open_dataset
+ * Function: check_file
*
* Purpose: Handle each dataset from the data file.
*
@@ -189,125 +220,122 @@ error:
* Programmer: Raymond Lu
* 21 January 2011
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static int open_dataset(char *fname)
+static int
+check_file(char *filename)
{
- const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */
- hid_t file; /* handles */
- unsigned nerrors = 0;
- const char *not_supported= " filter is not enabled.";
+ const char *pathname = H5_get_srcdir_filename(filename); /* Corrected test file name */
+ hid_t fid = -1; /* file ID */
+ int nerrors = 0; /* # of datasets with errors */
+ const char *not_supported= " filter is not enabled."; /* no filter message */
- /*
- * Open the file.
- */
- if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ /* Open the file. */
+ if((fid = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
TESTING("regular dataset of LE DOUBLE");
- nerrors += check_data(DATASETNAME, file, TRUE);
+ nerrors += check_data_f(DATASETNAME, fid);
TESTING("regular dataset of BE DOUBLE");
- nerrors += check_data(DATASETNAME1, file, TRUE);
+ nerrors += check_data_f(DATASETNAME1, fid);
TESTING("dataset of LE FLOAT with scale-offset filter");
- nerrors += check_data(DATASETNAME2, file, TRUE);
+ nerrors += check_data_f(DATASETNAME2, fid);
TESTING("dataset of BE FLOAT with scale-offset filter");
- nerrors += check_data(DATASETNAME3, file, TRUE);
+ nerrors += check_data_f(DATASETNAME3, fid);
TESTING("dataset of LE DOUBLE with scale-offset filter");
- nerrors += check_data(DATASETNAME4, file, TRUE);
+ nerrors += check_data_f(DATASETNAME4, fid);
TESTING("dataset of BE DOUBLE with scale-offset filter");
- nerrors += check_data(DATASETNAME5, file, TRUE);
+ nerrors += check_data_f(DATASETNAME5, fid);
TESTING("dataset of LE CHAR with scale-offset filter");
- nerrors += check_data(DATASETNAME6, file, FALSE);
+ nerrors += check_data_i(DATASETNAME6, fid);
TESTING("dataset of BE CHAR with scale-offset filter");
- nerrors += check_data(DATASETNAME7, file, FALSE);
+ nerrors += check_data_i(DATASETNAME7, fid);
TESTING("dataset of LE SHORT with scale-offset filter");
- nerrors += check_data(DATASETNAME8, file, FALSE);
+ nerrors += check_data_i(DATASETNAME8, fid);
TESTING("dataset of BE SHORT with scale-offset filter");
- nerrors += check_data(DATASETNAME9, file, FALSE);
+ nerrors += check_data_i(DATASETNAME9, fid);
TESTING("dataset of LE INT with scale-offset filter");
- nerrors += check_data(DATASETNAME10, file, FALSE);
+ nerrors += check_data_i(DATASETNAME10, fid);
TESTING("dataset of BE INT with scale-offset filter");
- nerrors += check_data(DATASETNAME11, file, FALSE);
+ nerrors += check_data_i(DATASETNAME11, fid);
TESTING("dataset of LE LONG LONG with scale-offset filter");
- nerrors += check_data(DATASETNAME12, file, FALSE);
+ nerrors += check_data_i(DATASETNAME12, fid);
TESTING("dataset of BE LONG LONG with scale-offset filter");
- nerrors += check_data(DATASETNAME13, file, FALSE);
+ nerrors += check_data_i(DATASETNAME13, fid);
TESTING("dataset of LE FLOAT with Fletcher32 filter");
- nerrors += check_data(DATASETNAME14, file, TRUE);
+ nerrors += check_data_f(DATASETNAME14, fid);
TESTING("dataset of BE FLOAT with Fletcher32 filter");
- nerrors += check_data(DATASETNAME15, file, TRUE);
+ nerrors += check_data_f(DATASETNAME15, fid);
TESTING("dataset of LE FLOAT with Deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- nerrors += check_data(DATASETNAME16, file, TRUE);
+ nerrors += check_data_f(DATASETNAME16, fid);
#else /*H5_HAVE_FILTER_DEFLATE*/
SKIPPED();
- puts(not_supported);
+ HDputs(not_supported);
#endif /*H5_HAVE_FILTER_DEFLATE*/
TESTING("dataset of BE FLOAT with Deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- nerrors += check_data(DATASETNAME17, file, TRUE);
+ nerrors += check_data_f(DATASETNAME17, fid);
#else /*H5_HAVE_FILTER_DEFLATE*/
SKIPPED();
- puts(not_supported);
+ HDputs(not_supported);
#endif /*H5_HAVE_FILTER_DEFLATE*/
TESTING("dataset of LE FLOAT with Szip filter");
#ifdef H5_HAVE_FILTER_SZIP
- nerrors += check_data(DATASETNAME18, file, TRUE);
+ nerrors += check_data_f(DATASETNAME18, fid);
#else /*H5_HAVE_FILTER_SZIP*/
SKIPPED();
- puts(not_supported);
+ HDputs(not_supported);
#endif /*H5_HAVE_FILTER_SZIP*/
TESTING("dataset of BE FLOAT with Szip filter");
#ifdef H5_HAVE_FILTER_SZIP
- nerrors += check_data(DATASETNAME19, file, TRUE);
+ nerrors += check_data_f(DATASETNAME19, fid);
#else /*H5_HAVE_FILTER_SZIP*/
SKIPPED();
- puts(not_supported);
+ HDputs(not_supported);
#endif /*H5_HAVE_FILTER_SZIP*/
TESTING("dataset of LE FLOAT with Shuffle filter");
- nerrors += check_data(DATASETNAME20, file, TRUE);
+ nerrors += check_data_f(DATASETNAME20, fid);
TESTING("dataset of BE FLOAT with Shuffle filter");
- nerrors += check_data(DATASETNAME21, file, TRUE);
+ nerrors += check_data_f(DATASETNAME21, fid);
TESTING("dataset of LE FLOAT with Nbit filter");
- nerrors += check_data(DATASETNAME22, file, TRUE);
+ nerrors += check_data_f(DATASETNAME22, fid);
TESTING("dataset of BE FLOAT with Nbit filter");
- nerrors += check_data(DATASETNAME23, file, TRUE);
+ nerrors += check_data_f(DATASETNAME23, fid);
- if(H5Fclose(file))
- TEST_ERROR
- return 0;
+ if(H5Fclose(fid))
+ FAIL_STACK_ERROR
+ return nerrors;
error:
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Fclose(fid);
} H5E_END_TRY;
return nerrors;
-}
+} /* end check_file() */
/*-------------------------------------------------------------------------
@@ -315,35 +343,37 @@ error:
*
* Purpose: Tests reading files created on LE and BE systems.
*
- * Return: Success: exit(0)
- * Failure: exit(1)
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Raymond Lu
* Thursday, March 23, 2006
*
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
char filename[1024];
- unsigned nerrors = 0;
+ int nerrors = 0;
h5_reset();
- puts("Testing reading data created on Linux");
- h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
- nerrors += open_dataset(filename);
+ HDputs("\n");
+ HDputs("Testing reading data created on Linux");
+ h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename));
+ nerrors += check_file(filename);
- puts("Testing reading data created on Solaris");
- h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename);
- nerrors += open_dataset(filename);
+ HDputs("\n");
+ HDputs("Testing reading data created on Solaris");
+ h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof(filename));
+ nerrors += check_file(filename);
- if (nerrors) {
- printf("***** %u FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
- HDexit(1);
- }
+ if(nerrors) {
+ printf("***** %d FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
+ return EXIT_FAILURE;
+ } /* end if */
printf("All data type tests passed.\n");
- return 0;
-}
+ return EXIT_SUCCESS;
+} /* end main() */
+
diff --git a/test/gen_cross.c b/test/gen_cross.c
index 816064d..d7c424a 100644
--- a/test/gen_cross.c
+++ b/test/gen_cross.c
@@ -401,7 +401,7 @@ create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid)
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = i + j;
+ data[j][i] = (char)(i + j);
}
/*
* 0 1 2 3 4 5
@@ -500,7 +500,7 @@ create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid)
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = i + j;
+ data[j][i] = (short)(i + j);
}
/*
* 0 1 2 3 4 5
diff --git a/test/gen_deflate.c b/test/gen_deflate.c
index 2d0b746..3a9370d 100644
--- a/test/gen_deflate.c
+++ b/test/gen_deflate.c
@@ -14,16 +14,18 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, November 14, 2002
*
- * Purpose: Create a dataset compressed with the deflate filter.
- * This program is used to create the test file `tdeflate.h5' which has
- * a dataset compressed with the "deflate" I/O filter. This dataset will
- * be used to verify the correct behavior of the library when a filter is
- * not available for a dataset which requires it.
+ * Purpose: Create a dataset compressed with the deflate filter.
+ * This program is used to create the test file `tdeflate.h5'
+ * which has a dataset compressed with the "deflate" I/O filter.
+ * This dataset will be used to verify the correct behavior of
+ * the library when a filter is not available for a dataset which
+ * requires it.
*/
-#include "hdf5.h"
+
+#include "h5test.h"
#define TESTFILE "deflate.h5"
@@ -34,80 +36,86 @@
#define CHUNK_DIM1 50
#define CHUNK_DIM2 50
-/* Dataset data */
-int data[SPACE_DIM1][SPACE_DIM2];
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose:
- *
- * Return: Success:
- *
- * Failure:
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Quincey Koziol
* Thursday, November 14, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
main(void)
{
- hid_t file, space, dset, dcpl;
- hsize_t dims[SPACE_RANK]={SPACE_DIM1,SPACE_DIM2};
- hsize_t chunk_dims[SPACE_RANK]={CHUNK_DIM1,CHUNK_DIM2};
- size_t i,j; /* Local index variables */
+ hid_t fid = -1, sid = -1, did = -1, dcpl_id = -1;
+ hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
+ hsize_t chunk_dims[SPACE_RANK] = {CHUNK_DIM1, CHUNK_DIM2};
+ size_t i,j; /* Local index variables */
+ int *data = NULL; /* Dataset data */
/* Initialize the data */
/* (Try for something easily compressible) */
- for(i=0; i<SPACE_DIM1; i++)
- for(j=0; j<SPACE_DIM2; j++)
- data[i][j] = (int)(j % 5);
+ if(NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
+ TEST_ERROR
+
+ for(i = 0; i < SPACE_DIM1; i++)
+ for(j = 0; j < SPACE_DIM2; j++)
+ data[(i * SPACE_DIM2) + j] = (int)(j % 5);
/* Create the file */
- file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
- printf("file<0!\n");
+ if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataspace */
- space = H5Screate_simple(SPACE_RANK, dims, NULL);
- if(space<0)
- printf("space<0!\n");
+ if((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl<0)
- printf("dcpl<0!\n");
+ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set up for deflated data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims)<0)
- printf("H5Pset_chunk() failed!\n");
- if(H5Pset_deflate(dcpl, 9)<0)
- printf("H5Pset_deflate() failed!\n");
+ if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_deflate(dcpl_id, 9) < 0)
+ FAIL_STACK_ERROR
/* Create the compressed dataset */
- dset = H5Dcreate2(file, "Dataset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if(dset<0)
- printf("dset<0!\n");
+ if((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data)<0)
- printf("H5Dwrite() failed!\n");
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Pclose(dcpl)<0)
- printf("H5Pclose() failed!\n");
- if(H5Dclose(dset)<0)
- printf("H5Dclose() failed!\n");
- if(H5Sclose(space)<0)
- printf("H5Sclose() failed!\n");
- if(H5Fclose(file)<0)
- printf("H5Fclose() failed!\n");
-
- return 0;
-}
+ if(H5Pclose(dcpl_id) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ HDfree(data);
+
+ return EXIT_SUCCESS;
+
+error:
+ if(data)
+ HDfree(data);
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl_id);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/gen_file_image.c b/test/gen_file_image.c
index bc9de29..0637473 100644
--- a/test/gen_file_image.c
+++ b/test/gen_file_image.c
@@ -14,13 +14,13 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, March 30, 2012
*
- * Purpose: Create a simple file for use with the file image tests.
+ * Purpose: Create a simple file for use with the file image tests.
*
*/
-#include "hdf5.h"
+#include "h5test.h"
#define TESTFILE "file_image_core_test.h5"
@@ -29,18 +29,11 @@
#define SPACE_DIM1 128
#define SPACE_DIM2 32
-/* Dataset data */
-int data[SPACE_DIM1][SPACE_DIM2];
-
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose:
- *
- * Return: Success:
- *
- * Failure:
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Quincey Koziol
* Friday, March 30, 2012
@@ -50,42 +43,54 @@ int data[SPACE_DIM1][SPACE_DIM2];
int
main(void)
{
- hid_t file, space, dset;
+ hid_t fid = -1, sid = -1, did = -1;
hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
- size_t i, j; /* Local index variables */
+ size_t i,j; /* Local index variables */
+ int *data = NULL; /* Dataset data */
/* Initialize the data */
+ if(NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
+ TEST_ERROR
+
for(i = 0; i < SPACE_DIM1; i++)
for(j = 0; j < SPACE_DIM2; j++)
- data[i][j] = (int)(j % 5);
+ data[(i * SPACE_DIM2) + j] = (int)(j % 5);
/* Create the file */
- file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file < 0)
- printf("file < 0!\n");
+ if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataspace */
- space = H5Screate_simple(SPACE_RANK, dims, NULL);
- if(space < 0)
- printf("space < 0!\n");
+ if((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create the compressed dataset */
- dset = H5Dcreate2(file, "Dataset1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset < 0)
- printf("dset < 0!\n");
+ if((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
- printf("H5Dwrite() failed!\n");
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Dclose(dset) < 0)
- printf("H5Dclose() failed!\n");
- if(H5Sclose(space) < 0)
- printf("H5Sclose() failed!\n");
- if(H5Fclose(file) < 0)
- printf("H5Fclose() failed!\n");
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+ if(data)
+ HDfree(data);
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
- return 0;
-}
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/h5test.c b/test/h5test.c
index 8181ff9..39731a2 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -836,7 +836,7 @@ h5_fileaccess(void)
/* In-memory driver with write tracking and paging on */
if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096)<0) return -1;
- } else if (!HDstrcmp(name, "split")) {
+ } else if (!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
if (H5Pset_fapl_split(fapl,
"-m.h5", H5P_DEFAULT,
diff --git a/test/istore.c b/test/istore.c
index ec7542a..68668d8 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -529,9 +529,9 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
if((mspace=H5Screate_simple(ndims,size,NULL)) < 0) TEST_ERROR;
for (ctr=0; ctr<nblocks; ctr++) {
- offset[0] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx));
- offset[1] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny));
- offset[2] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz));
+ offset[0] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-nx));
+ offset[1] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-ny));
+ offset[2] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-nz));
/* Select region in file dataspace */
if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL) < 0) TEST_ERROR;
diff --git a/test/pool.c b/test/pool.c
index 83c862b..7d80096 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -671,7 +671,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
/* Shuffle pointers to free */
for(u = 0; u < MPOOL_NUM_RANDOM; u++) {
- swap_idx = (size_t)(HDrandom() % (MPOOL_NUM_RANDOM - u)) + u;
+ swap_idx = (size_t)(HDrandom() % (int)(MPOOL_NUM_RANDOM - u)) + u;
swap_ptr = spc[u];
spc[u] = spc[swap_idx];
spc[swap_idx] = swap_ptr;
diff --git a/test/tattr.c b/test/tattr.c
index 585246a..e7b3ece 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -146,7 +146,7 @@ typedef struct {
unsigned ncalled; /* # of times callback is entered */
unsigned nskipped; /* # of attributes skipped */
int stop; /* # of iterations to stop after */
- int64_t curr; /* Current creation order value */
+ hsize_t curr; /* Current creation order value */
size_t max_visit; /* Size of "visited attribute" flag array */
hbool_t *visited; /* Pointer to array of "visited attribute" flags */
} attr_iter_info_t;
@@ -522,7 +522,7 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata,0.0F))
+ if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Fflush(fil, H5F_SCOPE_GLOBAL);
@@ -531,7 +531,7 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata,0.0F))
+ if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
@@ -780,7 +780,7 @@ test_attr_compound_read(hid_t fapl)
size_t offset; /* Attribute datatype field offset */
hid_t field; /* Attribute field datatype */
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */
- size_t name_len; /* Length of attribute name */
+ ssize_t name_len; /* Length of attribute name */
H5O_info_t oinfo; /* Object info */
int i, j; /* Local index variables */
herr_t ret; /* Generic return value */
@@ -1187,7 +1187,7 @@ test_attr_mult_read(hid_t fapl)
int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */
- size_t name_len; /* Length of attribute name */
+ ssize_t name_len; /* Length of attribute name */
H5O_info_t oinfo; /* Object info */
int i, j, k; /* Local index values */
herr_t ret; /* Generic return value */
@@ -1510,7 +1510,7 @@ test_attr_delete(hid_t fapl)
hid_t dataset; /* Dataset ID */
hid_t attr; /* Attribute ID */
char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
- size_t name_len; /* Length of attribute name */
+ ssize_t name_len; /* Length of attribute name */
H5O_info_t oinfo; /* Object info */
herr_t ret; /* Generic return value */
@@ -2078,7 +2078,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
/* Re-open all the attributes by index and verify the data */
for(u = 0; u < max_attr; u++) {
- size_t name_len; /* Length of attribute name */
+ ssize_t name_len; /* Length of attribute name */
char check_name[ATTR_NAME_LEN]; /* Buffer for checking attribute names */
/* Open attribute */
@@ -5560,7 +5560,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5585,7 +5585,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing native order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5606,7 +5606,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5626,7 +5626,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5651,7 +5651,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5760,7 +5760,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Check for query on non-existant attribute */
ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
/* Create attributes, up to limit of compact form */
@@ -5797,7 +5797,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
/* Create more attributes, to push into dense form */
@@ -5847,7 +5847,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
} /* end for */
@@ -6074,7 +6074,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", (u + 1));
else
@@ -6199,7 +6199,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", (u + 1));
else
@@ -6310,7 +6310,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", ((u * 2) + 1));
else
@@ -6359,7 +6359,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", ((u * 2) + 3));
else
@@ -9864,7 +9864,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
wdata1[u][v] = (int)((u * dims1[1]) + v);
for(u = 0; u < dims2[0]; u++)
for(v = 0; v < dims2[1]; v++)
- wdata2[u][v] = (int)((u * dims2[1]) + v);
+ wdata2[u][v] = (unsigned)((u * dims2[1]) + v);
/* Write data to the attributes */
ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1);
diff --git a/test/tconfig.c b/test/tconfig.c
index 6c1321a..3ae26c2 100644
--- a/test/tconfig.c
+++ b/test/tconfig.c
@@ -42,8 +42,8 @@
/* Needs this extra step so that we can print the macro name. */
#define vrfy_macrosize(type, macro, macroname) \
if (sizeof(type) != macro) \
- TestErrPrintf("Error: sizeof(%s) is %d but %s is %d\n", \
- #type, (int)sizeof(type), macroname, (int)macro);
+ TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", \
+ #type, sizeof(type), macroname, (int)macro);
/* local routine prototypes */
void test_config_ctypes(void);