Thrift: Distinguish between string and binary types in C++ and Java.
Summary:
The upcoming TJSONProtocol handles string and binary types quite differently.
This change makes that distinction in all parts of the C++ binding.
Java already distinguished between string and binary, but this change
also updates the Java skip method to skip over strings as binary
so we don't get encoding errors when skipping binary data.
Reviewed By: mcslee
Test Plan: make check
Revert Plan: ok
Other Notes:
I just pulled this out of Chad Walters' JSON patch.
The only other change was adding readBinary (or was it writeBinary)
to TDenseProtocol. Maybe inheriting from TBinaryProtocol wasn't a good idea.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665481 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.h b/lib/cpp/src/protocol/TBinaryProtocol.h
index c7e2791..9203865 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.h
+++ b/lib/cpp/src/protocol/TBinaryProtocol.h
@@ -119,9 +119,10 @@
uint32_t writeDouble(const double dub);
-
uint32_t writeString(const std::string& str);
+ uint32_t writeBinary(const std::string& str);
+
/**
* Reading functions
*/
@@ -173,6 +174,8 @@
uint32_t readString(std::string& str);
+ uint32_t readBinary(std::string& str);
+
protected:
uint32_t readStringBody(std::string& str, int32_t sz);