diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-05-06 13:52:59 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-05-06 13:52:59 -0400 |
commit | d509d5cc2e07ae005e7bc96ef4b2507decf2b4be (patch) | |
tree | c8edd72765d67686d6b0b2ab6d405a3c1dc87058 /gpsdclient.c | |
parent | 9b90adba539236f44ee47f3e996bd87ef521b648 (diff) | |
download | gpsd-d509d5cc2e07ae005e7bc96ef4b2507decf2b4be.tar.gz |
Attempt fix for Maidenhead off-by-one rrror.
All regression tests pass.
Diffstat (limited to 'gpsdclient.c')
-rw-r--r-- | gpsdclient.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gpsdclient.c b/gpsdclient.c index b4c0723a..5b49c0f7 100644 --- a/gpsdclient.c +++ b/gpsdclient.c @@ -183,21 +183,21 @@ char *maidenhead(double n, double e) int t1; e=e+180.0; t1=(int)(e/20); - buf[0]=(char)t1+'A'; + buf[0]=(char)t1+'@'; e-=(float)t1*20.0; t1=(int)e/2; - buf[2]=(char)t1+'0'; + buf[2]=(char)t1+'/'; e-=(float)t1*2; - buf[4]=(char)(int)(e*12.0+0.5)+'a'; + buf[4]=(char)(int)(e*12.0+0.5)+'`'; n=n+90.0; t1=(int)(n/10.0); - buf[1]=(char)t1+'A'; + buf[1]=(char)t1+'@'; n-=(float)t1*10.0; - buf[3]=(char)n+'0'; + buf[3]=(char)n+'/'; n-=(int)n; n*=24; // convert to 24 division - buf[5]=(char)(int)(n+0.5)+'a'; + buf[5]=(char)(int)(n+0.5)+'`'; buf[6] = '\0'; return buf; |