| 952 | } |
| 953 | |
| 954 | uint32_t TJSONProtocol::readMessageBegin(std::string& name, |
| 955 | TMessageType& messageType, |
| 956 | int32_t& seqid) { |
| 957 | uint32_t result = readJSONArrayStart(); |
| 958 | int64_t tmpVal = 0; |
| 959 | result += readJSONInteger(tmpVal); |
| 960 | if (tmpVal != kThriftVersion1) { |
| 961 | throw TProtocolException(TProtocolException::BAD_VERSION, "Message contained bad version."); |
| 962 | } |
| 963 | result += readJSONString(name); |
| 964 | result += readJSONInteger(tmpVal); |
| 965 | messageType = (TMessageType)tmpVal; |
| 966 | result += readJSONInteger(tmpVal); |
| 967 | if (tmpVal > (std::numeric_limits<int32_t>::max)() || |
| 968 | tmpVal < (std::numeric_limits<int32_t>::min)()) |
| 969 | throw TProtocolException(TProtocolException::INVALID_DATA, "sequence id is not int32_t"); |
| 970 | seqid = static_cast<int32_t>(tmpVal); |
| 971 | return result; |
| 972 | } |
| 973 | |
| 974 | uint32_t TJSONProtocol::readMessageEnd() { |
| 975 | return readJSONArrayEnd(); |