PUD: pull in nmealib v0.6.8
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 11 May 2012 17:27:33 +0000 (19:27 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 11 May 2012 17:27:44 +0000 (19:27 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/nmealib/Makefile.inc
lib/pud/nmealib/src/gmath.c
lib/pud/nmealib/src/parser.c

index 1c94397..50f9a86 100644 (file)
@@ -24,7 +24,7 @@ GITVERSION = $(shell git describe --dirty='-dirty')
 
 # we expect the version to be like 'v0.5.3-27-g0c2727a' and then strip the 'v',
 # and the '-27-g0c2727a' parts
-VERSION=0.6.7
+VERSION=0.6.8
 
 # protect against no version number
 ifeq ($(strip $(VERSION)),)
index d0fda8c..5b0e9ae 100644 (file)
@@ -119,7 +119,7 @@ double nmea_distance_ellipsoid(
     double L, phi1, phi2, U1, U2, sin_U1, sin_U2, cos_U1, cos_U2;
     double sigma, sin_sigma, cos_sigma, cos_2_sigmam, sqr_cos_2_sigmam, sqr_cos_alpha, lambda, sin_lambda, cos_lambda, delta_lambda;
     int remaining_steps; 
-    double sqr_u, A, B, delta_sigma;
+    double sqr_u, A, B, delta_sigma, lambda_prev;
 
     /* Check input */
     NMEA_ASSERT(from_pos != 0);
@@ -161,14 +161,16 @@ double nmea_distance_ellipsoid(
     sqr_cos_alpha = 0;
     lambda = L;
     sin_lambda = sin(lambda);                            
-    cos_lambda = cos(lambda);                       
-    delta_lambda = lambda;
+    cos_lambda = cos(lambda);  
+    lambda_prev = (double)2.0 * (double)NMEA_PI;
+    delta_lambda = lambda_prev - lambda;
+    if ( delta_lambda < 0 ) delta_lambda = -delta_lambda;
     remaining_steps = 20; 
 
     while ((delta_lambda > 1e-12) && (remaining_steps > 0)) 
     { /* Iterate */
         /* Variables */
-        double tmp1, tmp2, sin_alpha, cos_alpha, C, lambda_prev;
+        double tmp1, tmp2, sin_alpha, cos_alpha, C;
 
         /* Calculation */
         tmp1 = cos_U2 * sin_lambda;
index 4884321..b04385d 100644 (file)
@@ -197,6 +197,7 @@ int nmea_parser_real_push(nmeaPARSER *parser, const char *buff, int buff_sz)
                     (const char *)parser->buffer + nparsed,
                     sen_sz, (nmeaGPGGA *)node->pack))
                 {
+                    free(node->pack);
                     free(node);
                     node = 0;
                 }
@@ -209,6 +210,7 @@ int nmea_parser_real_push(nmeaPARSER *parser, const char *buff, int buff_sz)
                     (const char *)parser->buffer + nparsed,
                     sen_sz, (nmeaGPGSA *)node->pack))
                 {
+                    free(node->pack);
                     free(node);
                     node = 0;
                 }
@@ -221,6 +223,7 @@ int nmea_parser_real_push(nmeaPARSER *parser, const char *buff, int buff_sz)
                     (const char *)parser->buffer + nparsed,
                     sen_sz, (nmeaGPGSV *)node->pack))
                 {
+                    free(node->pack);
                     free(node);
                     node = 0;
                 }
@@ -233,6 +236,7 @@ int nmea_parser_real_push(nmeaPARSER *parser, const char *buff, int buff_sz)
                     (const char *)parser->buffer + nparsed,
                     sen_sz, (nmeaGPRMC *)node->pack))
                 {
+                    free(node->pack);
                     free(node);
                     node = 0;
                 }
@@ -245,6 +249,7 @@ int nmea_parser_real_push(nmeaPARSER *parser, const char *buff, int buff_sz)
                     (const char *)parser->buffer + nparsed,
                     sen_sz, (nmeaGPVTG *)node->pack))
                 {
+                    free(node->pack);
                     free(node);
                     node = 0;
                 }