Mercurial > pidgin
diff src/html.c @ 3717:988485669631
[gaim-migrate @ 3850]
Warning fixes and WIN32 ifdef removals
committer: Tailor Script <tailor@pidgin.im>
| author | Herman Bloggs <hermanator12002@yahoo.com> |
|---|---|
| date | Wed, 16 Oct 2002 19:57:03 +0000 |
| parents | 9682c0e022c6 |
| children | a789969fc198 |
line wrap: on
line diff
--- a/src/html.c Wed Oct 16 19:44:19 2002 +0000 +++ b/src/html.c Wed Oct 16 19:57:03 2002 +0000 @@ -32,9 +32,6 @@ #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> -#else -#include <winsock.h> -#include <io.h> #endif #include <sys/types.h> @@ -43,6 +40,10 @@ #include "gaim.h" #include "proxy.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + gchar *strip_html(gchar *text) { int i, j, k; @@ -144,37 +145,23 @@ if (!gunk->sentreq) { char buf[256]; -#ifdef _WIN32 - int imode=1; -#endif + g_snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\n\r\n", gunk->full ? "" : "/", gunk->full ? gunk->url : gunk->website->page); debug_printf("Request: %s\n", buf); -#ifdef _WIN32 - send(sock, buf, strlen(buf), 0); - ioctlsocket(sock, FIONBIO, (unsigned long *)&imode); -#else + write(sock, buf, strlen(buf)); fcntl(sock, F_SETFL, O_NONBLOCK); -#endif gunk->sentreq = TRUE; gunk->inpa = gaim_input_add(sock, GAIM_INPUT_READ, grab_url_callback, dat); return; } -#ifdef _WIN32 - if (recv(sock, &data, 1, 0) > 0 || WSAEWOULDBLOCK == WSAGetLastError()) { - if (WSAEWOULDBLOCK == WSAGetLastError()) { - WSASetLastError(0); - return; - } -#else if (read(sock, &data, 1) > 0 || errno == EWOULDBLOCK) { if (errno == EWOULDBLOCK) { errno = 0; return; } -#endif if (!gunk->startsaving) { if (data == '\r') return; @@ -191,22 +178,14 @@ gunk->webdata = g_realloc(gunk->webdata, gunk->len); gunk->webdata[gunk->len - 1] = data; } -#ifdef _WIN32 - } else if (WSAETIMEDOUT == WSAGetLastError()) { -#else } else if (errno != ETIMEDOUT) { -#endif gunk->webdata = g_realloc(gunk->webdata, gunk->len + 1); gunk->webdata[gunk->len] = 0; debug_printf(_("Received: '%s'\n"), gunk->webdata); gaim_input_remove(gunk->inpa); -#ifdef _WIN32 - closesocket(sock); -#else close(sock); -#endif gunk->callback(gunk->data, gunk->webdata); if (gunk->webdata) g_free(gunk->webdata); @@ -215,11 +194,7 @@ g_free(gunk); } else { gaim_input_remove(gunk->inpa); -#ifdef _WIN32 - closesocket(sock); -#else close(sock); -#endif gunk->callback(gunk->data, NULL); if (gunk->webdata) g_free(gunk->webdata);
