gst/rtsp/: replaced closesocket and close in code with one CLOSE_SOCKET.

Original commit message from CVS:
* gst/rtsp/Makefile.am:
* gst/rtsp/rtspconnection.c: (rtsp_connection_send),
(rtsp_connection_close):
* gst/rtsp/rtspdefs.h:
replaced closesocket and close in code with one CLOSE_SOCKET.
Some more cleanups. Fixes #345301.
This commit is contained in:
Wim Taymans 2006-07-10 16:41:57 +00:00
parent 7089fbac56
commit f08deb4345
4 changed files with 39 additions and 22 deletions

View file

@ -1,3 +1,12 @@
2006-07-10 Wim Taymans <wim@fluendo.com>
* gst/rtsp/Makefile.am:
* gst/rtsp/rtspconnection.c: (rtsp_connection_send),
(rtsp_connection_close):
* gst/rtsp/rtspdefs.h:
replaced closesocket and close in code with one CLOSE_SOCKET.
Some more cleanups. Fixes #345301.
2006-07-10 Tim-Philipp Müller <tim at centricular dot net> 2006-07-10 Tim-Philipp Müller <tim at centricular dot net>
* gst/autodetect/gstautoaudiosink.c: * gst/autodetect/gstautoaudiosink.c:

View file

@ -2,21 +2,21 @@ plugin_LTLIBRARIES = libgstrtsp.la
libgstrtsp_la_SOURCES = gstrtsp.c gstrtspsrc.c \ libgstrtsp_la_SOURCES = gstrtsp.c gstrtspsrc.c \
gstrtpdec.c \ gstrtpdec.c \
rtspconnection.c \ rtspconnection.c \
rtspdefs.c \ rtspdefs.c \
rtspmessage.c \ rtspmessage.c \
rtsptransport.c \ rtsptransport.c \
rtspurl.c \ rtspurl.c \
sdpmessage.c sdpmessage.c
libgstrtsp_la_CFLAGS = $(GST_CFLAGS) libgstrtsp_la_CFLAGS = $(GST_CFLAGS)
libgstrtsp_la_LIBADD = $(GST_LIBS) libgstrtsp_la_LIBADD = $(GST_LIBS) $(WIN32_LIBS)
libgstrtsp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstrtsp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
check_PROGRAMS = test check_PROGRAMS = test
test_SOURCES = test.c rtspdefs.c rtspurl.c rtspconnection.c rtspmessage.c rtsptransport.c sdpmessage.c test_SOURCES = test.c rtspdefs.c rtspurl.c rtspconnection.c rtspmessage.c rtsptransport.c sdpmessage.c
test_CFLAGS = $(GST_CFLAGS) test_CFLAGS = $(GST_CFLAGS)
test_LDFLAGS = $(GST_LIBS) test_LDFLAGS = $(GST_LIBS) $(WIN32_LIBS)
noinst_HEADERS = gstrtspsrc.h gstrtsp.h gstrtpdec.h rtsptransport.h rtsp.h rtspurl.h rtspconnection.h rtspdefs.h rtspmessage.h sdp.h sdpmessage.h noinst_HEADERS = gstrtspsrc.h gstrtsp.h gstrtpdec.h rtsptransport.h rtsp.h rtspurl.h rtspconnection.h rtspdefs.h rtspmessage.h sdp.h sdpmessage.h

View file

@ -26,19 +26,24 @@
/* we include this here to get the G_OS_* defines */ /* we include this here to get the G_OS_* defines */
#include <glib.h> #include <glib.h>
#ifdef G_OS_UNIX #ifdef G_OS_WIN32
#include <winsock2.h>
#else
#include <netdb.h> #include <netdb.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#ifdef G_OS_WIN32
#include <winsock2.h>
#endif
#include "rtspconnection.h" #include "rtspconnection.h"
#ifdef G_OS_WIN32
#define CLOSE_SOCKET(sock) closesocket(sock);
#else
#define CLOSE_SOCKET(sock) close(sock);
#endif
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* note that inet_aton is deprecated on unix because /* note that inet_aton is deprecated on unix because
* inet_addr returns -1 (INADDR_NONE) for the valid 255.255.255.255 * inet_addr returns -1 (INADDR_NONE) for the valid 255.255.255.255
@ -224,12 +229,15 @@ rtsp_connection_send (RTSPConnection * conn, RTSPMessage * message)
startup_error: startup_error:
{ {
GST_DEBUG_OBJECT (self, "Error %d on WSAStartup", error); GST_DEBUG_OBJECT (self, "Error %d on WSAStartup", error);
return RTSP_ERROR; g_warning ("Error %d on WSAStartup", error);
return RTSP_EWSASTART;
} }
version_error: version_error:
{ {
g_warning ("Windows sockets are not version 0x202 (current 0x%x)",
w.wVersion);
WSACleanup (); WSACleanup ();
return RTSP_ERROR; return RTSP_EWSAVERSION;
} }
#endif #endif
write_error: write_error:
@ -586,13 +594,10 @@ rtsp_connection_close (RTSPConnection * conn)
if (conn == NULL) if (conn == NULL)
return RTSP_EINVAL; return RTSP_EINVAL;
res = CLOSE_SOCKET (conn->fd);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
res = socketclose (conn->fd);
WSACleanup (); WSACleanup ();
#else
res = close (conn->fd);
#endif #endif
conn->fd = -1; conn->fd = -1;
if (res != 0) if (res != 0)
goto sys_error; goto sys_error;

View file

@ -25,14 +25,17 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef enum { typedef enum {
RTSP_OK = 0, RTSP_OK = 0,
/* errors */ /* errors */
RTSP_EINVAL = -1, RTSP_EINVAL = -1,
RTSP_ENOMEM = -2, RTSP_ENOMEM = -2,
RTSP_ERESOLV = -3, RTSP_ERESOLV = -3,
RTSP_ENOTIMPL = -4, RTSP_ENOTIMPL = -4,
RTSP_ESYS = -5, RTSP_ESYS = -5,
RTSP_EPARSE = -6, RTSP_EPARSE = -6,
RTSP_EWSASTART = -7,
RTSP_EWSAVERSION = -8,
} RTSPResult; } RTSPResult;
typedef enum { typedef enum {