summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/dsets.cpp3
-rw-r--r--c++/test/tattr.cpp7
-rw-r--r--c++/test/tdspl.cpp8
-rw-r--r--c++/test/trefer.cpp26
-rw-r--r--c++/test/ttypes.cpp2
-rw-r--r--c++/test/tvlstr.cpp6
6 files changed, 27 insertions, 25 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 6e170bf..432abb8 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -228,7 +228,8 @@ test_simple_io(H5File &file)
// Check that the values read are the same as the values written
for (i = 0; i < 100; i++)
for (j = 0; j < 200; j++) {
- int status = check_values(i, j, points[i][j], check[i][j]);
+ int status =
+ check_values(static_cast<hsize_t>(i), static_cast<hsize_t>(j), points[i][j], check[i][j]);
if (status == -1)
throw Exception("DataSet::read");
}
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index dc968f9..0a1402c 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -727,13 +727,12 @@ test_attr_compound_read()
// Verify that the fields have the same names as when the type
// was created
- int j;
- for (j = 0; j < fields; j++) {
- H5std_string fieldname = datatype.getMemberName(j);
+ for (int j = 0; j < fields; j++) {
+ H5std_string fieldname = datatype.getMemberName(static_cast<unsigned>(j));
if (!((fieldname == ATTR4_FIELDNAME1) || (fieldname == ATTR4_FIELDNAME2) ||
(fieldname == ATTR4_FIELDNAME3)))
TestErrPrintf("%d:invalid field name for field #%d: %s\n", __LINE__, j, fieldname.c_str());
- } /* end for */
+ }
offset = datatype.getMemberOffset(0);
verify_val(offset, attr4_field1_off, "DataType::getMemberOffset", __LINE__, __FILE__);
diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp
index 5a78133..d692a5b 100644
--- a/c++/test/tdspl.cpp
+++ b/c++/test/tdspl.cpp
@@ -60,8 +60,8 @@ test_transfplist()
// Find out the length of the transform expression, allocate the buffer
// for it, then read and verify the expression from the copied plist
- ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
- char * c_to_f_read = static_cast<char *>(HDmalloc(tran_len + 1));
+ size_t tran_len = static_cast<size_t>(dxpl_c_to_f_copy.getDataTransform(NULL));
+ char * c_to_f_read = static_cast<char *>(HDmalloc(tran_len + 1));
HDmemset(c_to_f_read, 0, tran_len + 1);
dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len + 1);
verify_val(const_cast<const char *>(c_to_f_read), const_cast<const char *>(c_to_f),
@@ -75,7 +75,7 @@ test_transfplist()
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size [default=0])
- tran_len = dxpl_c_to_f.getDataTransform(NULL);
+ tran_len = static_cast<size_t>(dxpl_c_to_f.getDataTransform(NULL));
c_to_f_read = static_cast<char *>(HDmalloc(tran_len + 1));
HDmemset(c_to_f_read, 0, tran_len + 1);
dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len + 1);
@@ -91,7 +91,7 @@ test_transfplist()
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size)
- tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
+ tran_len = static_cast<size_t>(dxpl_utrans_inv.getDataTransform(NULL, 0));
char *utrans_inv_read = static_cast<char *>(HDmalloc(tran_len + 1));
HDmemset(utrans_inv_read, 0, tran_len + 1);
dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len + 1);
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index 66fa040..2a0fe1e 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -80,10 +80,10 @@ test_reference_params()
*tbuf; // temp. buffer read from disk
// Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
- wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
- rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
- tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ size_t temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
+ wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
// Create file FILE1
file1 = new H5File(FILE1, H5F_ACC_TRUNC);
@@ -102,7 +102,7 @@ test_reference_params()
DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
unsigned *tu32; // Temporary pointer to uint32 data
- int i;
+ unsigned i;
for (tu32 = reinterpret_cast<unsigned *>(wbuf), i = 0; i < SPACE1_DIM1; i++)
*tu32++ = i * 3; // from C test
@@ -194,7 +194,6 @@ test_reference_params()
static void
test_reference_obj()
{
- int i; // counting variables
const H5std_string write_comment = "Foo!"; // Comments for group
// Output message about test being performed
@@ -207,10 +206,10 @@ test_reference_obj()
*tbuf; // temp. buffer read from disk
// Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
- wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
- rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
- tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ size_t temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
+ wbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ rbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
+ tbuf = static_cast<hobj_ref_t *>(HDmalloc(temp_size * SPACE1_DIM1));
// Create file FILE1
file1 = new H5File(FILE1, H5F_ACC_TRUNC);
@@ -232,6 +231,7 @@ test_reference_obj()
DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
unsigned *tu32; // Temporary pointer to uint32 data
+ unsigned i;
for (tu32 = reinterpret_cast<unsigned *>(wbuf), i = 0; i < SPACE1_DIM1; i++)
*tu32++ = i * 3; // from C test
@@ -714,7 +714,8 @@ test_reference_region_1D()
verify_val(static_cast<long>(nelms), 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
- coords = static_cast<hsize_t *>(HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2));
+ coords =
+ static_cast<hsize_t *>(HDmalloc(static_cast<size_t>(nelms) * SPACE3_RANK * sizeof(hsize_t) * 2));
// Get the list of hyperslab blocks currently selected
reg_sp.getSelectHyperBlocklist(0, static_cast<hsize_t>(nelms), coords);
@@ -773,7 +774,8 @@ test_reference_region_1D()
verify_val(static_cast<long>(nelmspts), 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
- coords = static_cast<hsize_t *>(HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)));
+ coords =
+ static_cast<hsize_t *>(HDmalloc(static_cast<size_t>(nelmspts) * SPACE3_RANK * sizeof(hsize_t)));
// Get the list of element points currently selected
elm_sp.getSelectElemPointlist(0, static_cast<hsize_t>(nelmspts), coords);
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index 794820e..db32cc0 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -241,7 +241,7 @@ test_detect_type_class()
*/
// Create an array datatype with an atomic base type
- unsigned rank = 2; // Rank for array datatype
+ int rank = 2; // Rank for array datatype
hsize_t dims[2] = {3, 3}; // Dimensions for array datatype
ArrayType atom_arr(PredType::STD_REF_OBJ, rank, dims);
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index 405ca07..6ace763 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -360,7 +360,7 @@ test_vlstrings_special()
hsize_t ii; // counting variable
for (ii = 0; ii < SPACE1_DIM1; ii++)
if (rdata[ii] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast<int>(ii), rdata[ii]);
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%s\n", static_cast<int>(ii), rdata[ii]);
// Write dataset to disk, then read it back.
dataset.write(wdata, vlst);
@@ -409,7 +409,7 @@ test_vlstrings_special()
// Check data read in.
for (ii = 0; ii < SPACE1_DIM1; ii++)
if (rdata[ii] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast<int>(ii), rdata[ii]);
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%s\n", static_cast<int>(ii), rdata[ii]);
// Try to write nil strings to disk.
dataset.write(wdata2, vlst);
@@ -420,7 +420,7 @@ test_vlstrings_special()
// Check data read in.
for (ii = 0; ii < SPACE1_DIM1; ii++)
if (rdata[ii] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", static_cast<int>(ii), rdata[ii]);
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%s\n", static_cast<int>(ii), rdata[ii]);
// Close objects and file.
dataset.close();