diff options
author | Christian Lavoie <clavoie@apache.org> | 2010-11-28 14:34:26 +0000 |
---|---|---|
committer | Christian Lavoie <clavoie@apache.org> | 2010-11-28 14:34:26 +0000 |
commit | cbf87cb89cf0b1e7cd3656262c642209fef235ef (patch) | |
tree | cbc89a238c96482bc9e0b384cda6459b1f2203a8 | |
parent | c101092ea742e1252207b6e8f680bf392292c916 (diff) | |
download | thrift-cbf87cb89cf0b1e7cd3656262c642209fef235ef.tar.gz |
THRIFT-916: Commit THRIFT-916_fix_no-overflow.patch -- remove overflow coming from a few constants.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1039885 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | lib/cpp/src/protocol/TCompactProtocol.h | 4 | ||||
-rw-r--r-- | lib/cpp/test/Benchmark.cpp | 2 | ||||
-rw-r--r-- | lib/cpp/test/DebugProtoTest.cpp | 2 | ||||
-rw-r--r-- | lib/cpp/test/JSONProtoTest.cpp | 4 | ||||
-rw-r--r-- | lib/cpp/test/SpecializationTest.cpp | 4 | ||||
-rw-r--r-- | test/DebugProtoTest.thrift | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/lib/cpp/src/protocol/TCompactProtocol.h b/lib/cpp/src/protocol/TCompactProtocol.h index 19a0160aa..c4d1f08ae 100644 --- a/lib/cpp/src/protocol/TCompactProtocol.h +++ b/lib/cpp/src/protocol/TCompactProtocol.h @@ -35,10 +35,10 @@ class TCompactProtocolT : public TVirtualProtocol< TCompactProtocolT<Transport_> > { protected: - static const int8_t PROTOCOL_ID = 0x82; + static const int8_t PROTOCOL_ID = (int8_t)0x82; static const int8_t VERSION_N = 1; static const int8_t VERSION_MASK = 0x1f; // 0001 1111 - static const int8_t TYPE_MASK = 0xE0; // 1110 0000 + static const int8_t TYPE_MASK = (int8_t)0xE0; // 1110 0000 static const int32_t TYPE_SHIFT_AMOUNT = 5; Transport_* trans_; diff --git a/lib/cpp/test/Benchmark.cpp b/lib/cpp/test/Benchmark.cpp index a9859d876..f4cd39256 100644 --- a/lib/cpp/test/Benchmark.cpp +++ b/lib/cpp/test/Benchmark.cpp @@ -56,7 +56,7 @@ int main() { OneOfEach ooe; ooe.im_true = true; ooe.im_false = false; - ooe.a_bite = 0xd6; + ooe.a_bite = 0x7f; ooe.integer16 = 27000; ooe.integer32 = 1<<24; ooe.integer64 = (uint64_t)6000 * 1000 * 1000; diff --git a/lib/cpp/test/DebugProtoTest.cpp b/lib/cpp/test/DebugProtoTest.cpp index ed23d1acb..4f456f310 100644 --- a/lib/cpp/test/DebugProtoTest.cpp +++ b/lib/cpp/test/DebugProtoTest.cpp @@ -31,7 +31,7 @@ int main() { OneOfEach ooe; ooe.im_true = true; ooe.im_false = false; - ooe.a_bite = 0xd6; + ooe.a_bite = 0x7f; ooe.integer16 = 27000; ooe.integer32 = 1<<24; ooe.integer64 = (uint64_t)6000 * 1000 * 1000; diff --git a/lib/cpp/test/JSONProtoTest.cpp b/lib/cpp/test/JSONProtoTest.cpp index 24796388b..a9268a2b2 100644 --- a/lib/cpp/test/JSONProtoTest.cpp +++ b/lib/cpp/test/JSONProtoTest.cpp @@ -33,7 +33,7 @@ int main() { OneOfEach ooe; ooe.im_true = true; ooe.im_false = false; - ooe.a_bite = 0xd6; + ooe.a_bite = 0x7f; ooe.integer16 = 27000; ooe.integer32 = 1<<24; ooe.integer64 = (uint64_t)6000 * 1000 * 1000; @@ -123,7 +123,7 @@ int main() { assert(hm == hm2); - hm2.big[0].a_bite = 0xFF; + hm2.big[0].a_bite = 0x00; assert(hm != hm2); diff --git a/lib/cpp/test/SpecializationTest.cpp b/lib/cpp/test/SpecializationTest.cpp index 954585a57..fae1d3245 100644 --- a/lib/cpp/test/SpecializationTest.cpp +++ b/lib/cpp/test/SpecializationTest.cpp @@ -18,7 +18,7 @@ int main() { OneOfEach ooe; ooe.im_true = true; ooe.im_false = false; - ooe.a_bite = 0xd6; + ooe.a_bite = 0x7f; ooe.integer16 = 27000; ooe.integer32 = 1<<24; ooe.integer64 = (uint64_t)6000 * 1000 * 1000; @@ -100,7 +100,7 @@ int main() { assert(hm == hm2); - hm2.big[0].a_bite = 0xFF; + hm2.big[0].a_bite = 0x00; assert(hm != hm2); diff --git a/test/DebugProtoTest.thrift b/test/DebugProtoTest.thrift index 798004752..23d5d9737 100644 --- a/test/DebugProtoTest.thrift +++ b/test/DebugProtoTest.thrift @@ -35,8 +35,8 @@ struct Doubles { struct OneOfEach { 1: bool im_true, 2: bool im_false, - 3: byte a_bite = 200, - 4: i16 integer16 = 33000, + 3: byte a_bite = 0x7f, + 4: i16 integer16 = 0x7fff, 5: i32 integer32, 6: i64 integer64 = 10000000000, 7: double double_precision, |