Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes C++ warnings when passing hsize_t values to printf in test code #745

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions c++/test/tarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
TestErrPrintf(
"Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
rdims1[ii], ii, tdims1[ii]);
TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
", tdims1[%d]=%" PRIuHSIZE "\n",
ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if

Expand All @@ -198,9 +198,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
TestErrPrintf(
"Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
rdims1[ii], ii, tdims1[ii]);
TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
", tdims1[%d]=%" PRIuHSIZE "\n",
ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if

Expand Down Expand Up @@ -249,9 +249,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
TestErrPrintf(
"Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
rdims1[ii], ii, tdims1[ii]);
TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
", tdims1[%d]=%" PRIuHSIZE "\n",
ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if

Expand All @@ -266,8 +266,9 @@ test_array_compound_array()
for (idxi = 0; idxi < SPACE1_DIM1; idxi++) {
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) {
TestErrPrintf("Array data information doesn't match!, wdata[%lld][%lld].i=%d, "
"rdata[%lld][%lld].i=%d\n",
TestErrPrintf("Array data information doesn't match!, wdata[%" PRIuHSIZE "][%" PRIuHSIZE
"].i=%d, "
"rdata[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n",
idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i);
continue;
} // end if
Expand Down Expand Up @@ -459,11 +460,11 @@ test_array_info()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
TestErrPrintf(
"Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=z%llu\n", ii,
rdims1[ii], ii, tdims1[ii]);
TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
", tdims1[%d]=%" PRIuHSIZE "\n",
ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
}
}

// Close all
Expand Down
52 changes: 32 additions & 20 deletions c++/test/tattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ test_attr_basic_write()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n",
TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
"]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);

// Create two more attributes for this dataset, but only write to one.
Expand All @@ -187,7 +188,8 @@ test_attr_basic_write()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1a[i] != read_data1[i])
TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n",
TestErrPrintf("%d: attribute data different: attr_data1a[%" PRIuHSIZE
"]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1a[i], i, read_data1[i]);

// Close both attributes
Expand Down Expand Up @@ -453,7 +455,8 @@ test_attr_rename()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu%d\n",
TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
"]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);

// Close attribute
Expand All @@ -477,7 +480,8 @@ test_attr_rename()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1a[i] != read_data1[i])
TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n",
TestErrPrintf("%d: attribute data different: attr_data1a[%" PRIuHSIZE
"]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1a[i], i, read_data1[i]);

// Close attribute
Expand Down Expand Up @@ -542,7 +546,8 @@ test_attr_basic_read()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d, read_data1[%llu]=%d\n",
TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
"]=%d, read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);

/*
Expand Down Expand Up @@ -573,8 +578,9 @@ test_attr_basic_read()
for (i = 0; i < ATTR2_DIM1; i++)
for (j = 0; j < ATTR2_DIM2; j++)
if (attr_data2[i][j] != read_data2[i][j]) {
TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, "
"read_data2[%llu][%llu]=%d\n",
TestErrPrintf("%d: attribute data different: attr_data2[%" PRIuHSIZE "][%" PRIuHSIZE
"]=%d, "
"read_data2[%" PRIuHSIZE "][%" PRIuHSIZE "]=%d\n",
__LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
}
PASSED();
Expand Down Expand Up @@ -786,14 +792,17 @@ test_attr_compound_read()
for (ii = 0; ii < ATTR4_DIM1; ii++)
for (jj = 0; jj < ATTR4_DIM2; jj++)
if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) {
TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].i=%d, "
"read_data4[%llu][%llu].i=%d\n",
TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE
"].i=%d, "
"read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n",
__LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i);
TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].d=%f, "
"read_data4[%llu][%llu].d=%f\n",
TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE
"].d=%f, "
"read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].d=%f\n",
__LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d);
TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].c=%c, "
"read_data4[%llu][%llu].c=%c\n",
TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE
"].c=%c, "
"read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].c=%c\n",
__LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c);
} /* end if */

Expand Down Expand Up @@ -1061,8 +1070,8 @@ test_attr_mult_read()
hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
(void)space.getSimpleExtentDims(dims);
if (dims[0] != ATTR1_DIM1)
TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__,
static_cast<int>(dims[0]), ATTR1_DIM1);
TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %" PRIuHSIZE "\n",
__LINE__, static_cast<int>(dims[0]), ATTR1_DIM1);

/* Verify Datatype */

Expand Down Expand Up @@ -1091,7 +1100,8 @@ test_attr_mult_read()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n",
TestErrPrintf("%d: attribute data different: attr_data1[%" PRIuHSIZE
"]=%d,read_data1[%" PRIuHSIZE "]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);

// Verify Name
Expand Down Expand Up @@ -1150,8 +1160,9 @@ test_attr_mult_read()
for (i = 0; i < ATTR2_DIM1; i++)
for (j = 0; j < ATTR2_DIM2; j++)
if (attr_data2[i][j] != read_data2[i][j])
TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, "
"read_data2[%llu][%llu]=%d\n",
TestErrPrintf("%d: attribute data different: attr_data2[%" PRIuHSIZE "][%" PRIuHSIZE
"]=%d, "
"read_data2[%" PRIuHSIZE "][%" PRIuHSIZE "]=%d\n",
__LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);

// Verify Name
Expand Down Expand Up @@ -1210,8 +1221,9 @@ test_attr_mult_read()
for (j = 0; j < ATTR3_DIM2; j++)
for (k = 0; k < ATTR3_DIM3; k++)
if (abs(attr_data3[i][j][k] - read_data3[i][j][k]) > DBL_EPSILON)
TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, "
"read_data3[%llu][%llu][%llu]=%f\n",
TestErrPrintf("%d: attribute data different: attr_data3[%" PRIuHSIZE "][%" PRIuHSIZE
"][%" PRIuHSIZE "]=%f, "
"read_data3[%" PRIuHSIZE "][%" PRIuHSIZE "][%" PRIuHSIZE "]=%f\n",
__LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);

// Verify Name
Expand Down