diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-06-11 12:52:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-11 12:52:36 (GMT) |
commit | 03fb540c72fe49ca6240056c46e3b62d849204f4 (patch) | |
tree | 55273b72bef6532a74cc51b1c906e24aebbf44c9 /c++ | |
parent | 42e485ea7d9e5361384bf6b1ea7a365b3c2fa42f (diff) | |
download | hdf5-03fb540c72fe49ca6240056c46e3b62d849204f4.zip hdf5-03fb540c72fe49ca6240056c46e3b62d849204f4.tar.gz hdf5-03fb540c72fe49ca6240056c46e3b62d849204f4.tar.bz2 |
Fixes C++ warnings when passing hsize_t values to printf in test code (#745)
Diffstat (limited to 'c++')
-rw-r--r-- | c++/test/tarray.cpp | 31 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 52 |
2 files changed, 48 insertions, 35 deletions
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index c7c0b65..8a976ce 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 45ccc98..35db334 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -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. @@ -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 @@ -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 @@ -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 @@ -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]); /* @@ -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(); @@ -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 */ @@ -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 */ @@ -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 @@ -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 @@ -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 |