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

Change dgps_age type from int to minmea_float #35

Closed gdpinchina closed 5 years ago

gdpinchina commented 5 years ago

As shown in http://www.catb.org/gpsd/NMEA.html#_gga_global_positioning_system_fix_data:

$--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF>
                                                            ↑
                                                         dgps_age

dgps_age is a float type instead of int.

kosma commented 5 years ago

Hi,

Thanks for the fix. There's one thing I cannot let slip, though: the memset() calls are triggering undefined behavior and are not portable. Please use the following initialization instead:

struct minmea_sentence_gga expected = {};

expected = (struct minmea_sentence_gga) {
    .time = ...
}

ck_assert(...)

Kosma.

gdpinchina commented 5 years ago

Hi, I updated the code. I think it should work this time:)

kosma commented 5 years ago

Thanks! Merged.