kosma / minmea

a lightweight GPS NMEA 0183 parser library in pure C
Do What The F*ck You Want To Public License
735 stars 246 forks source link

minmea: Allow lines with only CR ending #41

Closed vpetrigo closed 2 years ago

vpetrigo commented 5 years ago

Hello,

I would like to propose a small change that allows processing of lines that end with CR only. I use tokenization of lines which are read from a GPS module with strtok() call with '\n as delimiter.

So that minmea_check() in the current implementation returns false as all lines do not end with either "\n" or "\r\n".

Let me know if it is applicable change.

kosma commented 2 years ago

This should preferably be changed to scan for any amounts and combination of \r and \n, like so:

while (*sentence == '\r' || *sentence == '\n')
    sentence++;
if (*sentence)
    return false;
vpetrigo commented 2 years ago

Hello @cmorganBE, @kosma!

Thank you for the review. I applied suggested solution. 😅

vpetrigo commented 2 years ago

@kosma, @cmorganBE sorry for bothering. Would you tell whether that PR can be merged?

kosma commented 2 years ago

Added tests, merged. Sorry it took so long. Thanks for the PR!