diff src/network.c @ 8250:b248c1f4efbd

[gaim-migrate @ 8973] 1) Minor changes to the network listen code again. Tim, let me know if you have any other suggestions. 2) Changed how charsets are handled in oscar a tad bit. I think this should guarantee that Gaim doesn't crash when people send funky messages, or have funky away messages or really anything that is using a charset that isn't utf8, iso-8859-1, ucs-2be, or ascii. Ethan, this should fix the problem with that person's away message. Although, the message itself still looks kinda funky to me. The encoding is Windows-31J, which is apparently a valid iconv encoding? You would know more than I. 3) Fix the following crash: 1. IM yourself a message on AIM 2. Do NOT begin to type a second message, but instead hit CTRL+up committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 13 Feb 2004 05:37:12 +0000
parents fabcfd9a7c1c
children 86b8d8b4287e
line wrap: on
line diff
--- a/src/network.c	Thu Feb 12 23:51:39 2004 +0000
+++ b/src/network.c	Fri Feb 13 05:37:12 2004 +0000
@@ -189,19 +189,23 @@
 	return listenfd;
 }
 
-int gaim_network_listen(short port)
+int gaim_network_listen(unsigned short port)
 {
+	g_return_val_if_fail(port != 0, -1);
+
 	return gaim_network_do_listen(port);
 }
 
-int gaim_network_listen_range(short start, short end)
+int gaim_network_listen_range(unsigned short start, unsigned short end)
 {
 	int ret = -1;
 
-	if (gaim_prefs_get_bool("/core/network/ports_range_use") ||
-		(start > end) || (start < 0) || (end < 0)) {
+	if (gaim_prefs_get_bool("/core/network/ports_range_use")) {
 		start = gaim_prefs_get_int("/core/network/ports_range_start");
 		end = gaim_prefs_get_int("/core/network/ports_range_end");
+	} else {
+		if (end < start)
+			end = start;
 	}
 
 	for (; start <= end; start++) {