You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2010/11/03 18:57:39 UTC

svn commit: r1030576 - /thrift/trunk/lib/cpp/src/protocol/TJSONProtocol.cpp

Author: bryanduxbury
Date: Wed Nov  3 17:57:38 2010
New Revision: 1030576

URL: http://svn.apache.org/viewvc?rev=1030576&view=rev
Log:
THRIFT-977. cpp: Hex Conversion Bug in C++ TJSONProtocol

This patch fixes a silly bug in hex-to-int conversion in TSJONProtocol.

Patch: Aravind Narayanan

Modified:
    thrift/trunk/lib/cpp/src/protocol/TJSONProtocol.cpp

Modified: thrift/trunk/lib/cpp/src/protocol/TJSONProtocol.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/protocol/TJSONProtocol.cpp?rev=1030576&r1=1030575&r2=1030576&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/protocol/TJSONProtocol.cpp (original)
+++ thrift/trunk/lib/cpp/src/protocol/TJSONProtocol.cpp Wed Nov  3 17:57:38 2010
@@ -194,7 +194,7 @@ static uint8_t hexVal(uint8_t ch) {
     return ch - '0';
   }
   else if ((ch >= 'a') && (ch <= 'f')) {
-    return ch - 'a';
+    return ch - 'a' + 10;
   }
   else {
     throw TProtocolException(TProtocolException::INVALID_DATA,
@@ -211,7 +211,7 @@ static uint8_t hexChar(uint8_t val) {
     return val + '0';
   }
   else {
-    return val + 'a';
+    return val - 10 + 'a';
   }
 }