Generate the "preference" attribute correctly for candidates on locales

Mon, 28 Sep 2009 18:11:28 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Mon, 28 Sep 2009 18:11:28 +0000
changeset 28593
f6efb49aa838
parent 28592
00498f7596fd
child 28594
3e438648a895
child 28599
ed5b761ca6e9
child 28603
11265cf9206f

Generate the "preference" attribute correctly for candidates on locales
where the decimal separator is ,

libpurple/protocols/jabber/google.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/google.c	Mon Sep 28 06:44:46 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Mon Sep 28 18:11:28 2009 +0000
@@ -104,7 +104,8 @@
 
 	for (;candidates;candidates = candidates->next) {
 		JabberIq *iq;
-		gchar *ip, *port, *pref, *username, *password;
+		gchar *ip, *port, *username, *password;
+		gchar pref[16];
 		PurpleMediaCandidateType type;
 		xmlnode *sess;
 		xmlnode *candidate;
@@ -123,9 +124,8 @@
 		ip = purple_media_candidate_get_ip(transport);
 		port = g_strdup_printf("%d",
 				purple_media_candidate_get_port(transport));
-		pref = g_strdup_printf("%f",
-				purple_media_candidate_get_priority(transport)
-				/1000.0);
+		g_ascii_dtostr(pref, 16,
+			purple_media_candidate_get_priority(transport) / 1000.0);
 		username = purple_media_candidate_get_username(transport);
 		password = purple_media_candidate_get_password(transport);
 		type = purple_media_candidate_get_candidate_type(transport);
@@ -163,7 +163,6 @@
 
 		g_free(ip);
 		g_free(port);
-		g_free(pref);
 		g_free(username);
 		g_free(password);
 

mercurial