From: Danny Al-Gaaf Date: Tue, 17 Mar 2015 16:55:06 +0000 (+0100) Subject: test/../chain_xattr.cc: fix suspicious usage of 'sizeof' X-Git-Tag: v9.0.1~128^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ed57641a24d6b870b1996535c76977e4b21abf0;p=ceph.git test/../chain_xattr.cc: fix suspicious usage of 'sizeof' Use sizeof(char) instead of sizeof('\0'). Fix for: [src/test/objectstore/chain_xattr.cc:164]: (warning) Suspicious usage of 'sizeof' with a numeric constant as parameter. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/test/objectstore/chain_xattr.cc b/src/test/objectstore/chain_xattr.cc index 7e2e69371292..5c77b9520da2 100644 --- a/src/test/objectstore/chain_xattr.cc +++ b/src/test/objectstore/chain_xattr.cc @@ -161,7 +161,7 @@ TEST(chain_xattr, listxattr) { ASSERT_EQ(LARGE_BLOCK_LEN, chain_setxattr(file, name1.c_str(), x.c_str(), LARGE_BLOCK_LEN)); ASSERT_EQ((int)sizeof(y), chain_setxattr(file, name2.c_str(), &y, sizeof(y))); - int buffer_size = name1.size() + sizeof('\0') + name2.size() + sizeof('\0'); + int buffer_size = name1.size() + sizeof(char) + name2.size() + sizeof(char); char* expected = (char*)malloc(buffer_size); ::strcpy(expected, name1.c_str()); ::strcpy(expected + name1.size() + 1, name2.c_str());