cc
Diff: ATParser.cpp
- Revision:
- 13:46a18ad08efc
- Parent:
- 12:7d3c3f7ce928
- Child:
- 15:311f99666a8d
--- a/ATParser.cpp Thu Feb 18 15:59:15 2016 -0600 +++ b/ATParser.cpp Thu Feb 18 16:01:03 2016 -0600 @@ -229,10 +229,6 @@ int j = 0; while (true) { - // Ran out of space - if (j+1 >= _buffer_size - offset) { - return false; - } // Recieve next character int c = getc(); if (c < 0) { @@ -260,8 +256,11 @@ break; } - // Clear the buffer when we hit a newline - if (strcmp(&_buffer[offset + j-_delim_size], _delimiter) == 0) { + // Clear the buffer when we hit a newline or ran out of space + // running out of space usually means we ran into binary data + if (j+1 >= _buffer_size - offset || + strcmp(&_buffer[offset + j-_delim_size], _delimiter) == 0) { + debug_if(dbg_on, "AT< %s", _buffer+offset); j = 0; }