diff libpurple/protocols/bonjour/jabber.c @ 21121:35b4f1dc4c8d

replace most calls to strerror with calls to g_strerror. strerror will return a locale-specific string in the locale-specific encoding, which isn't guaranteed to be UTF-8. g_strerror will always return a UTF-8 string. I left gg and zephyr untouched, since gg doesn't include glib headers yet, and zephyr does something weird with a #define for strerror. Someone more familliar with those should take a look. And the win32 guys should check and see if I screwed something up, since they had strerror #defined to something else. This should fix #2247 (and maybe some mystery crashes)
author Nathan Walp <nwalp@pidgin.im>
date Sat, 03 Nov 2007 17:52:28 +0000
parents 8b74b226e023
children 38cc722159ff
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c	Sat Nov 03 17:04:25 2007 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Sat Nov 03 17:52:28 2007 +0000
@@ -244,7 +244,7 @@
 		return;
 	else if (ret <= 0) {
 		PurpleConversation *conv;
-		const char *error = strerror(errno);
+		const char *error = g_strerror(errno);
 
 		purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n",
 				   purple_buddy_get_name(pb), error ? error : "(null)");
@@ -287,7 +287,7 @@
 		ret = 0;
 	else if (ret <= 0) {
 		PurpleConversation *conv;
-		const char *error = strerror(errno);
+		const char *error = g_strerror(errno);
 
 		purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n",
 				   purple_buddy_get_name(pb), error ? error : "(null)");
@@ -337,7 +337,7 @@
 		if (errno != EAGAIN) {
 			BonjourBuddy *bb = pb->proto_data;
 
-			purple_debug_warning("bonjour", "receive error: %s\n", strerror(errno));
+			purple_debug_warning("bonjour", "receive error: %s\n", g_strerror(errno));
 
 			bonjour_jabber_close_conversation(bb->conversation);
 			bb->conversation = NULL;
@@ -427,7 +427,7 @@
 	if (ret == -1 && errno == EAGAIN)
 		return;
 	else if (ret <= 0) {
-		const char *err = strerror(errno);
+		const char *err = g_strerror(errno);
 		PurpleConversation *conv;
 
 		purple_debug_error("bonjour", "Error starting stream with buddy %s at %s:%d error: %s\n",
@@ -482,7 +482,7 @@
 	if (ret == -1 && errno == EAGAIN)
 		ret = 0;
 	else if (ret <= 0) {
-		const char *err = strerror(errno);
+		const char *err = g_strerror(errno);
 
 		purple_debug_error("bonjour", "Error starting stream with buddy %s at %s:%d error: %s\n",
 				   purple_buddy_get_name(pb), bb->ip ? bb->ip : "(null)", bb->port_p2pj, err ? err : "(null)");
@@ -583,7 +583,7 @@
 	/* Open a listening socket for incoming conversations */
 	if ((data->socket = socket(PF_INET, SOCK_STREAM, 0)) < 0)
 	{
-		purple_debug_error("bonjour", "Cannot open socket: %s\n", strerror(errno));
+		purple_debug_error("bonjour", "Cannot open socket: %s\n", g_strerror(errno));
 		purple_connection_error(data->account->gc, _("Cannot open socket"));
 		return -1;
 	}
@@ -591,7 +591,7 @@
 	/* Make the socket reusable */
 	if (setsockopt(data->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0)
 	{
-		purple_debug_error("bonjour", "Error setting socket options: %s\n", strerror(errno));
+		purple_debug_error("bonjour", "Error setting socket options: %s\n", g_strerror(errno));
 		purple_connection_error(data->account->gc, _("Error setting socket options"));
 		return -1;
 	}
@@ -615,7 +615,7 @@
 	/* On no!  We tried 10 ports and could not bind to ANY of them */
 	if (!bind_successful)
 	{
-		purple_debug_error("bonjour", "Cannot bind socket: %s\n", strerror(errno));
+		purple_debug_error("bonjour", "Cannot bind socket: %s\n", g_strerror(errno));
 		purple_connection_error(data->account->gc, _("Could not bind socket to port"));
 		return -1;
 	}
@@ -623,7 +623,7 @@
 	/* Attempt to listen on the bound socket */
 	if (listen(data->socket, 10) != 0)
 	{
-		purple_debug_error("bonjour", "Cannot listen on socket: %s\n", strerror(errno));
+		purple_debug_error("bonjour", "Cannot listen on socket: %s\n", g_strerror(errno));
 		purple_connection_error(data->account->gc, _("Could not listen on socket"));
 		return -1;
 	}
@@ -670,7 +670,7 @@
 	}
 
 	if (!bonjour_jabber_stream_init(pb, source)) {
-		const char *err = strerror(errno);
+		const char *err = g_strerror(errno);
 		PurpleConversation *conv;
 
 		purple_debug_error("bonjour", "Error starting stream with buddy %s at %s:%d error: %s\n",