Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
2bfba7c6
Commit
2bfba7c6
authored
Oct 20, 2003
by
brendan
Browse files
Leigh Smith's MINGW32 compatibility patch, with modifications for better
autoconf feng shui svn path=/trunk/m4/; revision=5490
parent
42256bc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
m4/xiph_net.m4
View file @
2bfba7c6
...
...
@@ -5,6 +5,9 @@ AC_DEFUN([XIPH_NET],
AC_REQUIRE([XIPH_TYPE_SOCKLEN_T])
AC_REQUIRE([XIPH_FUNC_VA_COPY])
AC_CHECK_HEADERS([sys/select.h sys/uio.h])
AC_CHECK_HEADER([winsock2.h],
[AC_DEFINE([HAVE_WINSOCK2_H], [1], [Define if you have winsock2.h on MINGW])
LIBS="$LIBS -lwsock32"])
# These tests are ordered based on solaris 8 tests
AC_SEARCH_LIBS([sethostent], [nsl],
...
...
src/net/sock.c
View file @
2bfba7c6
...
...
@@ -50,13 +50,14 @@
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EALREADY WSAEALREADY
#define socklen_t int
#ifndef __MINGW32__
#define va_copy(ap1, ap2) memcpy(&ap1, &ap2, sizeof(va_list))
#endif
#endif
#include
"sock.h"
#include
"resolver.h"
/* sock_initialize
**
** initializes the socket library. you must call this
...
...
@@ -160,7 +161,8 @@ int sock_valid_socket(sock_t sock)
socklen_t
optlen
;
optlen
=
sizeof
(
int
);
ret
=
getsockopt
(
sock
,
SOL_SOCKET
,
SO_TYPE
,
&
optval
,
&
optlen
);
/* apparently on windows getsockopt.optval is a char * */
ret
=
getsockopt
(
sock
,
SOL_SOCKET
,
SO_TYPE
,
(
void
*
)
&
optval
,
&
optlen
);
return
(
ret
==
0
);
}
...
...
@@ -193,7 +195,11 @@ int inet_aton(const char *s, struct in_addr *a)
int
sock_set_blocking
(
sock_t
sock
,
const
int
block
)
{
#ifdef _WIN32
#ifdef __MINGW32__
u_long
varblock
=
block
;
#else
int
varblock
=
block
;
#endif
#endif
if
((
!
sock_valid_socket
(
sock
))
||
(
block
<
0
)
||
(
block
>
1
))
...
...
@@ -433,10 +439,14 @@ int sock_connected (int sock, unsigned timeout)
switch
(
select
(
sock
+
1
,
NULL
,
&
wfds
,
NULL
,
&
tv
))
{
case
0
:
return
SOCK_TIMEOUT
;
default:
if
(
getsockopt
(
sock
,
SOL_SOCKET
,
SO_ERROR
,
&
val
,
&
size
)
<
0
)
val
=
SOCK_ERROR
;
case
-
1
:
return
val
;
case
0
:
return
SOCK_TIMEOUT
;
default:
/* on windows getsockopt.val is defined as char* */
if
(
getsockopt
(
sock
,
SOL_SOCKET
,
SO_ERROR
,
(
void
*
)
&
val
,
&
size
)
<
0
)
val
=
SOCK_ERROR
;
case
-
1
:
return
val
;
}
}
...
...
src/net/sock.h
View file @
2bfba7c6
...
...
@@ -24,11 +24,14 @@
#include
<stdarg.h>
#ifdef
_WIN32
#ifdef
HAVE_WINSOCK2_H
#include
<winsock2.h>
#include
<os.h>
#else
#endif
#ifdef HAVE_UNISTD_H
#include
<unistd.h>
#elif _WIN32
#include
<os.h>
#endif
#ifdef HAVE_SYS_UIO_H
...
...
src/timing/timing.c
View file @
2bfba7c6
...
...
@@ -24,6 +24,10 @@
#include
<sys/select.h>
#endif
#ifdef __MINGW32__
#include
<sys/timeb.h>
#endif
#include
"timing.h"
/* see timing.h for an explanation of _mangle() */
...
...
@@ -34,7 +38,14 @@
uint64_t
timing_get_time
(
void
)
{
#ifdef _WIN32
#ifdef __MINGW32__
struct
timeb
t
;
ftime
(
&
t
);
return
t
.
time
*
1000
+
t
.
millitm
)
#else
return
timeGetTime
();
#endif
#else
struct
timeval
mtv
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment