blob: f13adbb6bc4507ac1baf164480790d163ba40dc9 [file] [log] [blame]
Patrick Williamsddad1a12017-02-23 20:36:32 -06001From f6cad0580e5391c37af7f60adddb71bf1a403dc4 Mon Sep 17 00:00:00 2001
2From: Cody P Schafer <dev@codyps.com>
3Date: Fri, 9 Sep 2016 15:50:26 -0400
4Subject: [PATCH 2/2] THRIFT-3831 in test/cpp explicitly use `signed char`
5
6`char`'s signed-ness is implimentation dependent, and in the case where
7`char` was not signed, we previously recieved errors like
8
9 thrift/0.9.3-r0/git/test/cpp/src/TestClient.cpp:404:15: error: narrowing conversion of '-127' from 'int' to 'char' inside { } [-Wnarrowing]
10
11(This example from gcc-6 on arm)
12---
13 test/cpp/src/TestClient.cpp | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
17index e709899..4a961f8 100644
18--- a/test/cpp/src/TestClient.cpp
19+++ b/test/cpp/src/TestClient.cpp
20@@ -383,7 +383,7 @@ int main(int argc, char** argv) {
21 * BINARY TEST
22 */
23 printf("testBinary([-128..127]) = {");
24- const char bin_data[256]
25+ const signed char bin_data[256]
26 = {-128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114,
27 -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99,
28 -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84,
29@@ -404,7 +404,7 @@ int main(int argc, char** argv) {
30 127};
31 try {
32 string bin_result;
33- testClient.testBinary(bin_result, string(bin_data, 256));
34+ testClient.testBinary(bin_result, string(reinterpret_cast<const char *>(bin_data), 256));
35 if (bin_result.size() != 256) {
36 printf("}\n*** FAILED ***\n");
37 printf("invalid length: %lu\n", bin_result.size());
38--
392.9.3
40