mbed.org implementation of the abstract SmartREST library for the Cumulocity Platform SmartREST protocol.
Dependents: MbedSmartRestMain MbedSmartRestMain
Diff: Parser.cpp
- Revision:
- 4:059b8b90e0d9
- Parent:
- 0:099f76422485
- Child:
- 6:cd7ba1ddb664
diff -r aab51c468511 -r 059b8b90e0d9 Parser.cpp --- a/Parser.cpp Mon Jul 07 17:12:59 2014 +0200 +++ b/Parser.cpp Wed Jul 09 15:37:19 2014 +0200 @@ -46,15 +46,17 @@ uint8_t status; char read; reset(); - record.set(NULL, 0); + record.clear(); while ((_state < STATE_COMPLETE) && (((read = source.read()) > 0 ) || ((status = source.status()) == DS_STATUS_OK))) parse(read); - if (_state == STATE_COMPLETE) - record.set(_buffer, _count); + if (_state == STATE_COMPLETE) { + if (!record.set(_buffer, _count)) + return PARSER_INTERNAL_ERROR; + } if (_state == STATE_COMPLETE) return PARSER_SUCCESS;