Bug 807492 Part 1.2 - Enable to build media/mtransport on BSD, #defines & #include bits r=abr

This commit is contained in:
Landry Breuil 2013-08-13 23:59:57 +02:00
Родитель 5abc7fddbb
Коммит 3eed16be81
6 изменённых файлов: 31 добавлений и 12 удалений

Просмотреть файл

@ -55,7 +55,9 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex
#endif
#include <net/if.h>
#ifndef LINUX
#if !defined(__OpenBSD__) && !defined(__NetBSD__)
#include <net/if_var.h>
#endif
#include <net/if_dl.h>
#include <net/if_types.h>
#include <sys/sockio.h>
@ -80,7 +82,7 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex
#ifdef DARWIN
#if defined(BSD) || defined(DARWIN)
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@ -695,7 +697,7 @@ nr_stun_get_addrs(nr_transport_addr addrs[], int maxaddrs, int drop_loopback, in
int _status=0;
int i;
#ifdef DARWIN
#if defined(BSD) || defined(DARWIN)
_status = stun_get_mib_addrs(addrs, maxaddrs, count);
#elif defined(WIN32)
_status = stun_get_win32_addrs(addrs, maxaddrs, count);

Просмотреть файл

@ -41,11 +41,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sys/socket.h>
#include <net/if.h>
#ifndef LINUX
#if !defined(__OpenBSD__) && !defined(__NetBSD__)
#include <net/if_var.h>
#endif
#include <net/if_dl.h>
#include <net/if_types.h>
#endif
#ifndef BSD
#include <net/route.h>
#endif
#include <netinet/in.h>
#ifndef LINUX
#include <netinet/in_var.h>

Просмотреть файл

@ -44,8 +44,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include <wchar.h>
#ifdef DARWIN
#define HAVE_XLOCALE
#endif
#ifdef __FreeBSD__
#include <osreldate.h>
# if __FreeBSD_version > 900505
# define HAVE_XLOCALE
# endif
#endif
#ifdef HAVE_XLOCALE
#include <xlocale.h>
#endif /* DARWIN */
#endif /* HAVE_XLOCALE */
#include "nr_api.h"
#include "mbslen.h"
@ -54,10 +65,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
int
mbslen(const char *s, size_t *ncharsp)
{
#ifdef DARWIN
#ifdef HAVE_XLOCALE
static locale_t loc = 0;
static int initialized = 0;
#endif /* DARWIN */
#endif /* HAVE_XLOCALE */
#ifdef WIN32
char *my_locale=0;
unsigned int i;
@ -67,7 +78,7 @@ mbslen(const char *s, size_t *ncharsp)
int nchars;
mbstate_t mbs;
#ifdef DARWIN
#ifdef HAVE_XLOCALE
if (! initialized) {
initialized = 1;
loc = newlocale(LC_CTYPE_MASK, "UTF-8", LC_GLOBAL_LOCALE);
@ -76,7 +87,7 @@ mbslen(const char *s, size_t *ncharsp)
if (loc == 0) {
/* unable to create the UTF-8 locale */
assert(loc != 0); /* should never happen */
#endif /* DARWIN */
#endif /* HAVE_XLOCALE */
#ifdef WIN32
if (!setlocale(LC_CTYPE, 0))
@ -99,18 +110,18 @@ mbslen(const char *s, size_t *ncharsp)
ABORT(R_NOT_FOUND);
#endif
#ifdef DARWIN
#ifdef HAVE_XLOCALE
}
#endif /* DARWIN */
#endif /* HAVE_XLOCALE */
memset(&mbs, 0, sizeof(mbs));
nchars = 0;
#ifdef DARWIN
#ifdef HAVE_XLOCALE
while (*s != '\0' && (nbytes = mbrlen_l(s, strlen(s), &mbs, loc)) != 0)
#else
while (*s != '\0' && (nbytes = mbrlen(s, strlen(s), &mbs)) != 0)
#endif /* DARWIN */
#endif /* HAVE_XLOCALE */
{
if (nbytes == (size_t)-1) /* should never happen */ {
ABORT(R_INTERNAL);

Просмотреть файл

@ -48,6 +48,7 @@ static char *RCSSTRING __UNUSED__ ="$Id: r_log.c,v 1.10 2008/11/25 22:25:18 adam
#include "hex.h"
#include <string.h>
#include <errno.h>
#ifndef _MSC_VER
#include <strings.h>
#include <syslog.h>

Просмотреть файл

@ -33,7 +33,7 @@
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
#ifndef DARWIN
#if !defined(__FreeBSD__) && !defined(DARWIN)
#include <stddef.h>
#define __offsetof offsetof
#endif

Просмотреть файл

@ -45,6 +45,7 @@ static char *RCSSTRING __UNUSED__ ="$Id: util.c,v 1.5 2007/11/21 00:09:13 adamca
#include <dirent.h>
#endif
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/stat.h>
#ifdef OPENSSL