diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-06-11 16:48:09 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-06-11 16:48:09 +0000 |
commit | 6ac4f2256749cc720d79317e8eb1a48a706e2db8 (patch) | |
tree | da82bb05e17c1456bbc891a1d47cb3bddee78c4f /libmpdemux/pnm.c | |
parent | 5ccc705d9a256ee7b8297c605838fdc2708b1fd5 (diff) | |
download | mpv-6ac4f2256749cc720d79317e8eb1a48a706e2db8.tar.bz2 mpv-6ac4f2256749cc720d79317e8eb1a48a706e2db8.tar.xz |
Networking support under MinGW.
Patch by flo/yepyep <flodt8@yahoo.de>.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10282 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/pnm.c')
-rw-r--r-- | libmpdemux/pnm.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libmpdemux/pnm.c b/libmpdemux/pnm.c index 6a9b5ea38b..7699d31663 100644 --- a/libmpdemux/pnm.c +++ b/libmpdemux/pnm.c @@ -26,9 +26,6 @@ #include <unistd.h> #include <stdio.h> #include <assert.h> -#include <sys/socket.h> -//#include <netinet/in.h> -//#include <netdb.h> #include <string.h> #include <sys/stat.h> #include <fcntl.h> @@ -37,6 +34,16 @@ #include <sys/time.h> #include <inttypes.h> +#include "config.h" +#ifndef HAVE_WINSOCK2 +#define closesocket close +#include <sys/socket.h> +//#include <netinet/in.h> +//#include <netdb.h> +#else +#include <winsock2.h> +#endif + #include "pnm.h" //#include "libreal/rmff.h" @@ -207,7 +214,11 @@ static int rm_write(int s, const char *buf, int len) { if (n > 0) total += n; else if (n < 0) { +#ifndef HAVE_WINSOCK2 if ((timeout>0) && ((errno == EAGAIN) || (errno == EINPROGRESS))) { +#else + if ((timeout>0) && ((errno == EAGAIN) || (WSAGetLastError() == WSAEINPROGRESS))) { +#endif sleep (1); timeout--; } else return -1; @@ -810,7 +821,7 @@ int pnm_peek_header (pnm_t *this, char *data) { void pnm_close(pnm_t *p) { - if (p->s >= 0) close(p->s); + if (p->s >= 0) closesocket(p->s); free(p->path); free(p); } |