MCPcopy Create free account
hub / github.com/apache/thrift / readByte

Method readByte

lib/cpp/src/thrift/protocol/TJSONProtocol.cpp:1086–1095  ·  view source on GitHub ↗

readByte() must be handled properly because boost::lexical cast sees int8_t as a text type instead of an integer type

Source from the content-addressed store, hash-verified

1084// readByte() must be handled properly because boost::lexical cast sees int8_t
1085// as a text type instead of an integer type
1086uint32_t TJSONProtocol::readByte(int8_t& byte) {
1087 auto tmp = (int16_t)byte;
1088 uint32_t result = readJSONInteger(tmp);
1089 if (tmp > 127 || tmp < -128) {
1090 throw TProtocolException(TProtocolException::INVALID_DATA,
1091 "Expected byte value; got " + to_string(tmp));
1092 }
1093 byte = (int8_t)tmp;
1094 return result;
1095}
1096
1097uint32_t TJSONProtocol::readI16(int16_t& i16) {
1098 return readJSONInteger(i16);

Callers

nothing calls this directly

Calls 2

TProtocolExceptionClass · 0.70
to_stringFunction · 0.50

Tested by

no test coverage detected