THRIFT-3879 Undefined evaluation order causes incorrect processing in the C++ library JSON protocol

Client: C++
Patch: Daniel Mueller <dtmuller@web.de>

This closes #1050
This commit is contained in:
dtmuller 2016-07-15 10:05:43 +02:00 committed by Jens Geyer
parent f384076760
commit 4300b72b2d

View File

@ -651,7 +651,9 @@ uint32_t TJSONProtocol::writeMapBegin(const TType keyType,
} }
uint32_t TJSONProtocol::writeMapEnd() { uint32_t TJSONProtocol::writeMapEnd() {
return writeJSONObjectEnd() + writeJSONArrayEnd(); uint32_t result = writeJSONObjectEnd();
result += writeJSONArrayEnd();
return result;
} }
uint32_t TJSONProtocol::writeListBegin(const TType elemType, const uint32_t size) { uint32_t TJSONProtocol::writeListBegin(const TType elemType, const uint32_t size) {
@ -1015,7 +1017,9 @@ uint32_t TJSONProtocol::readMapBegin(TType& keyType, TType& valType, uint32_t& s
} }
uint32_t TJSONProtocol::readMapEnd() { uint32_t TJSONProtocol::readMapEnd() {
return readJSONObjectEnd() + readJSONArrayEnd(); uint32_t result = readJSONObjectEnd();
result += readJSONArrayEnd();
return result;
} }
uint32_t TJSONProtocol::readListBegin(TType& elemType, uint32_t& size) { uint32_t TJSONProtocol::readListBegin(TType& elemType, uint32_t& size) {