You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by cl...@apache.org on 2010/11/28 15:34:26 UTC

svn commit: r1039885 - in /thrift/trunk: lib/cpp/src/protocol/TCompactProtocol.h lib/cpp/test/Benchmark.cpp lib/cpp/test/DebugProtoTest.cpp lib/cpp/test/JSONProtoTest.cpp lib/cpp/test/SpecializationTest.cpp test/DebugProtoTest.thrift

Author: clavoie
Date: Sun Nov 28 14:34:26 2010
New Revision: 1039885

URL: http://svn.apache.org/viewvc?rev=1039885&view=rev
Log:
THRIFT-916: Commit THRIFT-916_fix_no-overflow.patch -- remove overflow coming from a few constants.

Modified:
    thrift/trunk/lib/cpp/src/protocol/TCompactProtocol.h
    thrift/trunk/lib/cpp/test/Benchmark.cpp
    thrift/trunk/lib/cpp/test/DebugProtoTest.cpp
    thrift/trunk/lib/cpp/test/JSONProtoTest.cpp
    thrift/trunk/lib/cpp/test/SpecializationTest.cpp
    thrift/trunk/test/DebugProtoTest.thrift

Modified: thrift/trunk/lib/cpp/src/protocol/TCompactProtocol.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/protocol/TCompactProtocol.h?rev=1039885&r1=1039884&r2=1039885&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/protocol/TCompactProtocol.h (original)
+++ thrift/trunk/lib/cpp/src/protocol/TCompactProtocol.h Sun Nov 28 14:34:26 2010
@@ -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_;

Modified: thrift/trunk/lib/cpp/test/Benchmark.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/test/Benchmark.cpp?rev=1039885&r1=1039884&r2=1039885&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/test/Benchmark.cpp (original)
+++ thrift/trunk/lib/cpp/test/Benchmark.cpp Sun Nov 28 14:34:26 2010
@@ -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;

Modified: thrift/trunk/lib/cpp/test/DebugProtoTest.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/test/DebugProtoTest.cpp?rev=1039885&r1=1039884&r2=1039885&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/test/DebugProtoTest.cpp (original)
+++ thrift/trunk/lib/cpp/test/DebugProtoTest.cpp Sun Nov 28 14:34:26 2010
@@ -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;

Modified: thrift/trunk/lib/cpp/test/JSONProtoTest.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/test/JSONProtoTest.cpp?rev=1039885&r1=1039884&r2=1039885&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/test/JSONProtoTest.cpp (original)
+++ thrift/trunk/lib/cpp/test/JSONProtoTest.cpp Sun Nov 28 14:34:26 2010
@@ -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);
 

Modified: thrift/trunk/lib/cpp/test/SpecializationTest.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/test/SpecializationTest.cpp?rev=1039885&r1=1039884&r2=1039885&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/test/SpecializationTest.cpp (original)
+++ thrift/trunk/lib/cpp/test/SpecializationTest.cpp Sun Nov 28 14:34:26 2010
@@ -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);
 

Modified: thrift/trunk/test/DebugProtoTest.thrift
URL: http://svn.apache.org/viewvc/thrift/trunk/test/DebugProtoTest.thrift?rev=1039885&r1=1039884&r2=1039885&view=diff
==============================================================================
--- thrift/trunk/test/DebugProtoTest.thrift (original)
+++ thrift/trunk/test/DebugProtoTest.thrift Sun Nov 28 14:34:26 2010
@@ -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,