From: Kaj-Michael Lang Date: Tue, 15 Jan 2008 15:01:16 +0000 (+0200) Subject: Use g_snprintf X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df3440b3f534dd83a33edb9ac4de5ad32762fec6;p=mapper Use g_snprintf --- diff --git a/src/config-gconf.c b/src/config-gconf.c index a7e0283..71dfa1b 100644 --- a/src/config-gconf.c +++ b/src/config-gconf.c @@ -116,7 +116,7 @@ for (curr = _repo_list; curr != NULL; curr = curr->next) { */ RepoData *rd = curr->data; gchar buffer[BUFFER_SIZE]; - snprintf(buffer, sizeof(buffer), + g_snprintf(buffer, sizeof(buffer), "%s\t%s\t%s\t%d\t%d\t%d\t%d", rd->name, rd->url, @@ -344,7 +344,7 @@ gconf_client_set_int(gconf_client, GCONF_KEY_ROUTE_DL_RADIUS, _route_dl_radius, /* Save Colors. */ for (i = 0; i < COLORABLE_ENUM_COUNT; i++) { - snprintf(buffer, sizeof(buffer), "#%02x%02x%02x", + g_snprintf(buffer, sizeof(buffer), "#%02x%02x%02x", _color[i].red >> 8, _color[i].green >> 8, _color[i].blue >> 8); gconf_client_set_string(gconf_client, COLORABLE_GCONF[i], buffer, NULL); } diff --git a/src/db.c b/src/db.c index b966f8b..3081295 100644 --- a/src/db.c +++ b/src/db.c @@ -39,7 +39,7 @@ gchar **pszResult; guint nRow, nColumn; gchar sql[64]; -snprintf(sql, sizeof(sql),"select count(*) from %s", table); +g_snprintf(sql, sizeof(sql),"select count(*) from %s", table); if (SQLITE_OK != sqlite3_get_table(db, sql, &pszResult, &nRow, &nColumn, NULL)) return FALSE; diff --git a/src/gpx.c b/src/gpx.c index bafb012..0f96859 100644 --- a/src/gpx.c +++ b/src/gpx.c @@ -66,7 +66,7 @@ handle, (string), strlen((string)), &size))) \ { \ gchar buffer[BUFFER_SIZE]; \ - snprintf(buffer, sizeof(buffer), \ + g_snprintf(buffer, sizeof(buffer), \ "%s:\n%s\n%s", _("Error while writing to file"), \ _("File is incomplete."), \ gnome_vfs_result_to_string(vfs_result)); \ @@ -110,7 +110,7 @@ time_t time1; struct tm time2; time1 = time(NULL); localtime_r(&time1, &time2); -snprintf(XML_TZONE, sizeof(XML_TZONE), "%+03ld:%02ld", +g_snprintf(XML_TZONE, sizeof(XML_TZONE), "%+03ld:%02ld", (time2.tm_gmtoff / 60 / 60), (time2.tm_gmtoff / 60) % 60); } diff --git a/src/route.c b/src/route.c index afb73c0..33a1b6b 100644 --- a/src/route.c +++ b/src/route.c @@ -138,7 +138,7 @@ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))) { gchar strlon[32]; g_ascii_formatd(strlat, 32, "%.06f", _gps.lat); g_ascii_formatd(strlon, 32, "%.06f", _gps.lon); - snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon); + g_snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon); gtk_entry_set_text(GTK_ENTRY(oti->txt_from), buffer); } else if (toggle == oti->rad_use_route) { gchar buffer[80]; @@ -154,7 +154,7 @@ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle))) { unit2latlon(p->unitx, p->unity, lat, lon); g_ascii_formatd(strlat, 32, "%.06f", lat); g_ascii_formatd(strlon, 32, "%.06f", lon); - snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon); + g_snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon); gtk_entry_set_text(GTK_ENTRY(oti->txt_from), buffer); } gtk_widget_set_sensitive(oti->txt_from, toggle == oti->rad_use_text); @@ -399,7 +399,7 @@ while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { from_escaped = gnome_vfs_escape_string(from); to_escaped = gnome_vfs_escape_string(to); - snprintf(buffer, sizeof(buffer), source_url, from_escaped, to_escaped); + g_snprintf(buffer, sizeof(buffer), source_url, from_escaped, to_escaped); g_free(from_escaped); g_free(to_escaped);