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

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1030576 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/protocol/TJSONProtocol.cpp b/lib/cpp/src/protocol/TJSONProtocol.cpp
index 9859c0f..5b0b18d 100644
--- a/lib/cpp/src/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/protocol/TJSONProtocol.cpp
@@ -194,7 +194,7 @@
     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 @@
     return val + '0';
   }
   else {
-    return val + 'a';
+    return val - 10 + 'a';
   }
 }