From 366fca57f2ac164042ec093197c5ebae3e69ceac Mon Sep 17 00:00:00 2001 From: camel Date: Thu, 12 Mar 2009 08:00:52 +0000 Subject: [PATCH] Corrected error converting a string to an int git-svn-id: svn+ssh://garage/var/lib/gforge/svnroot/maemo-mapper/trunk@258 6c538b50-5814-0410-93ad-8bdf4c0149d1 --- src/settings.c | 25 ++++++++++--------------- src/util.h | 1 + 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/settings.c b/src/settings.c index a35272c..913b0d8 100644 --- a/src/settings.c +++ b/src/settings.c @@ -2851,11 +2851,10 @@ void read_aprs_options(TAprsSettings *aprsSettings ) GTK_TOGGLE_BUTTON(aprsSettings->chk_aprs_show_new_station_alert )); - gchar * s_max_stations = g_strdup(gtk_entry_get_text( - GTK_ENTRY(aprsSettings->txt_aprs_max_stations))); - gint64 i64_max_stations = g_ascii_strtoll (s_max_stations, NULL, 10); - _aprs_max_stations = (gint)i64_max_stations; - + //gchar * s_max_stations = g_strdup(gtk_entry_get_text( + // GTK_ENTRY(aprsSettings->txt_aprs_max_stations))); + //_aprs_max_stations = convert_str_to_int(s_max_stations); + //g_free(s_max_stations); // Inet options _aprs_server = g_strdup(gtk_entry_get_text( @@ -2867,24 +2866,22 @@ void read_aprs_options(TAprsSettings *aprsSettings ) _aprs_inet_server_validation = g_strdup(gtk_entry_get_text( GTK_ENTRY(aprsSettings->txt_aprs_inet_server_validation))); - + gchar * s_port = g_strdup(gtk_entry_get_text( GTK_ENTRY(aprsSettings->num_aprs_server_port))); - gint64 i64_port = g_ascii_strtoll (s_port, NULL, 10); - _aprs_server_port = (gint)i64_port; + _aprs_server_port = convert_str_to_int(s_port); + g_free(s_port); gchar * s_beacon_interval = g_strdup(gtk_entry_get_text( GTK_ENTRY(aprsSettings->txt_aprs_inet_beacon_interval ))); - gint64 i64_beacon_interval = g_ascii_strtoll (s_beacon_interval, NULL, 10); + _aprs_inet_beacon_interval = convert_str_to_int(s_beacon_interval); g_free(s_beacon_interval); - _aprs_inet_beacon_interval = (gint)i64_beacon_interval; s_beacon_interval = g_strdup(gtk_entry_get_text( GTK_ENTRY(aprsSettings->txt_tty_beacon_interval ))); - i64_beacon_interval = g_ascii_strtoll (s_beacon_interval, NULL, 10); + _aprs_tty_beacon_interval = convert_str_to_int(s_beacon_interval); g_free(s_beacon_interval); - _aprs_tty_beacon_interval = (gint)i64_beacon_interval; _aprs_inet_beacon_comment = g_strdup(gtk_entry_get_text( @@ -2905,9 +2902,7 @@ void read_aprs_options(TAprsSettings *aprsSettings ) gchar * s_server_auto_filter_km = g_strdup(gtk_entry_get_text( GTK_ENTRY(aprsSettings->txt_auto_filter_range ))); - gint64 i64_server_auto_filter_km = g_ascii_strtoll (s_server_auto_filter_km, NULL, 10); - _aprs_server_auto_filter_km = (gint)i64_server_auto_filter_km; - + _aprs_server_auto_filter_km = convert_str_to_int(s_server_auto_filter_km); _aprs_enable_inet_tx = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(aprsSettings->chk_enable_inet_tx )); diff --git a/src/util.h b/src/util.h index d4a0805..17a3cb8 100644 --- a/src/util.h +++ b/src/util.h @@ -57,5 +57,6 @@ void format_lat_lon(gdouble d_lat, gdouble d_lon, gchar* lat, gchar* lon); gboolean coord_system_check_lat_lon (gdouble lat, gdouble lon, gint *fallback_deg_format); gint64 g_ascii_strtoll(const gchar *nptr, gchar **endptr, guint base); +gint convert_str_to_int(const gchar *str); #endif /* ifndef MAEMO_MAPPER_UTIL_H */ -- 2.45.0