From 861c2b0a1f76530ecf7aa96718bbb38dbd906ebd Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Mon, 1 May 2017 11:55:08 +0530 Subject: [PATCH] test: c_write_operations.cc: silence warning from -Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The following warning appears during make: ceph/src/googletest/googletest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’: ceph/src/googletest/googletest/include/gtest/gtest.h:1421:23: required from ‘static testing::AssertionResult testing::internal::EqHelper::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]’ ceph/src/test/librados/c_write_operations.cc:246:3: required from here ceph/src/googletest/googletest/include/gtest/gtest.h:1392:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (lhs == rhs) { ~~~~^~~~~~ Signed-off-by: Jos Collin --- src/test/librados/c_write_operations.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/librados/c_write_operations.cc b/src/test/librados/c_write_operations.cc index 54cbd21462860..325a2f0a3e0dd 100644 --- a/src/test/librados/c_write_operations.cc +++ b/src/test/librados/c_write_operations.cc @@ -243,7 +243,7 @@ TEST(LibRadosCWriteOps, CmpExt) { ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL, 0)); rados_release_write_op(op); char hi[4]; - ASSERT_EQ(sizeof(hi), rados_read(ioctx, "test", hi, sizeof(hi), 0)); + ASSERT_EQ(sizeof(hi), static_cast(rados_read(ioctx, "test", hi, sizeof(hi), 0))); ASSERT_EQ(0, memcmp("four", hi, sizeof(hi))); // compare and overwrite on (expected) match @@ -255,7 +255,7 @@ TEST(LibRadosCWriteOps, CmpExt) { ASSERT_EQ(0, rados_write_op_operate(op, ioctx, "test", NULL, 0)); ASSERT_EQ(0, val); rados_release_write_op(op); - ASSERT_EQ(sizeof(hi), rados_read(ioctx, "test", hi, sizeof(hi), 0)); + ASSERT_EQ(sizeof(hi), static_cast(rados_read(ioctx, "test", hi, sizeof(hi), 0))); ASSERT_EQ(0, memcmp("five", hi, sizeof(hi))); // compare and bail before write due to mismatch -- 2.39.5