From: Sage Weil Date: Sat, 9 Feb 2013 05:47:34 +0000 (-0800) Subject: test/crypto: fix narrowing conversion warning X-Git-Tag: v0.58~115 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0d68f3a8f7bcba2d4b1a055a23c8b07054ac628c;p=ceph.git test/crypto: fix narrowing conversion warning warning: test/crypto.cc:49:3: narrowing conversion of ‘136’ from ‘int’ to ‘char’ inside { } is ill-formed in C++11 [-Wnarrowing] Signed-off-by: Sage Weil --- diff --git a/src/test/crypto.cc b/src/test/crypto.cc index 80a5495001d9..24d5c5a475d3 100644 --- a/src/test/crypto.cc +++ b/src/test/crypto.cc @@ -43,19 +43,19 @@ TEST(AES, Encrypt) { }; bufferptr secret(secret_s, sizeof(secret_s)); - char plaintext_s[] = { + unsigned char plaintext_s[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, }; bufferlist plaintext; - plaintext.append(plaintext_s, sizeof(plaintext_s)); + plaintext.append((char *)plaintext_s, sizeof(plaintext_s)); bufferlist cipher; std::string error; h->encrypt(secret, plaintext, cipher, error); ASSERT_EQ(error, ""); - char want_cipher[] = { + unsigned char want_cipher[] = { 0xb3, 0x8f, 0x5b, 0xc9, 0x35, 0x4c, 0xf8, 0xc6, 0x13, 0x15, 0x66, 0x6f, 0x37, 0xd7, 0x79, 0x3a, 0x11, 0x90, 0x7b, 0xe9, 0xd8, 0x3c, 0x35, 0x70, @@ -79,16 +79,16 @@ TEST(AES, Decrypt) { }; bufferptr secret(secret_s, sizeof(secret_s)); - char cipher_s[] = { + unsigned char cipher_s[] = { 0xb3, 0x8f, 0x5b, 0xc9, 0x35, 0x4c, 0xf8, 0xc6, 0x13, 0x15, 0x66, 0x6f, 0x37, 0xd7, 0x79, 0x3a, 0x11, 0x90, 0x7b, 0xe9, 0xd8, 0x3c, 0x35, 0x70, 0x58, 0x7b, 0x97, 0x9b, 0x03, 0xd2, 0xa5, 0x01, }; bufferlist cipher; - cipher.append(cipher_s, sizeof(cipher_s)); + cipher.append((char *)cipher_s, sizeof(cipher_s)); - char want_plaintext[] = { + unsigned char want_plaintext[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, };