diff options
author | Cody P Schafer <dev@codyps.com> | 2016-09-09 15:50:26 -0400 |
---|---|---|
committer | Nobuaki Sukegawa <nsuke@apache.org> | 2016-10-01 23:40:56 +0900 |
commit | 3129549feb1647a42c5e29f4ac171583937139fa (patch) | |
tree | c4231faab6fa10a092d402f835ba42786e28d728 | |
parent | 4bbfe6120e71b81df7f23dcc246990c29eb27859 (diff) | |
download | thrift-3129549feb1647a42c5e29f4ac171583937139fa.tar.gz |
THRIFT-3831 in test/cpp explicitly use `signed char`
`char`'s signed-ness is implimentation dependent, and in the case where
`char` was not signed, we previously recieved errors like
thrift/0.9.3-r0/git/test/cpp/src/TestClient.cpp:404:15: error: narrowing conversion of '-127' from 'int' to 'char' inside { } [-Wnarrowing]
(This example from gcc-6 on arm)
This closes #1085
-rw-r--r-- | test/cpp/src/TestClient.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp index bbe196249..c16d04544 100644 --- a/test/cpp/src/TestClient.cpp +++ b/test/cpp/src/TestClient.cpp @@ -530,7 +530,7 @@ int main(int argc, char** argv) { return_code |= ERR_BASETYPES; } cout << "testBinary([-128..127]) = {" << flush; - const char bin_data[256] + const signed char bin_data[256] = {-128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84, @@ -551,7 +551,7 @@ int main(int argc, char** argv) { 127}; try { string bin_result; - testClient.testBinary(bin_result, string(bin_data, 256)); + testClient.testBinary(bin_result, string(reinterpret_cast<const char *>(bin_data), 256)); if (bin_result.size() != 256) { cout << endl << "*** FAILED ***" << endl; cout << "invalid length: " << bin_result.size() << endl; |