From: camel Date: Tue, 30 Dec 2008 21:54:26 +0000 (+0000) Subject: Corrected conversion to British National Grid X-Git-Tag: fremantle/3.0+alpha0~117 X-Git-Url: http://git.itanic.dy.fi/?p=maemo-mapper;a=commitdiff_plain;h=5bd8eac8ba7f87f34c81cd807b840e427fd96bc1 Corrected conversion to British National Grid git-svn-id: svn+ssh://garage/var/lib/gforge/svnroot/maemo-mapper/trunk@233 6c538b50-5814-0410-93ad-8bdf4c0149d1 --- diff --git a/src/util.c b/src/util.c index 16f04be..95cdadb 100644 --- a/src/util.c +++ b/src/util.c @@ -602,13 +602,9 @@ gboolean convert_os_grid_to_bng(gint easting, gint northing, gchar* bng) snprintf(eing, 12, "%u", easting); snprintf(ning, 12, "%u", northing); - gint lnth = strlen(eing); - // Note - we only want 4 numbers - snprintf(eing, 5, "%s", eing+(lnth-5)); - - lnth = strlen(ning); - snprintf(ning, 5, "%s", ning+(lnth-5)); - + snprintf(eing, 5, "%s", eing+1); + snprintf(ning, 5, "%s", ning+1); + sprintf(bng, "%c%c%s%s", (char)(tmp + 65), (char)(eX + 65),