diff options
author | mdankov <mdankov@users.noreply.github.com> | 2015-11-14 00:03:05 +0300 |
---|---|---|
committer | mdankov <mdankov@users.noreply.github.com> | 2015-11-14 00:03:05 +0300 |
commit | 3dcf4ba91e33a327d920cedfe29455569c3de747 (patch) | |
tree | 40b9f2109eda214a20c17d9b9eea6ee27e7eb117 /navit/gui/internal | |
parent | de4afe05c8b5a599f5ad9c595501e24615a1413e (diff) | |
download | navit-3dcf4ba91e33a327d920cedfe29455569c3de747.tar.gz |
Fix:gui_internal:memleakR6368
Different implementation of #1331 to fix memory leak
Diffstat (limited to 'navit/gui/internal')
-rw-r--r-- | navit/gui/internal/gui_internal_command.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c index 03d1e59e5..77d343f09 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -57,7 +57,6 @@ coordinates_geo(const struct coord_geo *gc, char sep) int lat_deg,lat_min,lat_sec; int lng_deg,lng_min,lng_sec; struct coord_geo g=*gc; - char *ret; if (g.lat < 0) { g.lat=-g.lat; @@ -74,21 +73,8 @@ coordinates_geo(const struct coord_geo *gc, char sep) lng_min=fmod(g.lng*60-lng_sec/60.0+0.5,60); lng_deg=g.lng-lng_min/60.0-lng_sec/3600.0+0.5;; - /* Don't use g_strdup_printf for the full string because it has issues with extended ANSI characters - * (notably the degree sign, 0xb0) on Android Lollipop. - */ - ret = g_strjoin(NULL, - g_strdup_printf("%d", lat_deg), "°", - g_strdup_printf("%d", lat_min), "'", - g_strdup_printf("%d", lat_sec), "\" ", - g_strnfill(1, latc), - g_strnfill(1, sep), - g_strdup_printf("%d", lng_deg), "°", - g_strdup_printf("%d", lng_min), "'", - g_strdup_printf("%d", lng_sec), "\" ", - g_strnfill(1, lngc), - NULL); - return ret; + /* Using degree sign directly in g_strdup_printf format string breaks things on Android Lollipop, see trac #1331. */ + return g_strdup_printf("%d%s%d'%d\" %c%c%d%s%d'%d\" %c",lat_deg,"°",lat_min,lat_sec,latc,sep,lng_deg,"°",lng_min,lng_sec,lngc); } /** |