[vlc-commits] Selectable pipe hack cosmetic changes
Rémi Denis-Courmont
git at videolan.org
Sat Oct 15 09:38:48 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Oct 14 17:45:32 2011 +0300| [de6f5699c2478de6e77caf634d23c9ff0d24b62a] | committer: Rémi Denis-Courmont
Selectable pipe hack cosmetic changes
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de6f5699c2478de6e77caf634d23c9ff0d24b62a
---
src/misc/objects.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 1a16c34..07336fa 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -55,11 +55,6 @@
#ifdef __OS2__
# include <sys/socket.h>
# include <netinet/in.h>
-
-typedef struct sockaddr_in SOCKADDR_IN;
-typedef struct sockaddr *PSOCKADDR;
-
-# define closesocket soclose
#elif defined(WIN32)
# include <io.h>
# include <winsock2.h>
@@ -302,28 +297,28 @@ static void vlc_object_destroy( vlc_object_t *p_this )
# define vlc_pipe selectable_pipe
static int selectable_pipe (int fd[2])
{
- SOCKADDR_IN addr;
+ struct sockaddr_in addr;
int addrlen = sizeof (addr);
- int l = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP), a,
+ int l = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP),
c = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
- if ((l == -1) || (c == -1))
+ if (l == -1 || c == -1)
goto error;
memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- if (bind (l, (PSOCKADDR)&addr, sizeof (addr))
- || getsockname (l, (PSOCKADDR)&addr, &addrlen)
+ if (bind (l, (struct sockaddr *)&addr, sizeof (addr))
+ || getsockname (l, (struct sockaddr *)&addr, &addrlen)
|| listen (l, 1)
- || connect (c, (PSOCKADDR)&addr, addrlen))
+ || connect (c, (struct sockaddr *)&addr, addrlen))
goto error;
- a = accept (l, NULL, NULL);
+ int a = accept (l, NULL, NULL);
if (a == -1)
goto error;
- closesocket (l);
+ close (l);
//shutdown (a, 0);
//shutdown (c, 1);
fd[0] = c;
@@ -332,9 +327,9 @@ static int selectable_pipe (int fd[2])
error:
if (l != -1)
- closesocket (l);
+ close (l);
if (c != -1)
- closesocket (c);
+ close (c);
return -1;
}
#endif /* WIN32 || __OS2__ */
More information about the vlc-commits
mailing list