changeset 3720:34c95669952f

[gaim-migrate @ 3853] WIN32 ifdef removals committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Wed, 16 Oct 2002 21:14:51 +0000
parents 5233e2276a72
children ac084ce0c130
files src/protocols/irc/irc.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/yahoo/yahoo.c
diffstat 4 files changed, 3 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Wed Oct 16 20:02:57 2002 +0000
+++ b/src/protocols/irc/irc.c	Wed Oct 16 21:14:51 2002 +0000
@@ -138,11 +138,7 @@
 static int irc_write(int fd, char *data, int len)
 {
 	debug_printf("IRC C: %s", data);
-#ifndef _WIN32
 	return write(fd, data, len);
-#else
-	return send(fd, data, len, 0);
-#endif
 }
 
 static struct conversation *irc_find_chat(struct gaim_connection *gc, char *name)
@@ -458,11 +454,7 @@
 	int n = 0, l;
 	struct conversation *convo;
 	debug_printf("THIS IS TOO MUCH EFFORT\n");
-#ifndef _WIN32
 	n = read (chat->fd, buffer, IRC_BUF_LEN);
-#else
-	n = recv (chat->fd, buffer, IRC_BUF_LEN, 0);
-#endif
 	if (n > 0) {
 
 		buffer[n] = 0;
@@ -1423,11 +1415,7 @@
 	gchar buf[1024];
 	gboolean off;
 
-#ifndef _WIN32
 	i = read(idata->fd, buf, 1024);
-#else
-	i = recv(idata->fd, buf, 1024, 0);
-#endif
 	if (i <= 0) {
 		hide_login_progress_error(gc, "Read error");
 		signoff(gc);
@@ -1481,11 +1469,7 @@
 	char buf[IRC_BUF_LEN];
 
 	if (!g_slist_find(connections, gc)) {
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		return;
 	}
 
@@ -1601,11 +1585,7 @@
 	if (gc->inpa)
 		gaim_input_remove(gc->inpa);
 
-#ifndef _WIN32
 	close(idata->fd);
-#else
-	closesocket(idata->fd);
-#endif
 	g_free(gc->proto_data);
 }
 
--- a/src/protocols/msn/msn.c	Wed Oct 16 20:02:57 2002 +0000
+++ b/src/protocols/msn/msn.c	Wed Oct 16 21:14:51 2002 +0000
@@ -182,11 +182,7 @@
 static int msn_write(int fd, void *data, int len)
 {
 	debug_printf("MSN C: %s", data);
-#ifndef _WIN32
 	return write(fd, data, len);
-#else
-	return send(fd, data, len, 0);
-#endif
 }
 
 static char *url_decode(const char *msg)
@@ -460,11 +456,7 @@
 
 	if (ms->inpa)
 		gaim_input_remove(ms->inpa);
-#ifndef _WIN32
 	close(ms->fd);
-#else
-	closesocket(ms->fd);
-#endif
 	g_free(ms->rxqueue);
 	if (ms->msg)
 		g_free(ms->msguser);
@@ -706,11 +698,7 @@
 	/* This is really stupid and I hate to put this here. */
 	if (ms->fd != source)
 		ms->fd = source;
-#ifndef _WIN32
 	len = read(ms->fd, buf, sizeof(buf));
-#else
-	len = recv(ms->fd, buf, sizeof(buf), 0);
-#endif
 	if (len <= 0) {
 		msn_kill_switch(ms);
 		return;
@@ -786,11 +774,7 @@
 	char buf[MSN_BUF_LEN];
 
 	if (source == -1 || !g_slist_find(connections, gc)) {
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		g_free(ms->sessid);
 		g_free(ms->auth);
 		g_free(ms);
@@ -804,11 +788,7 @@
 
 	g_snprintf(buf, sizeof(buf), "ANS %d %s %s %s\r\n", ++ms->trId, gc->username, ms->auth, ms->sessid);
 	if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
-#ifndef _WIN32
 		close(ms->fd);
-#else
-		closesocket(ms->fd);
-#endif
 		g_free(ms->sessid);
 		g_free(ms->auth);
 		g_free(ms);
@@ -826,11 +806,7 @@
 	char buf[MSN_BUF_LEN];
 
 	if (source == -1 || !g_slist_find(connections, gc)) {
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		if (g_slist_find(connections, gc)) {
 			msn_kill_switch(ms);
 			do_error_dialog(_("Gaim was unable to send an MSN message"),
@@ -1362,11 +1338,7 @@
 			}
 			ms->auth = g_strdup(tmp);
 		} else {
-#ifndef _WIN32
 			close(md->fd);
-#else
-			closesocket(md->fd);
-#endif
 			gaim_input_remove(md->inpa);
 			md->inpa = 0;
 			md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc);
@@ -1453,11 +1425,7 @@
 	int cont = 1;
 	int len;
 
-#ifndef _WIN32
 	len = read(md->fd, buf, sizeof(buf));
-#else
-	len = recv(md->fd, buf, sizeof(buf), 0);
-#endif
 	if (len <= 0) {
 		hide_login_progress_error(gc, _("Error reading from server"));
 		signoff(gc);
@@ -1533,11 +1501,7 @@
 	char buf[MSN_BUF_LEN];
 
 	if (!g_slist_find(connections, gc)) {
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		return;
 	}
 
@@ -1669,11 +1633,7 @@
 		} else
 			port = 1863;
 
-#ifndef _WIN32
 		close(md->fd);
-#else
-		closesocket(md->fd);
-#endif
 		gaim_input_remove(md->inpa);
 		md->inpa = 0;
 		md->fd = 0;
@@ -1704,11 +1664,7 @@
 	int cont = 1;
 	int len;
 
-#ifndef _WIN32
 	len = read(md->fd, buf, sizeof(buf));
-#else
-	len = recv(md->fd, buf, sizeof(buf), 0);
-#endif
 	if (len <= 0) {
 		hide_login_progress(gc, _("Error reading from server"));
 		signoff(gc);
@@ -1762,11 +1718,7 @@
 	char buf[1024];
 
 	if (!g_slist_find(connections, gc)) {
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		return;
 	}
 
@@ -1813,11 +1765,7 @@
 static void msn_close(struct gaim_connection *gc)
 {
 	struct msn_data *md = gc->proto_data;
-#ifndef _WIN32
 	close(md->fd);
-#else
-	closesocket(md->fd);
-#endif
 	if (md->inpa)
 		gaim_input_remove(md->inpa);
 	g_free(md->rxqueue);
--- a/src/protocols/napster/napster.c	Wed Oct 16 20:02:57 2002 +0000
+++ b/src/protocols/napster/napster.c	Wed Oct 16 21:14:51 2002 +0000
@@ -84,15 +84,9 @@
 
 	size = strlen(message);
 
-#ifndef _WIN32
 	write(ndata->fd, &size, 2);
 	write(ndata->fd, &command, 2);
 	write(ndata->fd, message, size);
-#else
-	send(ndata->fd, (char*)&size, 2, 0);
-	send(ndata->fd, (char*)&command, 2, 0);
-	send(ndata->fd, message, size, 0);
-#endif
 }
 
 static int nap_send_im(struct gaim_connection *gc, char *who, char *message, int len, int flags)
@@ -175,13 +169,7 @@
 	gchar **res;
 	int i;
 
-	if (recv(source,
-#ifndef _WIN32
-		 header,
-#else
-		 (char*)header,
-#endif
-		 4, 0) != 4) {
+	if (recv(source, (void*)header, 4, 0) != 4) {
 		hide_login_progress(gc, "Unable to read");
 		signoff(gc);
 		return;
@@ -383,19 +371,12 @@
 	unsigned short header[2];
 	int len;
 	int command;
-#ifndef _WIN32
+
 	read(source, header, 4);
-#else
-	recv(source, (char*)header, 4, 0);
-#endif
 	len = header[0];
 	command = header[1];	
 
-#ifndef _WIN32
 	read(source, buf, len);
-#else
-	recv(source, buf, len, 0);
-#endif
 	buf[len] = 0;
 
 	/* If we have some kind of error, get outta here */
@@ -404,11 +385,7 @@
 		do_error_dialog(buf, NULL, GAIM_ERROR);
 		gaim_input_remove(ndata->inpa);
 		ndata->inpa = 0;
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		signoff(gc);
 		return;
 	}
@@ -441,11 +418,7 @@
 	char buf[NAP_BUF_LEN];
 
 	if (!g_slist_find(connections, gc)) {
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		return;
 	}
 
--- a/src/protocols/yahoo/yahoo.c	Wed Oct 16 20:02:57 2002 +0000
+++ b/src/protocols/yahoo/yahoo.c	Wed Oct 16 21:14:51 2002 +0000
@@ -365,11 +365,7 @@
 	yahoo_packet_write(pkt, data + pos);
 
 	yahoo_packet_dump(data, len);
-#ifndef _WIN32
 	ret = write(yd->fd, data, len);
-#else
-	ret = send(yd->fd, data, len, 0);
-#endif
 	g_free(data);
 
 	return ret;
@@ -894,19 +890,9 @@
 	char buf[1024];
 	int len;
 
-#ifndef _WIN32
 	len = read(yd->fd, buf, sizeof(buf));
-#else
-	len = recv(yd->fd, buf, sizeof(buf), 0);
-#endif
 
 	if (len <= 0) {
-#ifdef _WIN32
-	        if(len == SOCKET_ERROR)
-		  debug_printf("Error reading socket: %d\n", WSAGetLastError());
-		else if( len == 0 )
-		  debug_printf("Connection was gracefully closed.\n");
-#endif
 		hide_login_progress_error(gc, "Unable to read");
 		signoff(gc);
 		return;
@@ -968,11 +954,7 @@
 	struct yahoo_packet *pkt;
 
 	if (!g_slist_find(connections, gc)) {
-#ifndef _WIN32
 		close(source);
-#else
-		closesocket(source);
-#endif
 		return;
 	}
 
@@ -1040,11 +1022,8 @@
 	g_hash_table_foreach_remove(yd->games, yahoo_destroy_hash, NULL);
 	g_hash_table_destroy(yd->games);
 	if (yd->fd >= 0)
-#ifndef _WIN32
 		close(yd->fd);
-#else
-		closesocket(yd->fd);
-#endif
+
 	if (yd->rxqueue)
 		g_free(yd->rxqueue);
 	yd->rxlen = 0;