rtklibexplorer / RTKLIB

A version of RTKLIB optimized for low cost GNSS receivers, especially u-blox receivers. It is based on RTKLIB 2.4.3 and is kept reasonably closely synced to that branch. This software is provided “AS IS” without any warranties of any kind so please be careful, especially if using it in any kind of real-time application.
http://rtkexplorer.com/
Other
651 stars 253 forks source link

stream readntrip: correct reading from the response buffer #353

Closed ourairquality closed 3 months ago

ourairquality commented 3 months ago

A minor nit in the ntrip stream code. This would not appear to be capable of causing corruption, just some loss of received content at the start of the stream, and might not have been reachable.

For the ntrip stream, initial content is read into the response buffer for processing, but once processed there can be some content remaining that can be general input from this stream. The code was using the most recent number of requested bytes and discarding the reset. Typically the caller was reading into a large buffer so requesting more than buffered and so all the content was consumed. Update the code to also consume all the buffer content even if the caller is using a small buffer. Also expand the two cases to make the code clearer.

Rework reqntrip_c() and rspntrip_s() a little, to use memmove() rather than a for() loop, and comment the buffer flushing, just for clarity.